From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, miklos@szeredi.hu
Cc: joannelkoong@gmail.com, bernd@bsbernd.com, neal@gompa.dev,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 14/31] fuse: implement buffered IO with iomap
Date: Tue, 28 Oct 2025 17:48:36 -0700 [thread overview]
Message-ID: <176169810656.1424854.15239592653019383193.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <176169810144.1424854.11439355400009006946.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
Implement pagecache IO with iomap, complete with hooks into truncate and
fallocate so that the fuse server needn't implement disk block zeroing
of post-EOF and unaligned punch/zero regions.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fs/fuse/fuse_i.h | 30 ++
include/uapi/linux/fuse.h | 5
fs/fuse/dir.c | 23 ++
fs/fuse/file.c | 86 +++++-
fs/fuse/file_iomap.c | 655 ++++++++++++++++++++++++++++++++++++++++++++-
5 files changed, 775 insertions(+), 24 deletions(-)
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 9c36b9ab0688f6..5451b0a2b3dc19 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -181,6 +181,13 @@ struct fuse_inode {
/* waitq for direct-io completion */
wait_queue_head_t direct_io_waitq;
+
+#ifdef CONFIG_FUSE_IOMAP
+ /* pending io completions */
+ spinlock_t ioend_lock;
+ struct work_struct ioend_work;
+ struct list_head ioend_list;
+#endif
};
/* readdir cache (directory only) */
@@ -1722,6 +1729,8 @@ void fuse_iomap_sysfs_cleanup(struct kobject *kobj);
# define fuse_iomap_sysfs_cleanup(...) ((void)0)
#endif
+sector_t fuse_bmap(struct address_space *mapping, sector_t block);
+
#if IS_ENABLED(CONFIG_FUSE_IOMAP)
bool fuse_iomap_enabled(void);
@@ -1761,6 +1770,20 @@ static inline bool fuse_want_iomap_directio(const struct kiocb *iocb)
ssize_t fuse_iomap_direct_read(struct kiocb *iocb, struct iov_iter *to);
ssize_t fuse_iomap_direct_write(struct kiocb *iocb, struct iov_iter *from);
+
+static inline bool fuse_want_iomap_buffered_io(const struct kiocb *iocb)
+{
+ return fuse_inode_has_iomap(file_inode(iocb->ki_filp));
+}
+
+int fuse_iomap_mmap(struct file *file, struct vm_area_struct *vma);
+ssize_t fuse_iomap_buffered_read(struct kiocb *iocb, struct iov_iter *to);
+ssize_t fuse_iomap_buffered_write(struct kiocb *iocb, struct iov_iter *from);
+int fuse_iomap_setsize_start(struct inode *inode, loff_t newsize);
+int fuse_iomap_fallocate(struct file *file, int mode, loff_t offset,
+ loff_t length, loff_t new_size);
+int fuse_iomap_flush_unmap_range(struct inode *inode, loff_t pos,
+ loff_t endpos);
#else
# define fuse_iomap_enabled(...) (false)
# define fuse_has_iomap(...) (false)
@@ -1777,6 +1800,13 @@ ssize_t fuse_iomap_direct_write(struct kiocb *iocb, struct iov_iter *from);
# define fuse_want_iomap_directio(...) (false)
# define fuse_iomap_direct_read(...) (-ENOSYS)
# define fuse_iomap_direct_write(...) (-ENOSYS)
+# define fuse_want_iomap_buffered_io(...) (false)
+# define fuse_iomap_mmap(...) (-ENOSYS)
+# define fuse_iomap_buffered_read(...) (-ENOSYS)
+# define fuse_iomap_buffered_write(...) (-ENOSYS)
+# define fuse_iomap_setsize_start(...) (-ENOSYS)
+# define fuse_iomap_fallocate(...) (-ENOSYS)
+# define fuse_iomap_flush_unmap_range(...) (-ENOSYS)
#endif
#endif /* _FS_FUSE_I_H */
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index be0e95924a24af..e02c474ed04bc2 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -1368,6 +1368,9 @@ struct fuse_uring_cmd_req {
#define FUSE_IOMAP_OP_ATOMIC (1U << 9)
#define FUSE_IOMAP_OP_DONTCACHE (1U << 10)
+/* pagecache writeback operation */
+#define FUSE_IOMAP_OP_WRITEBACK (1U << 31)
+
#define FUSE_IOMAP_NULL_ADDR (-1ULL) /* addr is not valid */
struct fuse_iomap_io {
@@ -1417,6 +1420,8 @@ struct fuse_iomap_end_in {
#define FUSE_IOMAP_IOEND_DIRECT (1U << 3)
/* is append ioend */
#define FUSE_IOMAP_IOEND_APPEND (1U << 4)
+/* is pagecache writeback */
+#define FUSE_IOMAP_IOEND_WRITEBACK (1U << 5)
struct fuse_iomap_ioend_in {
uint32_t ioendflags; /* FUSE_IOMAP_IOEND_* */
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 171f38ba734d16..5e7e7d4c2c5085 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -2020,7 +2020,10 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
is_truncate = true;
}
- if (FUSE_IS_DAX(inode) && is_truncate) {
+ if (is_iomap && is_truncate) {
+ filemap_invalidate_lock(mapping);
+ fault_blocked = true;
+ } else if (FUSE_IS_DAX(inode) && is_truncate) {
filemap_invalidate_lock(mapping);
fault_blocked = true;
err = fuse_dax_break_layouts(inode, 0, -1);
@@ -2035,6 +2038,18 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
WARN_ON(!(attr->ia_valid & ATTR_SIZE));
WARN_ON(attr->ia_size != 0);
if (fc->atomic_o_trunc) {
+ if (is_iomap) {
+ /*
+ * fuse_open already set the size to zero and
+ * truncated the pagecache, and we've since
+ * cycled the inode locks. Another thread
+ * could have performed an appending write, so
+ * we don't want to touch the file further.
+ */
+ filemap_invalidate_unlock(mapping);
+ return 0;
+ }
+
/*
* No need to send request to userspace, since actual
* truncation has already been done by OPEN. But still
@@ -2068,6 +2083,12 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
if (trust_local_cmtime && attr->ia_size != inode->i_size)
attr->ia_valid |= ATTR_MTIME | ATTR_CTIME;
+
+ if (is_iomap) {
+ err = fuse_iomap_setsize_start(inode, attr->ia_size);
+ if (err)
+ goto error;
+ }
}
memset(&inarg, 0, sizeof(inarg));
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 43007cea550ae7..adcd9e3bd6a4d9 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -384,7 +384,7 @@ static int fuse_release(struct inode *inode, struct file *file)
* Dirty pages might remain despite write_inode_now() call from
* fuse_flush() due to writes racing with the close.
*/
- if (fc->writeback_cache)
+ if (fc->writeback_cache || fuse_inode_has_iomap(inode))
write_inode_now(inode, 1);
fuse_release_common(file, false);
@@ -1765,6 +1765,9 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
return ret;
}
+ if (fuse_want_iomap_buffered_io(iocb))
+ return fuse_iomap_buffered_read(iocb, to);
+
if (FUSE_IS_DAX(inode))
return fuse_dax_read_iter(iocb, to);
@@ -1788,10 +1791,29 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
if (fuse_want_iomap_directio(iocb)) {
ssize_t ret = fuse_iomap_direct_write(iocb, from);
- if (ret != -ENOSYS)
+ switch (ret) {
+ case -ENOTBLK:
+ /*
+ * If we're going to fall back to the iomap buffered
+ * write path only, then try the write again as a
+ * synchronous buffered write. Otherwise we let it
+ * drop through to the old ->direct_IO path.
+ */
+ if (fuse_want_iomap_buffered_io(iocb))
+ iocb->ki_flags |= IOCB_SYNC;
+ fallthrough;
+ case -ENOSYS:
+ /* no implementation, fall through */
+ break;
+ default:
+ /* errors, no progress, or even partial progress */
return ret;
+ }
}
+ if (fuse_want_iomap_buffered_io(iocb))
+ return fuse_iomap_buffered_write(iocb, from);
+
if (FUSE_IS_DAX(inode))
return fuse_dax_write_iter(iocb, from);
@@ -2321,6 +2343,9 @@ static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
struct inode *inode = file_inode(file);
int rc;
+ if (fuse_inode_has_iomap(inode))
+ return fuse_iomap_mmap(file, vma);
+
/* DAX mmap is superior to direct_io mmap */
if (FUSE_IS_DAX(inode))
return fuse_dax_mmap(file, vma);
@@ -2519,7 +2544,7 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
return err;
}
-static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
+sector_t fuse_bmap(struct address_space *mapping, sector_t block)
{
struct inode *inode = mapping->host;
struct fuse_mount *fm = get_fuse_mount(inode);
@@ -2873,8 +2898,12 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t end)
{
- int err = filemap_write_and_wait_range(inode->i_mapping, start, LLONG_MAX);
+ int err;
+ if (fuse_inode_has_iomap(inode))
+ return fuse_iomap_flush_unmap_range(inode, start, end);
+
+ err = filemap_write_and_wait_range(inode->i_mapping, start, LLONG_MAX);
if (!err)
fuse_sync_writes(inode);
@@ -2895,7 +2924,9 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
.length = length,
.mode = mode
};
+ loff_t newsize = 0;
int err;
+ const bool is_iomap = fuse_inode_has_iomap(inode);
bool block_faults = FUSE_IS_DAX(inode) &&
(!(mode & FALLOC_FL_KEEP_SIZE) ||
(mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE)));
@@ -2908,7 +2939,10 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
return -EOPNOTSUPP;
inode_lock(inode);
- if (block_faults) {
+ if (is_iomap) {
+ filemap_invalidate_lock(inode->i_mapping);
+ block_faults = true;
+ } else if (block_faults) {
filemap_invalidate_lock(inode->i_mapping);
err = fuse_dax_break_layouts(inode, 0, -1);
if (err)
@@ -2923,11 +2957,23 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
goto out;
}
+ /*
+ * If we are using iomap for file IO, fallocate must wait for all AIO
+ * to complete before we continue as AIO can change the file size on
+ * completion without holding any locks we currently hold. We must do
+ * this first because AIO can update the in-memory inode size, and the
+ * operations that follow require the in-memory size to be fully
+ * up-to-date.
+ */
+ if (is_iomap)
+ inode_dio_wait(inode);
+
if (!(mode & FALLOC_FL_KEEP_SIZE) &&
offset + length > i_size_read(inode)) {
err = inode_newsize_ok(inode, offset + length);
if (err)
goto out;
+ newsize = offset + length;
}
err = file_modified(file);
@@ -2950,14 +2996,22 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
if (err)
goto out;
- /* we could have extended the file */
- if (!(mode & FALLOC_FL_KEEP_SIZE)) {
- if (fuse_write_update_attr(inode, offset + length, length))
- file_update_time(file);
- }
+ if (is_iomap) {
+ err = fuse_iomap_fallocate(file, mode, offset, length,
+ newsize);
+ if (err)
+ goto out;
+ } else {
+ /* we could have extended the file */
+ if (!(mode & FALLOC_FL_KEEP_SIZE)) {
+ if (fuse_write_update_attr(inode, newsize, length))
+ file_update_time(file);
+ }
- if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE))
- truncate_pagecache_range(inode, offset, offset + length - 1);
+ if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE))
+ truncate_pagecache_range(inode, offset,
+ offset + length - 1);
+ }
fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
@@ -3002,6 +3056,7 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
ssize_t err;
/* mark unstable when write-back is not used, and file_out gets
* extended */
+ const bool is_iomap = fuse_inode_has_iomap(inode_out);
bool is_unstable = (!fc->writeback_cache) &&
((pos_out + len) > inode_out->i_size);
@@ -3045,6 +3100,10 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
if (err)
goto out;
+ /* See inode_dio_wait comment in fuse_file_fallocate */
+ if (is_iomap)
+ inode_dio_wait(inode_out);
+
if (is_unstable)
set_bit(FUSE_I_SIZE_UNSTABLE, &fi_out->state);
@@ -3085,7 +3144,8 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
goto out;
}
- truncate_inode_pages_range(inode_out->i_mapping,
+ if (!is_iomap)
+ truncate_inode_pages_range(inode_out->i_mapping,
ALIGN_DOWN(pos_out, PAGE_SIZE),
ALIGN(pos_out + bytes_copied, PAGE_SIZE) - 1);
diff --git a/fs/fuse/file_iomap.c b/fs/fuse/file_iomap.c
index 094a07dd0ddfc9..fd283b98d5e800 100644
--- a/fs/fuse/file_iomap.c
+++ b/fs/fuse/file_iomap.c
@@ -5,6 +5,8 @@
*/
#include <linux/iomap.h>
#include <linux/fiemap.h>
+#include <linux/pagemap.h>
+#include <linux/falloc.h>
#include "fuse_i.h"
#include "fuse_trace.h"
#include "iomap_i.h"
@@ -241,7 +243,7 @@ static inline uint16_t fuse_iomap_flags_from_server(uint16_t fuse_f_flags)
ret |= FUSE_IOMAP_OP_##word
static inline uint32_t fuse_iomap_op_to_server(unsigned iomap_op_flags)
{
- uint32_t ret = 0;
+ uint32_t ret = iomap_op_flags & FUSE_IOMAP_OP_WRITEBACK;
XMAP(WRITE);
XMAP(ZERO);
@@ -389,7 +391,8 @@ fuse_iomap_begin_validate(const struct inode *inode,
static inline bool fuse_is_iomap_file_write(unsigned int opflags)
{
- return opflags & (IOMAP_WRITE | IOMAP_ZERO | IOMAP_UNSHARE);
+ return opflags & (IOMAP_WRITE | IOMAP_ZERO | IOMAP_UNSHARE |
+ FUSE_IOMAP_OP_WRITEBACK);
}
static inline struct fuse_backing *
@@ -738,12 +741,7 @@ void fuse_iomap_unmount(struct fuse_mount *fm)
fuse_send_destroy(fm);
}
-static inline void fuse_inode_set_iomap(struct inode *inode)
-{
- struct fuse_inode *fi = get_fuse_inode(inode);
-
- set_bit(FUSE_I_IOMAP, &fi->state);
-}
+static inline void fuse_inode_set_iomap(struct inode *inode);
static inline void fuse_inode_clear_iomap(struct inode *inode)
{
@@ -967,6 +965,110 @@ static const struct iomap_dio_ops fuse_iomap_dio_write_ops = {
.end_io = fuse_iomap_dio_write_end_io,
};
+static const struct iomap_write_ops fuse_iomap_write_ops = {
+};
+
+static int
+fuse_iomap_zero_range(
+ struct inode *inode,
+ loff_t pos,
+ loff_t len,
+ bool *did_zero)
+{
+ return iomap_zero_range(inode, pos, len, did_zero, &fuse_iomap_ops,
+ &fuse_iomap_write_ops, NULL);
+}
+
+/* Take care of zeroing post-EOF blocks when they might exist. */
+static ssize_t
+fuse_iomap_write_zero_eof(
+ struct kiocb *iocb,
+ struct iov_iter *from,
+ bool *drained_dio)
+{
+ struct inode *inode = file_inode(iocb->ki_filp);
+ struct fuse_inode *fi = get_fuse_inode(inode);
+ struct address_space *mapping = iocb->ki_filp->f_mapping;
+ loff_t isize;
+ int error;
+
+ /*
+ * We need to serialise against EOF updates that occur in IO
+ * completions here. We want to make sure that nobody is changing the
+ * size while we do this check until we have placed an IO barrier (i.e.
+ * hold i_rwsem exclusively) that prevents new IO from being
+ * dispatched. The spinlock effectively forms a memory barrier once we
+ * have i_rwsem exclusively so we are guaranteed to see the latest EOF
+ * value and hence be able to correctly determine if we need to run
+ * zeroing.
+ */
+ spin_lock(&fi->lock);
+ isize = i_size_read(inode);
+ if (iocb->ki_pos <= isize) {
+ spin_unlock(&fi->lock);
+ return 0;
+ }
+ spin_unlock(&fi->lock);
+
+ if (iocb->ki_flags & IOCB_NOWAIT)
+ return -EAGAIN;
+
+ if (!(*drained_dio)) {
+ /*
+ * We now have an IO submission barrier in place, but AIO can
+ * do EOF updates during IO completion and hence we now need to
+ * wait for all of them to drain. Non-AIO DIO will have
+ * drained before we are given the exclusive i_rwsem, and so
+ * for most cases this wait is a no-op.
+ */
+ inode_dio_wait(inode);
+ *drained_dio = true;
+ return 1;
+ }
+
+ filemap_invalidate_lock(mapping);
+ error = fuse_iomap_zero_range(inode, isize, iocb->ki_pos - isize, NULL);
+ filemap_invalidate_unlock(mapping);
+
+ return error;
+}
+
+static ssize_t
+fuse_iomap_write_checks(
+ struct kiocb *iocb,
+ struct iov_iter *from)
+{
+ struct inode *inode = iocb->ki_filp->f_mapping->host;
+ ssize_t error;
+ bool drained_dio = false;
+
+restart:
+ error = generic_write_checks(iocb, from);
+ if (error <= 0)
+ return error;
+
+ /*
+ * If the offset is beyond the size of the file, we need to zero all
+ * blocks that fall between the existing EOF and the start of this
+ * write.
+ *
+ * We can do an unlocked check for i_size here safely as I/O completion
+ * can only extend EOF. Truncate is locked out at this point, so the
+ * EOF cannot move backwards, only forwards. Hence we only need to take
+ * the slow path when we are at or beyond the current EOF.
+ */
+ if (fuse_inode_has_iomap(inode) &&
+ iocb->ki_pos > i_size_read(inode)) {
+ error = fuse_iomap_write_zero_eof(iocb, from, &drained_dio);
+ if (error == 1)
+ goto restart;
+ if (error)
+ return error;
+ }
+
+ return kiocb_modified(iocb);
+}
+
ssize_t fuse_iomap_direct_write(struct kiocb *iocb, struct iov_iter *from)
{
struct inode *inode = file_inode(iocb->ki_filp);
@@ -994,8 +1096,9 @@ ssize_t fuse_iomap_direct_write(struct kiocb *iocb, struct iov_iter *from)
ret = fuse_iomap_ilock_iocb(iocb, EXCL);
if (ret)
goto out_dsync;
- ret = generic_write_checks(iocb, from);
- if (ret <= 0)
+
+ ret = fuse_iomap_write_checks(iocb, from);
+ if (ret)
goto out_unlock;
/*
@@ -1018,3 +1121,535 @@ ssize_t fuse_iomap_direct_write(struct kiocb *iocb, struct iov_iter *from)
trace_fuse_iomap_direct_write_end(iocb, from, ret);
return ret;
}
+
+struct fuse_writepage_ctx {
+ struct iomap_writepage_ctx ctx;
+};
+
+static void fuse_iomap_end_ioend(struct iomap_ioend *ioend)
+{
+ struct inode *inode = ioend->io_inode;
+ unsigned int ioendflags = FUSE_IOMAP_IOEND_WRITEBACK;
+ unsigned int nofs_flag;
+ int error = blk_status_to_errno(ioend->io_bio.bi_status);
+
+ ASSERT(fuse_inode_has_iomap(inode));
+
+ if (fuse_is_bad(inode))
+ return;
+
+ if (ioend->io_flags & IOMAP_IOEND_SHARED)
+ ioendflags |= FUSE_IOMAP_IOEND_SHARED;
+ if (ioend->io_flags & IOMAP_IOEND_UNWRITTEN)
+ ioendflags |= FUSE_IOMAP_IOEND_UNWRITTEN;
+
+ /*
+ * We can allocate memory here while doing writeback on behalf of
+ * memory reclaim. To avoid memory allocation deadlocks set the
+ * task-wide nofs context for the following operations.
+ */
+ nofs_flag = memalloc_nofs_save();
+ fuse_iomap_ioend(inode, ioend->io_offset, ioend->io_size, error,
+ ioendflags, ioend->io_sector);
+ iomap_finish_ioends(ioend, error);
+ memalloc_nofs_restore(nofs_flag);
+}
+
+/*
+ * Finish all pending IO completions that require transactional modifications.
+ *
+ * We try to merge physical and logically contiguous ioends before completion to
+ * minimise the number of transactions we need to perform during IO completion.
+ * Both unwritten extent conversion and COW remapping need to iterate and modify
+ * one physical extent at a time, so we gain nothing by merging physically
+ * discontiguous extents here.
+ *
+ * The ioend chain length that we can be processing here is largely unbound in
+ * length and we may have to perform significant amounts of work on each ioend
+ * to complete it. Hence we have to be careful about holding the CPU for too
+ * long in this loop.
+ */
+static void fuse_iomap_end_io(struct work_struct *work)
+{
+ struct fuse_inode *fi =
+ container_of(work, struct fuse_inode, ioend_work);
+ struct iomap_ioend *ioend;
+ struct list_head tmp;
+ unsigned long flags;
+
+ spin_lock_irqsave(&fi->ioend_lock, flags);
+ list_replace_init(&fi->ioend_list, &tmp);
+ spin_unlock_irqrestore(&fi->ioend_lock, flags);
+
+ iomap_sort_ioends(&tmp);
+ while ((ioend = list_first_entry_or_null(&tmp, struct iomap_ioend,
+ io_list))) {
+ list_del_init(&ioend->io_list);
+ iomap_ioend_try_merge(ioend, &tmp);
+ fuse_iomap_end_ioend(ioend);
+ cond_resched();
+ }
+}
+
+static void fuse_iomap_end_bio(struct bio *bio)
+{
+ struct iomap_ioend *ioend = iomap_ioend_from_bio(bio);
+ struct inode *inode = ioend->io_inode;
+ struct fuse_inode *fi = get_fuse_inode(inode);
+ unsigned long flags;
+
+ ASSERT(fuse_inode_has_iomap(inode));
+
+ spin_lock_irqsave(&fi->ioend_lock, flags);
+ if (list_empty(&fi->ioend_list))
+ WARN_ON_ONCE(!queue_work(system_unbound_wq, &fi->ioend_work));
+ list_add_tail(&ioend->io_list, &fi->ioend_list);
+ spin_unlock_irqrestore(&fi->ioend_lock, flags);
+}
+
+/*
+ * Fast revalidation of the cached writeback mapping. Return true if the current
+ * mapping is valid, false otherwise.
+ */
+static bool fuse_iomap_revalidate_writeback(struct iomap_writepage_ctx *wpc,
+ loff_t offset)
+{
+ if (offset < wpc->iomap.offset ||
+ offset >= wpc->iomap.offset + wpc->iomap.length)
+ return false;
+
+ /* XXX actually use revalidation cookie */
+ return true;
+}
+
+/*
+ * If the folio has delalloc blocks on it, the caller is asking us to punch them
+ * out. If we don't, we can leave a stale delalloc mapping covered by a clean
+ * page that needs to be dirtied again before the delalloc mapping can be
+ * converted. This stale delalloc mapping can trip up a later direct I/O read
+ * operation on the same region.
+ *
+ * We prevent this by truncating away the delalloc regions on the folio. Because
+ * they are delalloc, we can do this without needing a transaction. Indeed - if
+ * we get ENOSPC errors, we have to be able to do this truncation without a
+ * transaction as there is no space left for block reservation (typically why
+ * we see a ENOSPC in writeback).
+ */
+static void fuse_iomap_discard_folio(struct folio *folio, loff_t pos, int error)
+{
+ struct inode *inode = folio->mapping->host;
+ struct fuse_inode *fi = get_fuse_inode(inode);
+ loff_t end = folio_pos(folio) + folio_size(folio);
+
+ if (fuse_is_bad(inode))
+ return;
+
+ ASSERT(fuse_inode_has_iomap(inode));
+
+ printk_ratelimited(KERN_ERR
+ "page discard on page %px, inode 0x%llx, pos %llu.",
+ folio, fi->orig_ino, pos);
+
+ /* Userspace may need to remove delayed allocations */
+ fuse_iomap_ioend(inode, pos, end - pos, error, 0, FUSE_IOMAP_NULL_ADDR);
+}
+
+static ssize_t fuse_iomap_writeback_range(struct iomap_writepage_ctx *wpc,
+ struct folio *folio, u64 offset,
+ unsigned int len, u64 end_pos)
+{
+ struct inode *inode = wpc->inode;
+ struct iomap write_iomap, dontcare;
+ ssize_t ret;
+
+ if (fuse_is_bad(inode)) {
+ ret = -EIO;
+ goto discard_folio;
+ }
+
+ ASSERT(fuse_inode_has_iomap(inode));
+
+ if (!fuse_iomap_revalidate_writeback(wpc, offset)) {
+ ret = fuse_iomap_begin(inode, offset, len,
+ FUSE_IOMAP_OP_WRITEBACK,
+ &write_iomap, &dontcare);
+ if (ret)
+ goto discard_folio;
+
+ /*
+ * Landed in a hole or beyond EOF? Send that to iomap, it'll
+ * skip writing back the file range.
+ */
+ if (write_iomap.offset > offset) {
+ write_iomap.length = write_iomap.offset - offset;
+ write_iomap.offset = offset;
+ write_iomap.type = IOMAP_HOLE;
+ }
+
+ memcpy(&wpc->iomap, &write_iomap, sizeof(struct iomap));
+ }
+
+ ret = iomap_add_to_ioend(wpc, folio, offset, end_pos, len);
+ if (ret < 0)
+ goto discard_folio;
+
+ return ret;
+discard_folio:
+ fuse_iomap_discard_folio(folio, offset, ret);
+ return ret;
+}
+
+static int fuse_iomap_writeback_submit(struct iomap_writepage_ctx *wpc,
+ int error)
+{
+ struct iomap_ioend *ioend = wpc->wb_ctx;
+
+ ASSERT(fuse_inode_has_iomap(ioend->io_inode));
+
+ /* always call our ioend function, even if we cancel the bio */
+ ioend->io_bio.bi_end_io = fuse_iomap_end_bio;
+ return iomap_ioend_writeback_submit(wpc, error);
+}
+
+static const struct iomap_writeback_ops fuse_iomap_writeback_ops = {
+ .writeback_range = fuse_iomap_writeback_range,
+ .writeback_submit = fuse_iomap_writeback_submit,
+};
+
+static int fuse_iomap_writepages(struct address_space *mapping,
+ struct writeback_control *wbc)
+{
+ struct fuse_writepage_ctx wpc = {
+ .ctx = {
+ .inode = mapping->host,
+ .wbc = wbc,
+ .ops = &fuse_iomap_writeback_ops,
+ },
+ };
+
+ ASSERT(fuse_inode_has_iomap(mapping->host));
+
+ return iomap_writepages(&wpc.ctx);
+}
+
+static int fuse_iomap_read_folio(struct file *file, struct folio *folio)
+{
+ ASSERT(fuse_inode_has_iomap(file_inode(file)));
+
+ return iomap_read_folio(folio, &fuse_iomap_ops);
+}
+
+static void fuse_iomap_readahead(struct readahead_control *rac)
+{
+ ASSERT(fuse_inode_has_iomap(file_inode(rac->file)));
+
+ iomap_readahead(rac, &fuse_iomap_ops);
+}
+
+static const struct address_space_operations fuse_iomap_aops = {
+ .read_folio = fuse_iomap_read_folio,
+ .readahead = fuse_iomap_readahead,
+ .writepages = fuse_iomap_writepages,
+ .dirty_folio = iomap_dirty_folio,
+ .release_folio = iomap_release_folio,
+ .invalidate_folio = iomap_invalidate_folio,
+ .migrate_folio = filemap_migrate_folio,
+ .is_partially_uptodate = iomap_is_partially_uptodate,
+ .error_remove_folio = generic_error_remove_folio,
+
+ /* These aren't pagecache operations per se */
+ .bmap = fuse_bmap,
+};
+
+static inline void fuse_inode_set_iomap(struct inode *inode)
+{
+ struct fuse_inode *fi = get_fuse_inode(inode);
+
+ inode->i_data.a_ops = &fuse_iomap_aops;
+
+ INIT_WORK(&fi->ioend_work, fuse_iomap_end_io);
+ INIT_LIST_HEAD(&fi->ioend_list);
+ spin_lock_init(&fi->ioend_lock);
+ set_bit(FUSE_I_IOMAP, &fi->state);
+}
+
+/*
+ * Locking for serialisation of IO during page faults. This results in a lock
+ * ordering of:
+ *
+ * mmap_lock (MM)
+ * sb_start_pagefault(vfs, freeze)
+ * invalidate_lock (vfs - truncate serialisation)
+ * page_lock (MM)
+ * i_lock (FUSE - extent map serialisation)
+ */
+static vm_fault_t fuse_iomap_page_mkwrite(struct vm_fault *vmf)
+{
+ struct inode *inode = file_inode(vmf->vma->vm_file);
+ struct address_space *mapping = vmf->vma->vm_file->f_mapping;
+ vm_fault_t ret;
+
+ ASSERT(fuse_inode_has_iomap(inode));
+
+ sb_start_pagefault(inode->i_sb);
+ file_update_time(vmf->vma->vm_file);
+
+ filemap_invalidate_lock_shared(mapping);
+ ret = iomap_page_mkwrite(vmf, &fuse_iomap_ops, NULL);
+ filemap_invalidate_unlock_shared(mapping);
+
+ sb_end_pagefault(inode->i_sb);
+ return ret;
+}
+
+static const struct vm_operations_struct fuse_iomap_vm_ops = {
+ .fault = filemap_fault,
+ .map_pages = filemap_map_pages,
+ .page_mkwrite = fuse_iomap_page_mkwrite,
+};
+
+int fuse_iomap_mmap(struct file *file, struct vm_area_struct *vma)
+{
+ ASSERT(fuse_inode_has_iomap(file_inode(file)));
+
+ file_accessed(file);
+ vma->vm_ops = &fuse_iomap_vm_ops;
+ return 0;
+}
+
+ssize_t fuse_iomap_buffered_read(struct kiocb *iocb, struct iov_iter *to)
+{
+ struct inode *inode = file_inode(iocb->ki_filp);
+ ssize_t ret;
+
+ ASSERT(fuse_inode_has_iomap(inode));
+
+ if (!iov_iter_count(to))
+ return 0; /* skip atime */
+
+ file_accessed(iocb->ki_filp);
+
+ ret = fuse_iomap_ilock_iocb(iocb, SHARED);
+ if (ret)
+ return ret;
+ ret = generic_file_read_iter(iocb, to);
+ inode_unlock_shared(inode);
+
+ return ret;
+}
+
+ssize_t fuse_iomap_buffered_write(struct kiocb *iocb, struct iov_iter *from)
+{
+ struct inode *inode = file_inode(iocb->ki_filp);
+ struct fuse_inode *fi = get_fuse_inode(inode);
+ loff_t pos = iocb->ki_pos;
+ ssize_t ret;
+
+ ASSERT(fuse_inode_has_iomap(inode));
+
+ if (!iov_iter_count(from))
+ return 0;
+
+ ret = fuse_iomap_ilock_iocb(iocb, EXCL);
+ if (ret)
+ return ret;
+
+ ret = fuse_iomap_write_checks(iocb, from);
+ if (ret)
+ goto out_unlock;
+
+ if (inode->i_size < pos + iov_iter_count(from))
+ set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
+
+ ret = iomap_file_buffered_write(iocb, from, &fuse_iomap_ops,
+ &fuse_iomap_write_ops, NULL);
+
+ if (ret > 0)
+ fuse_write_update_attr(inode, pos + ret, ret);
+ clear_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
+
+out_unlock:
+ inode_unlock(inode);
+
+ if (ret > 0) {
+ /* Handle various SYNC-type writes */
+ ret = generic_write_sync(iocb, ret);
+ }
+ return ret;
+}
+
+static int
+fuse_iomap_truncate_page(
+ struct inode *inode,
+ loff_t pos,
+ bool *did_zero)
+{
+ return iomap_truncate_page(inode, pos, did_zero, &fuse_iomap_ops,
+ &fuse_iomap_write_ops, NULL);
+}
+/*
+ * Truncate pagecache for a file before sending the truncate request to
+ * userspace. Must have write permission and not be a directory.
+ *
+ * Caution: The caller of this function is responsible for calling
+ * setattr_prepare() or otherwise verifying the change is fine.
+ */
+int
+fuse_iomap_setsize_start(
+ struct inode *inode,
+ loff_t newsize)
+{
+ loff_t oldsize = i_size_read(inode);
+ int error;
+ bool did_zeroing = false;
+
+ rwsem_assert_held_write(&inode->i_rwsem);
+ rwsem_assert_held_write(&inode->i_mapping->invalidate_lock);
+ ASSERT(S_ISREG(inode->i_mode));
+
+ /*
+ * Wait for all direct I/O to complete.
+ */
+ inode_dio_wait(inode);
+
+ /*
+ * File data changes must be complete and flushed to disk before we
+ * call userspace to modify the inode.
+ *
+ * Start with zeroing any data beyond EOF that we may expose on file
+ * extension, or zeroing out the rest of the block on a downward
+ * truncate.
+ */
+ if (newsize > oldsize)
+ error = fuse_iomap_zero_range(inode, oldsize, newsize - oldsize,
+ &did_zeroing);
+ else
+ error = fuse_iomap_truncate_page(inode, newsize, &did_zeroing);
+ if (error)
+ return error;
+
+ /*
+ * We've already locked out new page faults, so now we can safely
+ * remove pages from the page cache knowing they won't get refaulted
+ * until we drop the mapping invalidation lock after the extent
+ * manipulations are complete. The truncate_setsize() call also cleans
+ * folios spanning EOF on extending truncates and hence ensures
+ * sub-page block size filesystems are correctly handled, too.
+ *
+ * And we update in-core i_size and truncate page cache beyond newsize
+ * before writing back the whole file, so we're guaranteed not to write
+ * stale data past the new EOF on truncate down.
+ */
+ truncate_setsize(inode, newsize);
+
+ /*
+ * Flush the entire pagecache to ensure the fuse server logs the inode
+ * size change and all dirty data that might be associated with it.
+ * We don't know the ondisk inode size, so we only have this clumsy
+ * hammer.
+ */
+ return filemap_write_and_wait(inode->i_mapping);
+}
+
+/*
+ * Prepare for a file data block remapping operation by flushing and unmapping
+ * all pagecache for the entire range.
+ */
+int fuse_iomap_flush_unmap_range(struct inode *inode, loff_t pos,
+ loff_t endpos)
+{
+ loff_t start, end;
+ unsigned int rounding;
+ int error;
+
+ /*
+ * Make sure we extend the flush out to extent alignment boundaries so
+ * any extent range overlapping the start/end of the modification we
+ * are about to do is clean and idle.
+ */
+ rounding = max_t(unsigned int, i_blocksize(inode), PAGE_SIZE);
+ start = round_down(pos, rounding);
+ end = round_up(endpos + 1, rounding) - 1;
+
+ error = filemap_write_and_wait_range(inode->i_mapping, start, end);
+ if (error)
+ return error;
+ truncate_pagecache_range(inode, start, end);
+ return 0;
+}
+
+static int fuse_iomap_punch_range(struct inode *inode, loff_t offset,
+ loff_t length)
+{
+ loff_t isize = i_size_read(inode);
+ int error;
+
+ /*
+ * Now that we've unmap all full blocks we'll have to zero out any
+ * partial block at the beginning and/or end. iomap_zero_range is
+ * smart enough to skip holes and unwritten extents, including those we
+ * just created, but we must take care not to zero beyond EOF, which
+ * would enlarge i_size.
+ */
+ if (offset >= isize)
+ return 0;
+ if (offset + length > isize)
+ length = isize - offset;
+ error = fuse_iomap_zero_range(inode, offset, length, NULL);
+ if (error)
+ return error;
+
+ /*
+ * If we zeroed right up to EOF and EOF straddles a page boundary we
+ * must make sure that the post-EOF area is also zeroed because the
+ * page could be mmap'd and iomap_zero_range doesn't do that for us.
+ * Writeback of the eof page will do this, albeit clumsily.
+ */
+ if (offset + length >= isize && offset_in_page(offset + length) > 0) {
+ error = filemap_write_and_wait_range(inode->i_mapping,
+ round_down(offset + length, PAGE_SIZE),
+ LLONG_MAX);
+ }
+
+ return error;
+}
+
+int
+fuse_iomap_fallocate(
+ struct file *file,
+ int mode,
+ loff_t offset,
+ loff_t length,
+ loff_t new_size)
+{
+ struct inode *inode = file_inode(file);
+ int error;
+
+ ASSERT(fuse_inode_has_iomap(inode));
+
+ /*
+ * If we unmapped blocks from the file range, then we zero the
+ * pagecache for those regions and push them to disk rather than make
+ * the fuse server manually zero the disk blocks.
+ */
+ if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE)) {
+ error = fuse_iomap_punch_range(inode, offset, length);
+ if (error)
+ return error;
+ }
+
+ /*
+ * If this is an extending write, we need to zero the bytes beyond the
+ * new EOF and bounce the new size out to userspace.
+ */
+ if (new_size) {
+ error = fuse_iomap_setsize_start(inode, new_size);
+ if (error)
+ return error;
+
+ fuse_write_update_attr(inode, new_size, length);
+ }
+
+ file_update_time(file);
+ return 0;
+}
next prev parent reply other threads:[~2025-10-29 0:48 UTC|newest]
Thread overview: 333+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 0:27 [PATCHBOMB v6] fuse: containerize ext4 for safer operation Darrick J. Wong
2025-10-29 0:37 ` [PATCHSET v6 1/8] fuse: general bug fixes Darrick J. Wong
2025-10-29 0:43 ` [PATCH 1/5] fuse: flush pending fuse events before aborting the connection Darrick J. Wong
2025-11-03 17:20 ` Joanne Koong
2025-11-03 22:13 ` Darrick J. Wong
2025-11-04 19:22 ` Joanne Koong
2025-11-04 21:47 ` Bernd Schubert
2025-11-06 0:19 ` Darrick J. Wong
2025-11-06 0:17 ` Darrick J. Wong
2025-11-06 18:37 ` Joanne Koong
2025-11-07 4:26 ` Darrick J. Wong
2025-11-07 19:18 ` Joanne Koong
2025-11-08 0:43 ` Darrick J. Wong
2025-11-07 22:03 ` Bernd Schubert
2025-11-08 0:02 ` Darrick J. Wong
2025-11-10 17:56 ` Darrick J. Wong
2025-11-10 18:22 ` Bernd Schubert
2025-11-10 18:54 ` Darrick J. Wong
2025-11-10 22:09 ` Bernd Schubert
2025-11-11 0:33 ` Darrick J. Wong
2025-10-29 0:43 ` [PATCH 2/5] fuse: signal that a fuse inode should exhibit local fs behaviors Darrick J. Wong
2025-11-04 19:59 ` Joanne Koong
2025-10-29 0:43 ` [PATCH 3/5] fuse: implement file attributes mask for statx Darrick J. Wong
2025-11-03 18:30 ` Joanne Koong
2025-11-03 18:43 ` Joanne Koong
2025-11-03 19:28 ` Darrick J. Wong
2025-10-29 0:43 ` [PATCH 4/5] fuse: update file mode when updating acls Darrick J. Wong
2025-11-07 20:29 ` Joanne Koong
2025-11-08 0:17 ` Darrick J. Wong
2025-10-29 0:44 ` [PATCH 5/5] fuse: propagate default and file acls on creation Darrick J. Wong
2026-02-05 19:32 ` Chris Mason
2026-02-05 23:28 ` Darrick J. Wong
2025-10-29 0:38 ` [PATCHSET v6 2/8] iomap: cleanups ahead of adding fuse support Darrick J. Wong
2025-10-29 0:44 ` [PATCH 1/1] iomap: allow NULL swap info bdev when activating swapfile Darrick J. Wong
2025-10-29 8:40 ` Christoph Hellwig
2025-10-29 14:38 ` Darrick J. Wong
2025-10-30 6:00 ` Christoph Hellwig
2025-10-30 14:54 ` Darrick J. Wong
2025-10-30 15:03 ` Christoph Hellwig
2025-11-07 9:23 ` Jan Engelhardt
2025-11-07 18:05 ` Darrick J. Wong
2025-10-29 0:38 ` [PATCHSET v6 3/8] fuse: cleanups ahead of adding fuse support Darrick J. Wong
2025-10-29 0:44 ` [PATCH 1/2] fuse: move the passthrough-specific code back to passthrough.c Darrick J. Wong
2025-11-06 18:36 ` Amir Goldstein
2025-10-29 0:44 ` [PATCH 2/2] fuse_trace: " Darrick J. Wong
2025-11-07 20:55 ` Joanne Koong
2025-11-08 0:24 ` Darrick J. Wong
2025-11-10 17:50 ` Joanne Koong
2025-10-29 0:38 ` [PATCHSET v6 4/8] fuse: allow servers to use iomap for better file IO performance Darrick J. Wong
2025-10-29 0:45 ` [PATCH 01/31] fuse: implement the basic iomap mechanisms Darrick J. Wong
2026-01-21 19:34 ` Joanne Koong
2026-01-21 22:45 ` Darrick J. Wong
2026-01-22 0:06 ` Joanne Koong
2026-01-22 0:34 ` Darrick J. Wong
2026-02-05 19:22 ` Chris Mason
2026-02-05 23:31 ` Darrick J. Wong
2025-10-29 0:45 ` [PATCH 02/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:45 ` [PATCH 03/31] fuse: make debugging configurable at runtime Darrick J. Wong
2026-01-21 23:42 ` Joanne Koong
2026-01-22 0:02 ` Darrick J. Wong
2026-01-22 0:23 ` Joanne Koong
2026-01-22 0:40 ` Darrick J. Wong
2025-10-29 0:46 ` [PATCH 04/31] fuse: adapt FUSE_DEV_IOC_BACKING_{OPEN,CLOSE} to add new iomap devices Darrick J. Wong
2025-11-06 18:50 ` Amir Goldstein
2025-10-29 0:46 ` [PATCH 05/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:46 ` [PATCH 06/31] fuse: flush events and send FUSE_SYNCFS and FUSE_DESTROY on unmount Darrick J. Wong
2025-10-29 0:46 ` [PATCH 07/31] fuse: create a per-inode flag for toggling iomap Darrick J. Wong
2026-01-22 1:13 ` Joanne Koong
2026-01-22 22:22 ` Darrick J. Wong
2026-01-23 18:05 ` Joanne Koong
2026-01-24 16:54 ` Darrick J. Wong
2026-01-27 23:33 ` Darrick J. Wong
2025-10-29 0:47 ` [PATCH 08/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:47 ` [PATCH 09/31] fuse: isolate the other regular file IO paths from iomap Darrick J. Wong
2025-11-06 18:44 ` Amir Goldstein
2025-11-06 23:02 ` Darrick J. Wong
2025-11-06 23:35 ` Darrick J. Wong
2025-10-29 0:47 ` [PATCH 10/31] fuse: implement basic iomap reporting such as FIEMAP and SEEK_{DATA,HOLE} Darrick J. Wong
2026-01-22 2:07 ` Joanne Koong
2026-01-22 22:31 ` Darrick J. Wong
2025-10-29 0:47 ` [PATCH 11/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:48 ` [PATCH 12/31] fuse: implement direct IO with iomap Darrick J. Wong
2026-01-23 18:56 ` Joanne Koong
2026-01-26 23:46 ` Darrick J. Wong
2026-02-05 19:19 ` Chris Mason
2026-02-06 2:08 ` Darrick J. Wong
2026-02-06 2:52 ` Chris Mason
2026-02-06 5:08 ` Darrick J. Wong
2026-02-06 14:27 ` Chris Mason
2025-10-29 0:48 ` [PATCH 13/31] fuse_trace: " Darrick J. Wong
2026-02-05 19:16 ` Chris Mason
2026-02-06 2:12 ` Darrick J. Wong
2025-10-29 0:48 ` Darrick J. Wong [this message]
2026-02-05 19:12 ` [PATCH 14/31] fuse: implement buffered " Chris Mason
2026-02-06 2:14 ` Darrick J. Wong
2025-10-29 0:48 ` [PATCH 15/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:49 ` [PATCH 16/31] fuse: implement large folios for iomap pagecache files Darrick J. Wong
2026-01-23 21:50 ` Joanne Koong
2025-10-29 0:49 ` [PATCH 17/31] fuse: use an unrestricted backing device with iomap pagecache io Darrick J. Wong
2026-01-26 22:03 ` Joanne Koong
2026-01-26 23:55 ` Darrick J. Wong
2026-01-27 1:35 ` Joanne Koong
2026-01-27 2:09 ` Darrick J. Wong
2026-01-27 18:04 ` Joanne Koong
2026-01-27 23:37 ` Darrick J. Wong
2025-10-29 0:49 ` [PATCH 18/31] fuse: advertise support for iomap Darrick J. Wong
2025-10-29 0:49 ` [PATCH 19/31] fuse: query filesystem geometry when using iomap Darrick J. Wong
2026-02-05 19:07 ` Chris Mason
2026-02-06 2:17 ` Darrick J. Wong
2025-10-29 0:50 ` [PATCH 20/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:50 ` [PATCH 21/31] fuse: implement fadvise for iomap files Darrick J. Wong
2025-10-29 0:50 ` [PATCH 22/31] fuse: invalidate ranges of block devices being used for iomap Darrick J. Wong
2025-10-29 0:50 ` [PATCH 23/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:51 ` [PATCH 24/31] fuse: implement inline data file IO via iomap Darrick J. Wong
2026-02-05 19:01 ` Chris Mason
2026-02-06 2:27 ` Darrick J. Wong
2025-10-29 0:51 ` [PATCH 25/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:51 ` [PATCH 26/31] fuse: allow more statx fields Darrick J. Wong
2025-10-29 0:51 ` [PATCH 27/31] fuse: support atomic writes with iomap Darrick J. Wong
2025-10-29 0:52 ` [PATCH 28/31] fuse_trace: " Darrick J. Wong
2025-10-29 0:52 ` [PATCH 29/31] fuse: disable direct reclaim for any fuse server that uses iomap Darrick J. Wong
2026-02-05 18:57 ` Chris Mason
2026-02-06 4:25 ` Darrick J. Wong
2025-10-29 0:52 ` [PATCH 30/31] fuse: enable swapfile activation on iomap Darrick J. Wong
2025-10-29 0:53 ` [PATCH 31/31] fuse: implement freeze and shutdowns for iomap filesystems Darrick J. Wong
2025-11-19 9:19 ` [PATCHSET v6 4/8] fuse: allow servers to use iomap for better file IO performance Demi Marie Obenour
2025-11-19 9:41 ` Gao Xiang
2025-11-19 18:04 ` Darrick J. Wong
2025-11-19 21:00 ` Gao Xiang
2025-11-19 21:51 ` Gao Xiang
2025-11-20 1:13 ` Demi Marie Obenour
2025-11-20 1:10 ` Demi Marie Obenour
2025-11-20 1:49 ` Gao Xiang
2025-11-20 1:05 ` Demi Marie Obenour
2026-01-27 0:59 ` Joanne Koong
2026-01-27 2:22 ` Darrick J. Wong
2026-01-27 19:47 ` Joanne Koong
2026-01-27 23:21 ` Darrick J. Wong
2026-01-28 0:10 ` Joanne Koong
2026-01-28 0:34 ` Darrick J. Wong
2026-01-29 1:12 ` Joanne Koong
2026-01-29 20:02 ` Darrick J. Wong
2026-01-29 22:41 ` Darrick J. Wong
2026-01-29 22:50 ` Joanne Koong
2026-01-29 23:12 ` Darrick J. Wong
2025-10-29 0:38 ` [PATCHSET v6 5/8] fuse: allow servers to specify root node id Darrick J. Wong
2025-10-29 0:53 ` [PATCH 1/3] fuse: make the root nodeid dynamic Darrick J. Wong
2025-10-29 0:53 ` [PATCH 2/3] fuse_trace: " Darrick J. Wong
2025-10-29 0:53 ` [PATCH 3/3] fuse: allow setting of root nodeid Darrick J. Wong
2025-10-29 0:39 ` [PATCHSET v6 6/8] fuse: handle timestamps and ACLs correctly when iomap is enabled Darrick J. Wong
2025-10-29 0:54 ` [PATCH 1/9] fuse: enable caching of timestamps Darrick J. Wong
2025-10-29 0:54 ` [PATCH 2/9] fuse: force a ctime update after a fileattr_set call when in iomap mode Darrick J. Wong
2025-10-29 0:54 ` [PATCH 3/9] fuse: allow local filesystems to set some VFS iflags Darrick J. Wong
2025-10-29 0:54 ` [PATCH 4/9] fuse_trace: " Darrick J. Wong
2025-10-29 0:55 ` [PATCH 5/9] fuse: cache atime when in iomap mode Darrick J. Wong
2025-10-29 0:55 ` [PATCH 6/9] fuse: let the kernel handle KILL_SUID/KILL_SGID for iomap filesystems Darrick J. Wong
2025-10-29 0:55 ` [PATCH 7/9] fuse_trace: " Darrick J. Wong
2025-10-29 0:55 ` [PATCH 8/9] fuse: update ctime when updating acls on an iomap inode Darrick J. Wong
2025-10-29 0:56 ` [PATCH 9/9] fuse: always cache ACLs when using iomap Darrick J. Wong
2025-10-29 0:39 ` [PATCHSET v6 7/8] fuse: cache iomap mappings for even better file IO performance Darrick J. Wong
2025-10-29 0:56 ` [PATCH 01/10] fuse: cache iomaps Darrick J. Wong
2025-10-29 0:56 ` [PATCH 02/10] fuse_trace: " Darrick J. Wong
2025-10-29 0:56 ` [PATCH 03/10] fuse: use the iomap cache for iomap_begin Darrick J. Wong
2026-02-05 18:52 ` Chris Mason
2026-02-06 4:28 ` Darrick J. Wong
2025-10-29 0:57 ` [PATCH 04/10] fuse_trace: " Darrick J. Wong
2025-10-29 0:57 ` [PATCH 05/10] fuse: invalidate iomap cache after file updates Darrick J. Wong
2026-02-05 18:44 ` Chris Mason
2026-02-06 4:38 ` Darrick J. Wong
2025-10-29 0:57 ` [PATCH 06/10] fuse_trace: " Darrick J. Wong
2025-10-29 0:58 ` [PATCH 07/10] fuse: enable iomap cache management Darrick J. Wong
2026-02-05 18:33 ` Chris Mason
2026-02-06 4:42 ` Darrick J. Wong
2025-10-29 0:58 ` [PATCH 08/10] fuse_trace: " Darrick J. Wong
2025-10-29 0:58 ` [PATCH 09/10] fuse: overlay iomap inode info in struct fuse_inode Darrick J. Wong
2025-10-29 0:58 ` [PATCH 10/10] fuse: enable iomap Darrick J. Wong
2025-10-29 0:39 ` [PATCHSET v6 8/8] fuse: run fuse servers as a contained service Darrick J. Wong
2025-10-29 0:59 ` [PATCH 1/2] fuse: allow privileged mount helpers to pre-approve iomap usage Darrick J. Wong
2025-10-29 0:59 ` [PATCH 2/2] fuse: set iomap backing device block size Darrick J. Wong
2025-10-29 0:40 ` [PATCHSET v6 1/5] libfuse: allow servers to use iomap for better file IO performance Darrick J. Wong
2025-10-29 0:59 ` [PATCH 01/22] libfuse: bump kernel and library ABI versions Darrick J. Wong
2025-10-29 0:59 ` [PATCH 02/22] libfuse: add kernel gates for FUSE_IOMAP Darrick J. Wong
2025-10-29 1:00 ` [PATCH 03/22] libfuse: add fuse commands for iomap_begin and end Darrick J. Wong
2025-10-29 1:00 ` [PATCH 04/22] libfuse: add upper level iomap commands Darrick J. Wong
2025-10-29 1:00 ` [PATCH 05/22] libfuse: add a lowlevel notification to add a new device to iomap Darrick J. Wong
2025-10-29 1:00 ` [PATCH 06/22] libfuse: add upper-level iomap add device function Darrick J. Wong
2025-10-29 1:01 ` [PATCH 07/22] libfuse: add iomap ioend low level handler Darrick J. Wong
2025-10-29 1:01 ` [PATCH 08/22] libfuse: add upper level iomap ioend commands Darrick J. Wong
2025-10-29 1:01 ` [PATCH 09/22] libfuse: add a reply function to send FUSE_ATTR_* to the kernel Darrick J. Wong
2025-10-29 1:01 ` [PATCH 10/22] libfuse: connect high level fuse library to fuse_reply_attr_iflags Darrick J. Wong
2025-10-29 1:02 ` [PATCH 11/22] libfuse: support direct I/O through iomap Darrick J. Wong
2025-10-29 1:02 ` [PATCH 12/22] libfuse: don't allow hardlinking of iomap files in the upper level fuse library Darrick J. Wong
2025-10-29 1:02 ` [PATCH 13/22] libfuse: allow discovery of the kernel's iomap capabilities Darrick J. Wong
2025-10-29 1:02 ` [PATCH 14/22] libfuse: add lower level iomap_config implementation Darrick J. Wong
2025-10-29 1:03 ` [PATCH 15/22] libfuse: add upper " Darrick J. Wong
2025-10-29 1:03 ` [PATCH 16/22] libfuse: add low level code to invalidate iomap block device ranges Darrick J. Wong
2025-10-29 1:03 ` [PATCH 17/22] libfuse: add upper-level API to invalidate parts of an iomap block device Darrick J. Wong
2025-10-29 1:03 ` [PATCH 18/22] libfuse: add atomic write support Darrick J. Wong
2025-10-29 1:04 ` [PATCH 19/22] libfuse: create a helper to transform an open regular file into an open loopdev Darrick J. Wong
2025-10-29 1:04 ` [PATCH 20/22] libfuse: add swapfile support for iomap files Darrick J. Wong
2025-10-29 1:04 ` [PATCH 21/22] libfuse: add lower-level filesystem freeze, thaw, and shutdown requests Darrick J. Wong
2025-10-29 1:05 ` [PATCH 22/22] libfuse: add upper-level filesystem freeze, thaw, and shutdown events Darrick J. Wong
2025-10-29 0:40 ` [PATCHSET v6 2/5] libfuse: allow servers to specify root node id Darrick J. Wong
2025-10-29 1:05 ` [PATCH 1/1] libfuse: allow root_nodeid mount option Darrick J. Wong
2025-10-29 0:40 ` [PATCHSET v6 3/5] libfuse: implement syncfs Darrick J. Wong
2025-10-29 1:05 ` [PATCH 1/4] libfuse: add strictatime/lazytime mount options Darrick J. Wong
2025-10-29 1:05 ` [PATCH 2/4] libfuse: set sync, immutable, and append when loading files Darrick J. Wong
2025-10-29 1:06 ` [PATCH 3/4] libfuse: wire up FUSE_SYNCFS to the low level library Darrick J. Wong
2025-10-29 1:06 ` [PATCH 4/4] libfuse: add syncfs support to the upper library Darrick J. Wong
2025-10-29 0:40 ` [PATCHSET v6 4/5] libfuse: cache iomap mappings for even better file IO performance Darrick J. Wong
2025-10-29 1:06 ` [PATCH 1/3] libfuse: enable iomap cache management for lowlevel fuse Darrick J. Wong
2025-10-29 1:06 ` [PATCH 2/3] libfuse: add upper-level iomap cache management Darrick J. Wong
2025-10-29 1:07 ` [PATCH 3/3] libfuse: enable iomap Darrick J. Wong
2025-10-29 0:41 ` [PATCHSET v6 5/5] libfuse: run fuse servers as a contained service Darrick J. Wong
2025-10-29 1:07 ` [PATCH 1/5] libfuse: add systemd/inetd socket service mounting helper Darrick J. Wong
2025-10-29 1:07 ` [PATCH 2/5] libfuse: integrate fuse services into mount.fuse3 Darrick J. Wong
2025-10-29 1:07 ` [PATCH 3/5] libfuse: delegate iomap privilege from mount.service to fuse services Darrick J. Wong
2025-10-29 1:08 ` [PATCH 4/5] libfuse: enable setting iomap block device block size Darrick J. Wong
2025-10-29 1:08 ` [PATCH 5/5] fuservicemount: create loop devices for regular files Darrick J. Wong
2025-10-29 0:41 ` [PATCHSET v6 1/6] fuse2fs: use fuse iomap data paths for better file I/O performance Darrick J. Wong
2025-10-29 1:08 ` [PATCH 01/17] fuse2fs: implement bare minimum iomap for file mapping reporting Darrick J. Wong
2025-10-29 1:08 ` [PATCH 02/17] fuse2fs: add iomap= mount option Darrick J. Wong
2025-10-29 1:09 ` [PATCH 03/17] fuse2fs: implement iomap configuration Darrick J. Wong
2025-10-29 1:09 ` [PATCH 04/17] fuse2fs: register block devices for use with iomap Darrick J. Wong
2025-10-29 1:09 ` [PATCH 05/17] fuse2fs: implement directio file reads Darrick J. Wong
2025-10-29 1:09 ` [PATCH 06/17] fuse2fs: add extent dump function for debugging Darrick J. Wong
2025-10-29 1:10 ` [PATCH 07/17] fuse2fs: implement direct write support Darrick J. Wong
2025-10-29 1:10 ` [PATCH 08/17] fuse2fs: turn on iomap for pagecache IO Darrick J. Wong
2025-10-29 1:10 ` [PATCH 09/17] fuse2fs: don't zero bytes in punch hole Darrick J. Wong
2025-10-29 1:11 ` [PATCH 10/17] fuse2fs: don't do file data block IO when iomap is enabled Darrick J. Wong
2025-10-29 1:11 ` [PATCH 11/17] fuse2fs: try to create loop device when ext4 device is a regular file Darrick J. Wong
2025-10-29 1:11 ` [PATCH 12/17] fuse2fs: enable file IO to inline data files Darrick J. Wong
2025-10-29 1:11 ` [PATCH 13/17] fuse2fs: set iomap-related inode flags Darrick J. Wong
2025-10-29 1:12 ` [PATCH 14/17] fuse2fs: configure block device block size Darrick J. Wong
2025-10-29 1:12 ` [PATCH 15/17] fuse4fs: separate invalidation Darrick J. Wong
2025-10-29 1:12 ` [PATCH 16/17] fuse2fs: implement statx Darrick J. Wong
2025-10-29 1:12 ` [PATCH 17/17] fuse2fs: enable atomic writes Darrick J. Wong
2025-10-29 0:41 ` [PATCHSET v6 2/6] fuse4fs: specify the root node id Darrick J. Wong
2025-10-29 1:13 ` [PATCH 1/2] fuse2fs: implement freeze and shutdown requests Darrick J. Wong
2025-10-29 1:13 ` [PATCH 2/2] fuse4fs: don't use inode number translation when possible Darrick J. Wong
2025-10-29 0:41 ` [PATCHSET v6 3/6] fuse2fs: handle timestamps and ACLs correctly when iomap is enabled Darrick J. Wong
2025-10-29 1:13 ` [PATCH 01/11] fuse2fs: add strictatime/lazytime mount options Darrick J. Wong
2025-10-29 1:13 ` [PATCH 02/11] fuse2fs: skip permission checking on utimens when iomap is enabled Darrick J. Wong
2025-10-29 1:14 ` [PATCH 03/11] fuse2fs: let the kernel tell us about acl/mode updates Darrick J. Wong
2025-10-29 1:14 ` [PATCH 04/11] fuse2fs: better debugging for file mode updates Darrick J. Wong
2025-10-29 1:14 ` [PATCH 05/11] fuse2fs: debug timestamp updates Darrick J. Wong
2025-10-29 1:14 ` [PATCH 06/11] fuse2fs: use coarse timestamps for iomap mode Darrick J. Wong
2025-10-29 1:15 ` [PATCH 07/11] fuse2fs: add tracing for retrieving timestamps Darrick J. Wong
2025-10-29 1:15 ` [PATCH 08/11] fuse2fs: enable syncfs Darrick J. Wong
2025-10-29 1:15 ` [PATCH 09/11] fuse2fs: skip the gdt write in op_destroy if syncfs is working Darrick J. Wong
2025-10-29 1:15 ` [PATCH 10/11] fuse2fs: set sync, immutable, and append at file load time Darrick J. Wong
2025-10-29 1:16 ` [PATCH 11/11] fuse4fs: increase attribute timeout in iomap mode Darrick J. Wong
2025-10-29 0:42 ` [PATCHSET v6 4/6] fuse2fs: cache iomap mappings for even better file IO performance Darrick J. Wong
2025-10-29 1:16 ` [PATCH 1/3] fuse2fs: enable caching of iomaps Darrick J. Wong
2025-10-29 1:16 ` [PATCH 2/3] fuse2fs: be smarter about caching iomaps Darrick J. Wong
2025-10-29 1:17 ` [PATCH 3/3] fuse2fs: enable iomap Darrick J. Wong
2025-10-29 0:42 ` [PATCHSET v6 5/6] fuse2fs: improve block and inode caching Darrick J. Wong
2025-10-29 1:17 ` [PATCH 1/6] libsupport: add caching IO manager Darrick J. Wong
2025-10-29 1:17 ` [PATCH 2/6] iocache: add the actual buffer cache Darrick J. Wong
2025-10-29 1:17 ` [PATCH 3/6] iocache: bump buffer mru priority every 50 accesses Darrick J. Wong
2025-10-29 1:18 ` [PATCH 4/6] fuse2fs: enable caching IO manager Darrick J. Wong
2025-10-29 1:18 ` [PATCH 5/6] fuse2fs: increase inode cache size Darrick J. Wong
2025-10-29 1:18 ` [PATCH 6/6] libext2fs: improve caching for inodes Darrick J. Wong
2025-10-29 0:42 ` [PATCHSET v6 6/6] fuse4fs: run servers as a contained service Darrick J. Wong
2025-10-29 1:18 ` [PATCH 1/7] libext2fs: fix MMP code to work with unixfd IO manager Darrick J. Wong
2025-10-29 1:19 ` [PATCH 2/7] fuse4fs: enable safe service mode Darrick J. Wong
2025-10-29 1:19 ` [PATCH 3/7] fuse4fs: set proc title when in fuse " Darrick J. Wong
2025-10-29 1:19 ` [PATCH 4/7] fuse4fs: set iomap backing device blocksize Darrick J. Wong
2025-10-29 1:19 ` [PATCH 5/7] fuse4fs: ask for loop devices when opening via fuservicemount Darrick J. Wong
2025-10-29 1:20 ` [PATCH 6/7] fuse4fs: make MMP work correctly in safe service mode Darrick J. Wong
2025-10-29 1:20 ` [PATCH 7/7] debian: update packaging for fuse4fs service Darrick J. Wong
2025-10-29 0:42 ` [PATCHSET v6] fstests: support ext4 fuse testing Darrick J. Wong
2025-10-29 1:20 ` [PATCH 01/33] misc: adapt tests to handle the fuse ext[234] drivers Darrick J. Wong
2025-10-30 9:51 ` Amir Goldstein
2025-11-05 22:53 ` Darrick J. Wong
2025-11-06 8:58 ` Amir Goldstein
2025-11-06 23:12 ` Darrick J. Wong
2025-11-07 7:50 ` Amir Goldstein
2025-11-07 7:08 ` Zorro Lang
2025-10-29 1:20 ` [PATCH 02/33] generic/740: don't run this test for fuse ext* implementations Darrick J. Wong
2025-10-30 9:59 ` Amir Goldstein
2025-11-05 22:56 ` Darrick J. Wong
2025-11-06 9:02 ` Amir Goldstein
2025-10-29 1:21 ` [PATCH 03/33] ext/052: use popdir.pl for much faster directory creation Darrick J. Wong
2025-10-29 1:21 ` [PATCH 04/33] common/rc: skip test if swapon doesn't work Darrick J. Wong
2025-11-12 6:35 ` Baokun Li
2025-11-12 18:26 ` Darrick J. Wong
2025-11-12 20:05 ` Theodore Ts'o
2025-11-12 22:29 ` [PATCH v6.1 " Darrick J. Wong
2025-11-13 1:51 ` Baokun Li
2025-11-13 15:52 ` Theodore Ts'o
2025-10-29 1:21 ` [PATCH 05/33] common/rc: streamline _scratch_remount Darrick J. Wong
2025-10-29 1:21 ` [PATCH 06/33] ext/039: require metadata journalling Darrick J. Wong
2025-10-29 1:22 ` [PATCH 07/33] populate: don't check for htree directories on fuse.ext4 Darrick J. Wong
2025-10-29 1:22 ` [PATCH 08/33] misc: convert _scratch_mount -o remount to _scratch_remount Darrick J. Wong
2025-10-29 1:22 ` [PATCH 09/33] misc: use explicitly $FSTYP'd mount calls Darrick J. Wong
2025-10-29 1:23 ` [PATCH 10/33] common/ext4: explicitly format with $FSTYP Darrick J. Wong
2025-10-29 1:23 ` [PATCH 11/33] tests/ext*: refactor open-coded _scratch_mkfs_sized calls Darrick J. Wong
2025-10-29 1:23 ` [PATCH 12/33] generic/732: disable for fuse.ext4 Darrick J. Wong
2025-10-29 1:23 ` [PATCH 13/33] defrag: fix ext4 defrag ioctl test Darrick J. Wong
2025-10-29 1:24 ` [PATCH 14/33] misc: explicitly require online resize support Darrick J. Wong
2025-10-29 1:24 ` [PATCH 15/33] ext4/004: disable for fuse2fs Darrick J. Wong
2025-10-29 1:24 ` [PATCH 16/33] generic/679: " Darrick J. Wong
2025-10-29 1:24 ` [PATCH 17/33] ext4/045: don't run the long dirent test on fuse2fs Darrick J. Wong
2025-10-29 1:25 ` [PATCH 18/33] generic/338: skip test if we can't mount with strictatime Darrick J. Wong
2025-10-29 1:25 ` [PATCH 19/33] generic/563: fuse doesn't support cgroup-aware writeback accounting Darrick J. Wong
2025-10-29 1:25 ` [PATCH 20/33] misc: use a larger buffer size for pwrites Darrick J. Wong
2025-10-29 1:25 ` [PATCH 21/33] ext4/046: don't run this test if dioread_nolock not supported Darrick J. Wong
2025-10-29 1:26 ` [PATCH 22/33] generic/631: don't run test if we can't mount overlayfs Darrick J. Wong
2025-10-30 11:35 ` Amir Goldstein
2025-11-05 23:12 ` Darrick J. Wong
2025-11-06 9:23 ` Amir Goldstein
2025-11-06 16:02 ` Darrick J. Wong
2025-10-29 1:26 ` [PATCH 23/33] generic/{409,410,411,589}: check for stacking mount support Darrick J. Wong
2025-10-30 10:25 ` Amir Goldstein
2025-11-05 22:58 ` Darrick J. Wong
2025-10-29 1:26 ` [PATCH 24/33] generic: add _require_hardlinks to tests that require hardlinks Darrick J. Wong
2025-10-29 1:26 ` [PATCH 25/33] ext4/001: check for fiemap support Darrick J. Wong
2025-10-29 1:27 ` [PATCH 26/33] generic/622: check that strictatime/lazytime actually work Darrick J. Wong
2025-10-29 1:27 ` [PATCH 27/33] generic/050: skip test because fuse2fs doesn't have stable output Darrick J. Wong
2025-10-30 10:05 ` Amir Goldstein
2025-11-05 23:02 ` Darrick J. Wong
2025-10-29 1:27 ` [PATCH 28/33] generic/405: don't stall on mkfs asking for input Darrick J. Wong
2025-10-29 1:27 ` [PATCH 29/33] ext4/006: fix this test Darrick J. Wong
2025-10-29 1:28 ` [PATCH 30/33] ext4/009: fix ENOSPC errors Darrick J. Wong
2025-10-29 1:28 ` [PATCH 31/33] ext4/022: enabl Darrick J. Wong
2025-10-29 6:03 ` Darrick J. Wong
2025-10-29 1:28 ` [PATCH 32/33] generic/730: adapt test for fuse filesystems Darrick J. Wong
2025-10-29 1:29 ` [PATCH 33/33] fuse2fs: hack around weird corruption problems Darrick J. Wong
2025-10-29 9:35 ` [PATCHSET v6] fstests: support ext4 fuse testing Christoph Hellwig
2025-10-29 23:52 ` Darrick J. Wong
2025-10-30 16:35 ` [PATCHBOMB v6] fuse: containerize ext4 for safer operation Joanne Koong
2025-10-31 17:56 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176169810656.1424854.15239592653019383193.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=bernd@bsbernd.com \
--cc=joannelkoong@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=neal@gompa.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox