We have supported to fallback to buffered IO in case dio failure. Also in reality, most of or quite a lot of IOs(such as FS IO) are actually aligned, even though loop's logical block size isn't matched with backing queue's. So enable direct io at default. Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- drivers/block/loop.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index e42c0e3601ac..df057dca7512 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -2285,13 +2285,8 @@ static int loop_add(int i) blk_queue_max_hw_sectors(lo->lo_queue, BLK_DEF_MAX_SECTORS); - /* - * 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); + /* use backing dio at default */ + lo->lo_flags |= LO_FLAGS_DIRECT_IO; /* * Disable partition scanning by default. The in-kernel partition -- 2.31.1