block/loop: set hw_sectors
authorShaohua Li <shli@fb.com>
Fri, 1 Sep 2017 05:09:45 +0000 (22:09 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 1 Sep 2017 14:44:32 +0000 (08:44 -0600)
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.

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>
drivers/block/loop.c

index f6c204f62b1e36c5d22e43d255553712f67f8d72..9eff4d3ab1f3dfb5a98e25c996fab4b6a2748d51 100644 (file)
@@ -1736,6 +1736,7 @@ static int loop_add(struct loop_device **l, int i)
 
        blk_queue_physical_block_size(lo->lo_queue, PAGE_SIZE);
 
+       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.