block: check that there is a plug in blk_flush_plug

Rename blk_flush_plug to __blk_flush_plug and add a wrapper that includes
the NULL check instead of open coding that check everywhere.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Link: https://lore.kernel.org/r/20220127070549.1377856-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig
2022-01-27 08:05:49 +01:00
committed by Jens Axboe
parent b1f866b013
commit aa8dcccaf3
4 changed files with 13 additions and 14 deletions

View File

@@ -1903,8 +1903,7 @@ static long writeback_sb_inodes(struct super_block *sb,
* unplug, so get our IOs out the door before we
* give up the CPU.
*/
if (current->plug)
blk_flush_plug(current->plug, false);
blk_flush_plug(current->plug, false);
cond_resched();
}
@@ -2301,8 +2300,7 @@ void wakeup_flusher_threads(enum wb_reason reason)
/*
* If we are expecting writeback progress we must submit plugged IO.
*/
if (current->plug)
blk_flush_plug(current->plug, true);
blk_flush_plug(current->plug, true);
rcu_read_lock();
list_for_each_entry_rcu(bdi, &bdi_list, bdi_list)