Skip to contentSkip to conversation

f2fs: allow direct read for zoned device

PATCH In review Jaegeuk Kim 2 participants 2 messages Sep 30, 2022 – Oct 5, 2022

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: allow direct read for zoned device

This reverts dbf8e63f48af ("f2fs: remove device type check for direct IO"), and apply the below first version, since it contributed out-of-order DIO writes.

For zoned devices, f2fs forbids direct IO and forces buffered IO to serialize write IOs. However, the constraint does not apply to read IOs.

Fixes dbf8e63f48af ("f2fs: remove device type check for direct IO")
---
 fs/f2fs/f2fs.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +6 -1
index 2ed00111a399..a0b2c8626a75 100644
@@ -4535,7 +4535,12 @@ static inline bool f2fs_force_buffered_io(struct inode *inode,
 	/* disallow direct IO if any of devices has unaligned blksize */
 	if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize)
 		return true;
-
+	/*
+	 * for blkzoned device, fallback direct IO to buffered IO, so
+	 * all IOs can be serialized by log-structured write.
+	 */
+	if (f2fs_sb_has_blkzoned(sbi) && (rw == WRITE))
+		return true;
 	if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
 		if (block_unaligned_IO(inode, iocb, iter))
 			return true;
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jaegeuk Kim

This reverts dbf8e63f48af ("f2fs: remove device type check for direct IO"), and apply the below first version, since it contributed out-of-order DIO writes.

For zoned devices, f2fs forbids direct IO and forces buffered IO to serialize write IOs. However, the constraint does not apply to read IOs.

Fixes dbf8e63f48af ("f2fs: remove device type check for direct IO")

Thanks,