Thread (28 messages) 28 messages, 5 authors, 2020-03-25
STALE2302d
Revisions (6)
  1. v1 [diff vs current]
  2. v2 current
  3. v6 [diff vs current]
  4. v7 [diff vs current]
  5. v8 [diff vs current]
  6. v9 [diff vs current]

[PATCH v2 11/11] zonefs: use zone-append for sequential zones

From: Johannes Thumshirn <hidden>
Date: 2020-03-24 15:25:25
Also in: linux-fsdevel, linux-scsi
Subsystem: filesystems (vfs and infrastructure), the rest, zonefs filesystem · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds, Damien Le Moal, Naohiro Aota

Signed-off-by: Johannes Thumshirn <redacted>
---
 fs/zonefs/super.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index 69aee3dfb660..d08d715c99de 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -628,12 +628,17 @@ static ssize_t zonefs_file_dio_write(struct kiocb *iocb, struct iov_iter *from)
 		goto inode_unlock;
 	}
 
-	/* Enforce sequential writes (append only) in sequential zones */
 	mutex_lock(&zi->i_truncate_mutex);
-	if (zi->i_ztype == ZONEFS_ZTYPE_SEQ && iocb->ki_pos != zi->i_wpoffset) {
-		mutex_unlock(&zi->i_truncate_mutex);
-		ret = -EINVAL;
-		goto inode_unlock;
+	if (zi->i_ztype == ZONEFS_ZTYPE_SEQ) {
+		/* Enforce sequential writes (append only) */
+		if (iocb->ki_pos != zi->i_wpoffset) {
+			mutex_unlock(&zi->i_truncate_mutex);
+			ret = -EINVAL;
+			goto inode_unlock;
+		}
+		/* Use zone append for sync write */
+		if (is_sync_kiocb(iocb))
+			iocb->ki_flags |= IOCB_ZONE_APPEND;
 	}
 	mutex_unlock(&zi->i_truncate_mutex);
 
-- 
2.24.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help