Skip to content

Commit d81dcc0

Browse files
Christoph Hellwigsmb49
authored andcommitted
loop: check in LO_FLAGS_DIRECT_IO in loop_default_blocksize
BugLink: https://bugs.launchpad.net/bugs/2115678 [ Upstream commit f6f9e32fe1e454ae8ac0190b2c2bd6074914beec ] We can't go below the minimum direct I/O size no matter if direct I/O is enabled by passing in an O_DIRECT file descriptor or due to the explicit flag. Now that LO_FLAGS_DIRECT_IO is set earlier after assigning a backing file, loop_default_blocksize can check it instead of the O_DIRECT flag to handle both conditions. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent d92f041 commit d81dcc0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/block/loop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static unsigned int loop_default_blocksize(struct loop_device *lo,
920920
struct block_device *backing_bdev)
921921
{
922922
/* In case of direct I/O, match underlying block size */
923-
if ((lo->lo_backing_file->f_flags & O_DIRECT) && backing_bdev)
923+
if ((lo->lo_flags & LO_FLAGS_DIRECT_IO) && backing_bdev)
924924
return bdev_logical_block_size(backing_bdev);
925925
return SECTOR_SIZE;
926926
}

0 commit comments

Comments
 (0)