]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
loop: don't set QUEUE_FLAG_NOMERGES
authorChristoph Hellwig <hch@lst.de>
Thu, 27 Jun 2024 12:49:11 +0000 (14:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:00:10 +0000 (12:00 +0200)
[ Upstream commit 667ea36378cf7f669044b27871c496e1559c872a ]

QUEUE_FLAG_NOMERGES isn't really a driver interface, but a user tunable.
There also isn't any good reason to set it in the loop driver.

The original commit adding it (5b5e20f421c0b6d "block: loop: set
QUEUE_FLAG_NOMERGES for request queue of loop") claims that "It doesn't
make sense to enable merge because the I/O submitted to backing file is
handled page by page."  which of course isn't true for multi-page bvec
now, and it never has been for direct I/O, for which commit 40326d8a33d
("block/loop: allow request merge for directio mode") alredy disabled
the nomerges flag.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240627124926.512662-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/loop.c

index 1153721bc7c25086e23974297ecab2b383cd144a..41cfcf9efcfc54f1ba1b88946b0a7dbe34a56bda 100644 (file)
@@ -211,13 +211,10 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
        if (lo->lo_state == Lo_bound)
                blk_mq_freeze_queue(lo->lo_queue);
        lo->use_dio = use_dio;
-       if (use_dio) {
-               blk_queue_flag_clear(QUEUE_FLAG_NOMERGES, lo->lo_queue);
+       if (use_dio)
                lo->lo_flags |= LO_FLAGS_DIRECT_IO;
-       } else {
-               blk_queue_flag_set(QUEUE_FLAG_NOMERGES, lo->lo_queue);
+       else
                lo->lo_flags &= ~LO_FLAGS_DIRECT_IO;
-       }
        if (lo->lo_state == Lo_bound)
                blk_mq_unfreeze_queue(lo->lo_queue);
 }
@@ -2059,14 +2056,6 @@ static int loop_add(int i)
        }
        lo->lo_queue = lo->lo_disk->queue;
 
-       /*
-        * By default, we do buffer IO, so it doesn't make sense to enable
-        * merge because the I/O submitted to backing file is handled page by
-        * page. For directio mode, merge does help to dispatch bigger request
-        * to underlayer disk. We will enable merge once directio is enabled.
-        */
-       blk_queue_flag_set(QUEUE_FLAG_NOMERGES, lo->lo_queue);
-
        /*
         * Disable partition scanning by default. The in-kernel partition
         * scanning can be requested individually per-device during its