]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: remove blk_needs_flush_plug
authorChristoph Hellwig <hch@lst.de>
Thu, 27 Jan 2022 07:05:48 +0000 (08:05 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 Feb 2022 14:50:00 +0000 (07:50 -0700)
blk_needs_flush_plug fails to account for the cb_list, which needs
flushing as well.  Remove it and just check if there is a plug instead
of poking into the internals of the plug structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220127070549.1377856-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/fs-writeback.c
include/linux/blkdev.h
kernel/exit.c
kernel/sched/core.c

index f8d7fe6db989eb51c3ab481464b746c45ec1c0a9..f4ce38f6fc31c587e2ae4d07262dfe2966b08b4e 100644 (file)
@@ -2301,7 +2301,7 @@ void wakeup_flusher_threads(enum wb_reason reason)
        /*
         * If we are expecting writeback progress we must submit plugged IO.
         */
-       if (blk_needs_flush_plug(current))
+       if (current->plug)
                blk_flush_plug(current->plug, true);
 
        rcu_read_lock();
index 99a4384bb8a56a40591a87990fbcd47d839471e3..f902a1c2fac0e892cda69c337ea2cd42e704ca8a 100644 (file)
@@ -1055,14 +1055,6 @@ extern void blk_finish_plug(struct blk_plug *);
 
 void blk_flush_plug(struct blk_plug *plug, bool from_schedule);
 
-static inline bool blk_needs_flush_plug(struct task_struct *tsk)
-{
-       struct blk_plug *plug = tsk->plug;
-
-       return plug &&
-                (plug->mq_list || !list_empty(&plug->cb_list));
-}
-
 int blkdev_issue_flush(struct block_device *bdev);
 long nr_blockdev_pages(void);
 #else /* CONFIG_BLOCK */
@@ -1086,11 +1078,6 @@ static inline void blk_flush_plug(struct blk_plug *plug, bool async)
 {
 }
 
-static inline bool blk_needs_flush_plug(struct task_struct *tsk)
-{
-       return false;
-}
-
 static inline int blkdev_issue_flush(struct block_device *bdev)
 {
        return 0;
index b00a25bb4ab939fb54e29785f9365c01c1447080..11fc6c9df9f28ba573c6c1bddf69f16459060e77 100644 (file)
@@ -735,7 +735,7 @@ void __noreturn do_exit(long code)
        struct task_struct *tsk = current;
        int group_dead;
 
-       WARN_ON(blk_needs_flush_plug(tsk));
+       WARN_ON(tsk->plug);
 
        /*
         * If do_dead is called because this processes oopsed, it's possible
index 848eaa0efe0eadf6abfaa53302240d635a68b4df..3487bb92d1f2a3ebbf97203da6f0750dfa7a8060 100644 (file)
@@ -6344,7 +6344,7 @@ static inline void sched_submit_work(struct task_struct *tsk)
         * If we are going to sleep and we have plugged IO queued,
         * make sure to submit it to avoid deadlocks.
         */
-       if (blk_needs_flush_plug(tsk))
+       if (tsk->plug)
                blk_flush_plug(tsk->plug, true);
 }