BACKPORT: block/loop: set hw_sectors
authorShaohua Li <shli@fb.com>
Fri, 1 Sep 2017 05:09:45 +0000 (22:09 -0700)
committerivanmeler <i_ivan@windowslive.com>
Wed, 13 Apr 2022 21:13:58 +0000 (21:13 +0000)
Loop can handle any size of request. Limiting it to 255 sectors just
burns the CPU for bio split and request merge for underlayer disk and
also cause bad fs block allocation in directio mode.

Bug: 117823094
Change-Id: Ic4957181433c5a0d15f4cfdbf69dc5558d6dc5bd
Reviewed-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 54bb0ade6627a183c211345761ec46e4bf0048fe)
Signed-off-by: Martijn Coenen <maco@android.com>
drivers/block/loop.c

index 81cdad14df7920c258062a444bd6f594a9d4f195..369ca34f46d74be3cb36613df27d00a3a4022080 100644 (file)
@@ -1800,6 +1800,7 @@ static int loop_add(struct loop_device **l, int i)
        }
        lo->lo_queue->queuedata = lo;
 
+       blk_queue_max_hw_sectors(lo->lo_queue, BLK_DEF_MAX_SECTORS);
        /*
         * It doesn't make sense to enable merge because the I/O
         * submitted to backing file is handled page by page.