@@ -915,8 +915,6 @@ xfs_buf_lock(
915
915
916
916
if (atomic_read (& bp -> b_pin_count ) && (bp -> b_flags & XBF_STALE ))
917
917
xfs_log_force (bp -> b_target -> bt_mount , 0 );
918
- if (atomic_read (& bp -> b_io_remaining ))
919
- blk_flush_plug (current );
920
918
down (& bp -> b_sema );
921
919
XB_SET_OWNER (bp );
922
920
@@ -1305,8 +1303,6 @@ xfs_buf_iowait(
1305
1303
{
1306
1304
trace_xfs_buf_iowait (bp , _RET_IP_ );
1307
1305
1308
- if (atomic_read (& bp -> b_io_remaining ))
1309
- blk_flush_plug (current );
1310
1306
wait_for_completion (& bp -> b_iowait );
1311
1307
1312
1308
trace_xfs_buf_iowait_done (bp , _RET_IP_ );
@@ -1743,8 +1739,8 @@ xfsbufd(
1743
1739
do {
1744
1740
long age = xfs_buf_age_centisecs * msecs_to_jiffies (10 );
1745
1741
long tout = xfs_buf_timer_centisecs * msecs_to_jiffies (10 );
1746
- int count = 0 ;
1747
1742
struct list_head tmp ;
1743
+ struct blk_plug plug ;
1748
1744
1749
1745
if (unlikely (freezing (current ))) {
1750
1746
set_bit (XBT_FORCE_SLEEP , & target -> bt_flags );
@@ -1760,16 +1756,15 @@ xfsbufd(
1760
1756
1761
1757
xfs_buf_delwri_split (target , & tmp , age );
1762
1758
list_sort (NULL , & tmp , xfs_buf_cmp );
1759
+
1760
+ blk_start_plug (& plug );
1763
1761
while (!list_empty (& tmp )) {
1764
1762
struct xfs_buf * bp ;
1765
1763
bp = list_first_entry (& tmp , struct xfs_buf , b_list );
1766
1764
list_del_init (& bp -> b_list );
1767
1765
xfs_bdstrat_cb (bp );
1768
- count ++ ;
1769
1766
}
1770
- if (count )
1771
- blk_flush_plug (current );
1772
-
1767
+ blk_finish_plug (& plug );
1773
1768
} while (!kthread_should_stop ());
1774
1769
1775
1770
return 0 ;
@@ -1789,6 +1784,7 @@ xfs_flush_buftarg(
1789
1784
int pincount = 0 ;
1790
1785
LIST_HEAD (tmp_list );
1791
1786
LIST_HEAD (wait_list );
1787
+ struct blk_plug plug ;
1792
1788
1793
1789
xfs_buf_runall_queues (xfsconvertd_workqueue );
1794
1790
xfs_buf_runall_queues (xfsdatad_workqueue );
@@ -1803,6 +1799,8 @@ xfs_flush_buftarg(
1803
1799
* we do that after issuing all the IO.
1804
1800
*/
1805
1801
list_sort (NULL , & tmp_list , xfs_buf_cmp );
1802
+
1803
+ blk_start_plug (& plug );
1806
1804
while (!list_empty (& tmp_list )) {
1807
1805
bp = list_first_entry (& tmp_list , struct xfs_buf , b_list );
1808
1806
ASSERT (target == bp -> b_target );
@@ -1813,10 +1811,10 @@ xfs_flush_buftarg(
1813
1811
}
1814
1812
xfs_bdstrat_cb (bp );
1815
1813
}
1814
+ blk_finish_plug (& plug );
1816
1815
1817
1816
if (wait ) {
1818
- /* Expedite and wait for IO to complete. */
1819
- blk_flush_plug (current );
1817
+ /* Wait for IO to complete. */
1820
1818
while (!list_empty (& wait_list )) {
1821
1819
bp = list_first_entry (& wait_list , struct xfs_buf , b_list );
1822
1820
0 commit comments