Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

loop: allow loop_set_status to re-enable direct I/O

Unlike all other calls of (__)loop_update_dio, loop_set_status never
looks at the O_DIRECT flag of the backing file, and thus doesn't
re-enable direct I/O on an O_DIRECT backing file if e.g. the new block
size would allow it. Fix that and remove the need for the separate
__loop_update_dio flag.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250110073750.1582447-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
3a693110 dc909525

+3 -8
+3 -8
drivers/block/loop.c
··· 196 196 return true; 197 197 } 198 198 199 - static void __loop_update_dio(struct loop_device *lo, bool dio) 199 + static inline void loop_update_dio(struct loop_device *lo) 200 200 { 201 + bool dio = lo->use_dio || (lo->lo_backing_file->f_flags & O_DIRECT); 201 202 bool use_dio = dio && lo_can_use_dio(lo); 202 203 203 204 if (lo->use_dio == use_dio) ··· 530 529 WARN_ON_ONCE(1); 531 530 return -EIO; 532 531 } 533 - } 534 - 535 - static inline void loop_update_dio(struct loop_device *lo) 536 - { 537 - __loop_update_dio(lo, (lo->lo_backing_file->f_flags & O_DIRECT) | 538 - lo->use_dio); 539 532 } 540 533 541 534 static void loop_reread_partitions(struct loop_device *lo) ··· 1296 1301 } 1297 1302 1298 1303 /* update the direct I/O flag if lo_offset changed */ 1299 - __loop_update_dio(lo, lo->use_dio); 1304 + loop_update_dio(lo); 1300 1305 1301 1306 out_unfreeze: 1302 1307 blk_mq_unfreeze_queue(lo->lo_queue);