[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176169813858.1427432.2448355121308876367.stgit@frogsfrogsfrogs>
Date: Tue, 28 Oct 2025 18:03:59 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: djwong@...nel.org, bschubert@....com
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
bernd@...ernd.com, miklos@...redi.hu, joannelkoong@...il.com, neal@...pa.dev
Subject: [PATCH 18/22] libfuse: add atomic write support
From: Darrick J. Wong <djwong@...nel.org>
Add the single flag that we need to turn on atomic write support in
fuse.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
include/fuse_common.h | 4 ++++
include/fuse_kernel.h | 3 +++
lib/fuse_lowlevel.c | 2 ++
3 files changed, 9 insertions(+)
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 59b79b44a36e8d..eb08320bc8863f 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -540,6 +540,8 @@ struct fuse_loop_config_v1 {
* FUSE_IOMAP_SUPPORT_FILEIO: basic file I/O functionality through iomap
*/
#define FUSE_IOMAP_SUPPORT_FILEIO (1ULL << 0)
+/* untorn writes through iomap */
+#define FUSE_IOMAP_SUPPORT_ATOMIC (1ULL << 1)
/**
* Connection information, passed to the ->init() method
@@ -1232,6 +1234,8 @@ static inline bool fuse_iomap_need_write_allocate(unsigned int opflags,
#define FUSE_IFLAG_DAX (1U << 0)
/* use iomap for this inode */
#define FUSE_IFLAG_IOMAP (1U << 1)
+/* enable untorn writes */
+#define FUSE_IFLAG_ATOMIC (1U << 2)
/* Which fields are set in fuse_iomap_config_out? */
#define FUSE_IOMAP_CONFIG_SID (1 << 0ULL)
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index d1143e0c122b9c..5b9259714a628d 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -245,6 +245,7 @@
* - add FUSE_ATTR_IOMAP to enable iomap for specific inodes
* - add FUSE_IOMAP_CONFIG so the fuse server can configure more fs geometry
* - add FUSE_NOTIFY_IOMAP_DEV_INVAL to invalidate iomap bdev ranges
+ * - add FUSE_ATTR_ATOMIC for single-fsblock atomic write support
*/
#ifndef _LINUX_FUSE_H
@@ -586,10 +587,12 @@ struct fuse_file_lock {
* FUSE_ATTR_SUBMOUNT: Object is a submount root
* FUSE_ATTR_DAX: Enable DAX for this file in per inode DAX mode
* FUSE_ATTR_IOMAP: Use iomap for this inode
+ * FUSE_ATTR_ATOMIC: Enable untorn writes
*/
#define FUSE_ATTR_SUBMOUNT (1 << 0)
#define FUSE_ATTR_DAX (1 << 1)
#define FUSE_ATTR_IOMAP (1 << 2)
+#define FUSE_ATTR_ATOMIC (1 << 3)
/**
* Open flags
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index db202b59a2f0e6..605848bb4cd55b 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -127,6 +127,8 @@ static void convert_stat(const struct stat *stbuf, struct fuse_attr *attr,
attr->flags |= FUSE_ATTR_DAX;
if (iflags & FUSE_IFLAG_IOMAP)
attr->flags |= FUSE_ATTR_IOMAP;
+ if (iflags & FUSE_IFLAG_ATOMIC)
+ attr->flags |= FUSE_ATTR_ATOMIC;
}
static void convert_attr(const struct fuse_setattr_in *attr, struct stat *stbuf)
Powered by blists - more mailing lists