Skip to content

Commit f6f9e32

Browse files
Christoph Hellwigaxboe
authored andcommitted
loop: check in LO_FLAGS_DIRECT_IO in loop_default_blocksize
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]>
1 parent 984c2ab commit f6f9e32

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
@@ -980,7 +980,7 @@ static unsigned int loop_default_blocksize(struct loop_device *lo,
980980
struct block_device *backing_bdev)
981981
{
982982
/* In case of direct I/O, match underlying block size */
983-
if ((lo->lo_backing_file->f_flags & O_DIRECT) && backing_bdev)
983+
if ((lo->lo_flags & LO_FLAGS_DIRECT_IO) && backing_bdev)
984984
return bdev_logical_block_size(backing_bdev);
985985
return SECTOR_SIZE;
986986
}

0 commit comments

Comments
 (0)