From: "Darrick J. Wong" <djwong@kernel.org>
To: tytso@mit.edu
Cc: miklos@szeredi.hu, neal@gompa.dev, linux-fsdevel@vger.kernel.org,
linux-ext4@vger.kernel.org, John@groves.net, bernd@bsbernd.com,
joannelkoong@gmail.com
Subject: [PATCH 01/17] fuse2fs: implement bare minimum iomap for file mapping reporting
Date: Mon, 15 Sep 2025 17:58:59 -0700 [thread overview]
Message-ID: <175798161736.390496.6190342206145513213.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <175798161643.390496.10274066827486065265.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
Add enough of an iomap implementation that we can do FIEMAP and
SEEK_DATA and SEEK_HOLE.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
configure | 48 +++++
configure.ac | 31 +++
fuse4fs/fuse4fs.c | 525 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
lib/config.h.in | 3
misc/fuse2fs.c | 525 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
5 files changed, 1118 insertions(+), 14 deletions(-)
diff --git a/configure b/configure
index 7f5fb7c1a62084..4137f942efaef5 100755
--- a/configure
+++ b/configure
@@ -14212,6 +14212,7 @@ printf "%s\n" "yes" >&6; }
fi
+have_fuse_iomap=
if test -n "$FUSE_LIB"
then
FUSE_USE_VERSION=314
@@ -14237,12 +14238,59 @@ See \`config.log' for more details" "$LINENO" 5; }
fi
done
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iomap_begin in libfuse" >&5
+printf %s "checking for iomap_begin in libfuse... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #define _GNU_SOURCE
+ #define _FILE_OFFSET_BITS 64
+ #define FUSE_USE_VERSION 399
+ #include <fuse.h>
+
+int
+main (void)
+{
+
+ struct fuse_operations fs_ops = {
+ .iomap_begin = NULL,
+ .iomap_end = NULL,
+ };
+ struct fuse_file_iomap narf = { };
+
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+ have_fuse_iomap=yes
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$have_fuse_iomap" = yes
+ then
+ FUSE_USE_VERSION=399
+ fi
fi
if test -n "$FUSE_USE_VERSION"
then
printf "%s\n" "#define FUSE_USE_VERSION $FUSE_USE_VERSION" >>confdefs.h
+fi
+if test -n "$have_fuse_iomap"
+then
+
+printf "%s\n" "#define HAVE_FUSE_IOMAP 1" >>confdefs.h
+
fi
have_fuse_lowlevel=
diff --git a/configure.ac b/configure.ac
index 2eb11873ea0e50..a1057c07b8c056 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1382,6 +1382,7 @@ dnl
dnl Set FUSE_USE_VERSION, which is how fuse servers build against a particular
dnl libfuse ABI. Currently we link against the libfuse 3.14 ABI (hence 314)
dnl
+have_fuse_iomap=
if test -n "$FUSE_LIB"
then
FUSE_USE_VERSION=314
@@ -1391,12 +1392,42 @@ then
[AC_MSG_FAILURE([Cannot build against fuse3 headers])],
[#define _FILE_OFFSET_BITS 64
#define FUSE_USE_VERSION 314])
+
+ dnl
+ dnl Check if the fuse library supports iomap, which requires a higher
+ dnl FUSE_USE_VERSION ABI version (3.99)
+ dnl
+ AC_MSG_CHECKING(for iomap_begin in libfuse)
+ AC_LINK_IFELSE(
+ [ AC_LANG_PROGRAM([[
+ #define _GNU_SOURCE
+ #define _FILE_OFFSET_BITS 64
+ #define FUSE_USE_VERSION 399
+ #include <fuse.h>
+ ]], [[
+ struct fuse_operations fs_ops = {
+ .iomap_begin = NULL,
+ .iomap_end = NULL,
+ };
+ struct fuse_file_iomap narf = { };
+ ]])
+ ], have_fuse_iomap=yes
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no))
+ if test "$have_fuse_iomap" = yes
+ then
+ FUSE_USE_VERSION=399
+ fi
fi
if test -n "$FUSE_USE_VERSION"
then
AC_DEFINE_UNQUOTED(FUSE_USE_VERSION, $FUSE_USE_VERSION,
[Define to the version of FUSE to use])
fi
+if test -n "$have_fuse_iomap"
+then
+ AC_DEFINE(HAVE_FUSE_IOMAP, 1, [Define to 1 if fuse supports iomap])
+fi
dnl
dnl Check if the FUSE lowlevel library is supported
diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
index 9a6913f6eef16a..bf9c2081702132 100644
--- a/fuse4fs/fuse4fs.c
+++ b/fuse4fs/fuse4fs.c
@@ -143,6 +143,9 @@ static inline uint64_t round_down(uint64_t b, unsigned int align)
return b - m;
}
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#define min(a, b) ((a) < (b) ? (a) : (b))
+
#define dbg_printf(fuse4fs, format, ...) \
while ((fuse4fs)->debug) { \
printf("FUSE4FS (%s): tid=%d " format, (fuse4fs)->shortdev, gettid(), ##__VA_ARGS__); \
@@ -220,6 +223,14 @@ enum fuse4fs_opstate {
F4OP_SHUTDOWN,
};
+#ifdef HAVE_FUSE_IOMAP
+enum fuse4fs_iomap_state {
+ IOMAP_DISABLED,
+ IOMAP_UNKNOWN,
+ IOMAP_ENABLED,
+};
+#endif
+
/* Main program context */
#define FUSE4FS_MAGIC (0xEF53DEADUL)
struct fuse4fs {
@@ -248,6 +259,9 @@ struct fuse4fs {
enum fuse4fs_opstate opstate;
int logfd;
int blocklog;
+#ifdef HAVE_FUSE_IOMAP
+ enum fuse4fs_iomap_state iomap_state;
+#endif
unsigned int blockmask;
unsigned long offset;
unsigned int next_generation;
@@ -700,6 +714,15 @@ static inline void __fuse4fs_finish(struct fuse4fs *ff, int ret,
}
#define fuse4fs_finish(ff, ret) __fuse4fs_finish((ff), (ret), __func__)
+#ifdef HAVE_FUSE_IOMAP
+static inline int fuse4fs_iomap_enabled(const struct fuse4fs *ff)
+{
+ return ff->iomap_state >= IOMAP_ENABLED;
+}
+#else
+# define fuse4fs_iomap_enabled(...) (0)
+#endif
+
static void get_now(struct timespec *now)
{
#ifdef CLOCK_REALTIME
@@ -1122,7 +1145,7 @@ static errcode_t fuse4fs_open(struct fuse4fs *ff, int libext2_flags)
{
char options[128];
int flags = EXT2_FLAG_64BITS | EXT2_FLAG_THREADS | EXT2_FLAG_RW |
- libext2_flags;
+ EXT2_FLAG_WRITE_FULL_SUPER | libext2_flags;
errcode_t err;
if (ff->lockfile) {
@@ -1494,6 +1517,33 @@ static inline int fuse_set_feature_flag(struct fuse_conn_info *conn,
}
#endif
+#ifdef HAVE_FUSE_IOMAP
+static void fuse4fs_iomap_enable(struct fuse_conn_info *conn,
+ struct fuse4fs *ff)
+{
+ /* Don't let anyone touch iomap until the end of the patchset. */
+ ff->iomap_state = IOMAP_DISABLED;
+ return;
+
+ /* iomap only works with block devices */
+ if (ff->iomap_state != IOMAP_DISABLED && fuse4fs_on_bdev(ff) &&
+ fuse_set_feature_flag(conn, FUSE_CAP_IOMAP)) {
+ /*
+ * If we're mounting in iomap mode, we need to unmount in
+ * op_destroy so that the block device will be released before
+ * umount(2) returns.
+ */
+ ff->unmount_in_destroy = 1;
+ ff->iomap_state = IOMAP_ENABLED;
+ }
+
+ if (ff->iomap_state == IOMAP_UNKNOWN)
+ ff->iomap_state = IOMAP_DISABLED;
+}
+#else
+# define fuse4fs_iomap_enable(...) ((void)0)
+#endif
+
static void op_init(void *userdata, struct fuse_conn_info *conn)
{
struct fuse4fs *ff = userdata;
@@ -1516,6 +1566,7 @@ static void op_init(void *userdata, struct fuse_conn_info *conn)
#ifdef FUSE_CAP_NO_EXPORT_SUPPORT
fuse_set_feature_flag(conn, FUSE_CAP_NO_EXPORT_SUPPORT);
#endif
+ fuse4fs_iomap_enable(conn, ff);
conn->time_gran = 1;
if (ff->kernel) {
@@ -5402,6 +5453,460 @@ static void op_fallocate(fuse_req_t req, fuse_ino_t fino EXT2FS_ATTR((unused)),
}
#endif /* SUPPORT_FALLOCATE */
+#ifdef HAVE_FUSE_IOMAP
+static void fuse4fs_iomap_hole(struct fuse4fs *ff, struct fuse_file_iomap *iomap,
+ off_t pos, uint64_t count)
+{
+ iomap->dev = FUSE_IOMAP_DEV_NULL;
+ iomap->addr = FUSE_IOMAP_NULL_ADDR;
+ iomap->offset = pos;
+ iomap->length = count;
+ iomap->type = FUSE_IOMAP_TYPE_HOLE;
+}
+
+static void fuse4fs_iomap_hole_to_eof(struct fuse4fs *ff,
+ struct fuse_file_iomap *iomap, off_t pos,
+ off_t count,
+ const struct ext2_inode_large *inode)
+{
+ ext2_filsys fs = ff->fs;
+ uint64_t isize = EXT2_I_SIZE(inode);
+
+ /*
+ * We have to be careful about handling a hole to the right of the
+ * entire mapping tree. First, the mapping must start and end on a
+ * block boundary because they must be aligned to at least an LBA for
+ * the block layer; and to the fsblock for smoother operation.
+ *
+ * As for the length -- we could return a mapping all the way to
+ * i_size, but i_size could be less than pos/count if we're zeroing the
+ * EOF block in anticipation of a truncate operation. Similarly, we
+ * don't want to end the mapping at pos+count because we know there's
+ * nothing mapped byeond here.
+ */
+ uint64_t startoff = round_down(pos, fs->blocksize);
+ uint64_t eofoff = round_up(max(pos + count, isize), fs->blocksize);
+
+ dbg_printf(ff,
+ "pos=0x%llx count=0x%llx isize=0x%llx startoff=0x%llx eofoff=0x%llx\n",
+ (unsigned long long)pos,
+ (unsigned long long)count,
+ (unsigned long long)isize,
+ (unsigned long long)startoff,
+ (unsigned long long)eofoff);
+
+ fuse4fs_iomap_hole(ff, iomap, startoff, eofoff - startoff);
+}
+
+#define DEBUG_IOMAP
+#ifdef DEBUG_IOMAP
+# define __DUMP_EXTENT(ff, func, tag, startoff, err, extent) \
+ do { \
+ dbg_printf((ff), \
+ "%s: %s startoff 0x%llx err %ld lblk 0x%llx pblk 0x%llx len 0x%x flags 0x%x\n", \
+ (func), (tag), (startoff), (err), (extent)->e_lblk, \
+ (extent)->e_pblk, (extent)->e_len, \
+ (extent)->e_flags & EXT2_EXTENT_FLAGS_UNINIT); \
+ } while(0)
+# define DUMP_EXTENT(ff, tag, startoff, err, extent) \
+ __DUMP_EXTENT((ff), __func__, (tag), (startoff), (err), (extent))
+
+# define __DUMP_INFO(ff, func, tag, startoff, err, info) \
+ do { \
+ dbg_printf((ff), \
+ "%s: %s startoff 0x%llx err %ld entry %d/%d/%d level %d/%d\n", \
+ (func), (tag), (startoff), (err), \
+ (info)->curr_entry, (info)->num_entries, \
+ (info)->max_entries, (info)->curr_level, \
+ (info)->max_depth); \
+ } while(0)
+# define DUMP_INFO(ff, tag, startoff, err, info) \
+ __DUMP_INFO((ff), __func__, (tag), (startoff), (err), (info))
+#else
+# define __DUMP_EXTENT(...) ((void)0)
+# define DUMP_EXTENT(...) ((void)0)
+# define DUMP_INFO(...) ((void)0)
+#endif
+
+static inline errcode_t __fuse4fs_get_mapping_at(struct fuse4fs *ff,
+ ext2_extent_handle_t handle,
+ blk64_t startoff,
+ struct ext2fs_extent *bmap,
+ const char *func)
+{
+ errcode_t err;
+
+ /*
+ * Find the file mapping at startoff. We don't check the return value
+ * of _goto because _get will error out if _goto failed. There's a
+ * subtlety to the outcome of _goto when startoff falls in a sparse
+ * hole however:
+ *
+ * Most of the time, _goto points the cursor at the mapping whose lblk
+ * is just to the left of startoff. The mapping may or may not overlap
+ * startoff; this is ok. In other words, the tree lookup behaves as if
+ * we asked it to use a less than or equals comparison.
+ *
+ * However, if startoff is to the left of the first mapping in the
+ * extent tree, _goto points the cursor at that first mapping because
+ * it doesn't know how to deal with this situation. In this case,
+ * the tree lookup behaves as if we asked it to use a greater than
+ * or equals comparison.
+ *
+ * Note: If _get() returns 'no current node', that means that there
+ * aren't any mappings at all.
+ */
+ ext2fs_extent_goto(handle, startoff);
+ err = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, bmap);
+ __DUMP_EXTENT(ff, func, "lookup", startoff, err, bmap);
+ if (err == EXT2_ET_NO_CURRENT_NODE)
+ err = EXT2_ET_EXTENT_NOT_FOUND;
+ return err;
+}
+
+static inline errcode_t __fuse4fs_get_next_mapping(struct fuse4fs *ff,
+ ext2_extent_handle_t handle,
+ blk64_t startoff,
+ struct ext2fs_extent *bmap,
+ const char *func)
+{
+ struct ext2fs_extent newex;
+ struct ext2_extent_info info;
+ errcode_t err;
+
+ /*
+ * The extent tree code has this (probably broken) behavior that if
+ * more than two of the highest levels of the cursor point at the
+ * rightmost edge of an extent tree block, a _NEXT_LEAF movement fails
+ * to move the cursor position of any of the lower levels. IOWs, if
+ * leaf level N is at the right edge, it will only advance level N-1
+ * to the right. If N-1 was at the right edge, the cursor resets to
+ * record 0 of that level and goes down to the wrong leaf.
+ *
+ * Work around this by walking up (towards root level 0) the extent
+ * tree until we find a level where we're not already at the rightmost
+ * edge. The _NEXT_LEAF movement will walk down the tree to find the
+ * leaves.
+ */
+ err = ext2fs_extent_get_info(handle, &info);
+ DUMP_INFO(ff, "UP?", startoff, err, &info);
+ if (err)
+ return err;
+
+ while (info.curr_entry == info.num_entries && info.curr_level > 0) {
+ err = ext2fs_extent_get(handle, EXT2_EXTENT_UP, &newex);
+ DUMP_EXTENT(ff, "UP", startoff, err, &newex);
+ if (err)
+ return err;
+ err = ext2fs_extent_get_info(handle, &info);
+ DUMP_INFO(ff, "UP", startoff, err, &info);
+ if (err)
+ return err;
+ }
+
+ /*
+ * If we're at the root and there are no more entries, there's nothing
+ * else to be found.
+ */
+ if (info.curr_level == 0 && info.curr_entry == info.num_entries)
+ return EXT2_ET_EXTENT_NOT_FOUND;
+
+ /* Otherwise grab this next leaf and return it. */
+ err = ext2fs_extent_get(handle, EXT2_EXTENT_NEXT_LEAF, &newex);
+ DUMP_EXTENT(ff, "NEXT", startoff, err, &newex);
+ if (err)
+ return err;
+
+ *bmap = newex;
+ return 0;
+}
+
+#define fuse4fs_get_mapping_at(ff, handle, startoff, bmap) \
+ __fuse4fs_get_mapping_at((ff), (handle), (startoff), (bmap), __func__)
+#define fuse4fs_get_next_mapping(ff, handle, startoff, bmap) \
+ __fuse4fs_get_next_mapping((ff), (handle), (startoff), (bmap), __func__)
+
+static errcode_t fuse4fs_iomap_begin_extent(struct fuse4fs *ff, uint64_t ino,
+ struct ext2_inode_large *inode,
+ off_t pos, uint64_t count,
+ uint32_t opflags,
+ struct fuse_file_iomap *iomap)
+{
+ ext2_extent_handle_t handle;
+ struct ext2fs_extent extent = { };
+ ext2_filsys fs = ff->fs;
+ const blk64_t startoff = FUSE4FS_B_TO_FSBT(ff, pos);
+ errcode_t err;
+ int ret = 0;
+
+ err = ext2fs_extent_open2(fs, ino, EXT2_INODE(inode), &handle);
+ if (err)
+ return translate_error(fs, ino, err);
+
+ err = fuse4fs_get_mapping_at(ff, handle, startoff, &extent);
+ if (err == EXT2_ET_EXTENT_NOT_FOUND) {
+ /* No mappings at all; the whole range is a hole. */
+ fuse4fs_iomap_hole_to_eof(ff, iomap, pos, count, inode);
+ goto out_handle;
+ }
+ if (err) {
+ ret = translate_error(fs, ino, err);
+ goto out_handle;
+ }
+
+ if (startoff < extent.e_lblk) {
+ /*
+ * Mapping starts to the right of the current position.
+ * Synthesize a hole going to that next extent.
+ */
+ fuse4fs_iomap_hole(ff, iomap, FUSE4FS_FSB_TO_B(ff, startoff),
+ FUSE4FS_FSB_TO_B(ff, extent.e_lblk - startoff));
+ goto out_handle;
+ }
+
+ if (startoff >= extent.e_lblk + extent.e_len) {
+ /*
+ * Mapping ends to the left of the current position. Try to
+ * find the next mapping. If there is no next mapping, the
+ * whole range is in a hole.
+ */
+ err = fuse4fs_get_next_mapping(ff, handle, startoff, &extent);
+ if (err == EXT2_ET_EXTENT_NOT_FOUND) {
+ fuse4fs_iomap_hole_to_eof(ff, iomap, pos, count, inode);
+ goto out_handle;
+ }
+
+ /*
+ * If the new mapping starts to the right of startoff, there's
+ * a hole from startoff to the start of the new mapping.
+ */
+ if (startoff < extent.e_lblk) {
+ fuse4fs_iomap_hole(ff, iomap,
+ FUSE4FS_FSB_TO_B(ff, startoff),
+ FUSE4FS_FSB_TO_B(ff, extent.e_lblk - startoff));
+ goto out_handle;
+ }
+
+ /*
+ * The new mapping starts at startoff. Something weird
+ * happened in the extent tree lookup, but we found a valid
+ * mapping so we'll run with it.
+ */
+ }
+
+ /* Mapping overlaps startoff, report this. */
+ iomap->dev = FUSE_IOMAP_DEV_NULL;
+ iomap->addr = FUSE4FS_FSB_TO_B(ff, extent.e_pblk);
+ iomap->offset = FUSE4FS_FSB_TO_B(ff, extent.e_lblk);
+ iomap->length = FUSE4FS_FSB_TO_B(ff, extent.e_len);
+ if (extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT)
+ iomap->type = FUSE_IOMAP_TYPE_UNWRITTEN;
+ else
+ iomap->type = FUSE_IOMAP_TYPE_MAPPED;
+
+out_handle:
+ ext2fs_extent_free(handle);
+ return ret;
+}
+
+static int fuse4fs_iomap_begin_indirect(struct fuse4fs *ff, uint64_t ino,
+ struct ext2_inode_large *inode,
+ off_t pos, uint64_t count,
+ uint32_t opflags,
+ struct fuse_file_iomap *iomap)
+{
+ ext2_filsys fs = ff->fs;
+ blk64_t startoff = FUSE4FS_B_TO_FSBT(ff, pos);
+ uint64_t isize = EXT2_I_SIZE(inode);
+ uint64_t real_count = min(count, 131072);
+ const blk64_t endoff = FUSE4FS_B_TO_FSB(ff, pos + real_count);
+ blk64_t startblock;
+ errcode_t err;
+
+ err = ext2fs_bmap2(fs, ino, EXT2_INODE(inode), NULL, 0, startoff, NULL,
+ &startblock);
+ if (err)
+ return translate_error(fs, ino, err);
+
+ iomap->dev = FUSE_IOMAP_DEV_NULL;
+ iomap->offset = FUSE4FS_FSB_TO_B(ff, startoff);
+ iomap->flags |= FUSE_IOMAP_F_MERGED;
+ if (startblock) {
+ iomap->addr = FUSE4FS_FSB_TO_B(ff, startblock);
+ iomap->type = FUSE_IOMAP_TYPE_MAPPED;
+ } else {
+ iomap->addr = FUSE_IOMAP_NULL_ADDR;
+ iomap->type = FUSE_IOMAP_TYPE_HOLE;
+ }
+ iomap->length = fs->blocksize;
+
+ /* See how long the mapping goes for. */
+ for (startoff++; startoff < endoff; startoff++) {
+ blk64_t prev_startblock = startblock;
+
+ err = ext2fs_bmap2(fs, ino, EXT2_INODE(inode), NULL, 0,
+ startoff, NULL, &startblock);
+ if (err)
+ break;
+
+ if (iomap->type == FUSE_IOMAP_TYPE_MAPPED) {
+ if (startblock == prev_startblock + 1)
+ iomap->length += fs->blocksize;
+ else
+ break;
+ } else {
+ if (startblock == 0)
+ iomap->length += fs->blocksize;
+ else
+ break;
+ }
+ }
+
+ /*
+ * If this is a hole that goes beyond EOF, report this as a hole to the
+ * end of the range queried so that FIEMAP doesn't go mad.
+ */
+ if (iomap->type == FUSE_IOMAP_TYPE_HOLE &&
+ iomap->offset + iomap->length >= isize)
+ fuse4fs_iomap_hole_to_eof(ff, iomap, pos, count, inode);
+
+ return 0;
+}
+
+static int fuse4fs_iomap_begin_inline(struct fuse4fs *ff, ext2_ino_t ino,
+ struct ext2_inode_large *inode, off_t pos,
+ uint64_t count, struct fuse_file_iomap *iomap)
+{
+ uint64_t one_fsb = FUSE4FS_FSB_TO_B(ff, 1);
+
+ if (pos >= one_fsb) {
+ fuse4fs_iomap_hole_to_eof(ff, iomap, pos, count, inode);
+ } else {
+ /* ext4 only supports inline data files up to 1 fsb */
+ iomap->dev = FUSE_IOMAP_DEV_NULL;
+ iomap->addr = FUSE_IOMAP_NULL_ADDR;
+ iomap->offset = 0;
+ iomap->length = one_fsb;
+ iomap->type = FUSE_IOMAP_TYPE_INLINE;
+ }
+
+ return 0;
+}
+
+static int fuse4fs_iomap_begin_report(struct fuse4fs *ff, ext2_ino_t ino,
+ struct ext2_inode_large *inode,
+ off_t pos, uint64_t count,
+ uint32_t opflags,
+ struct fuse_file_iomap *read)
+{
+ if (inode->i_flags & EXT4_INLINE_DATA_FL)
+ return fuse4fs_iomap_begin_inline(ff, ino, inode, pos, count,
+ read);
+
+ if (inode->i_flags & EXT4_EXTENTS_FL)
+ return fuse4fs_iomap_begin_extent(ff, ino, inode, pos, count,
+ opflags, read);
+
+ return fuse4fs_iomap_begin_indirect(ff, ino, inode, pos, count,
+ opflags, read);
+}
+
+static int fuse4fs_iomap_begin_read(struct fuse4fs *ff, ext2_ino_t ino,
+ struct ext2_inode_large *inode, off_t pos,
+ uint64_t count, uint32_t opflags,
+ struct fuse_file_iomap *read)
+{
+ return -ENOSYS;
+}
+
+static int fuse4fs_iomap_begin_write(struct fuse4fs *ff, ext2_ino_t ino,
+ struct ext2_inode_large *inode, off_t pos,
+ uint64_t count, uint32_t opflags,
+ struct fuse_file_iomap *read)
+{
+ return -ENOSYS;
+}
+
+static void op_iomap_begin(fuse_req_t req, fuse_ino_t fino, uint64_t dontcare,
+ off_t pos, uint64_t count, uint32_t opflags)
+{
+ struct fuse4fs *ff = fuse4fs_get(req);
+ struct ext2_inode_large inode;
+ struct fuse_file_iomap read = { };
+ ext2_filsys fs;
+ ext2_ino_t ino;
+ errcode_t err;
+ int ret = 0;
+
+ FUSE4FS_CHECK_CONTEXT(req);
+ FUSE4FS_CONVERT_FINO(req, &ino, fino);
+
+ dbg_printf(ff, "%s: ino=%d pos=0x%llx count=0x%llx opflags=0x%x\n",
+ __func__, ino,
+ (unsigned long long)pos,
+ (unsigned long long)count,
+ opflags);
+
+ fs = fuse4fs_start(ff);
+ err = fuse4fs_read_inode(fs, ino, &inode);
+ if (err) {
+ ret = translate_error(fs, ino, err);
+ goto out_unlock;
+ }
+
+ if (opflags & FUSE_IOMAP_OP_REPORT)
+ ret = fuse4fs_iomap_begin_report(ff, ino, &inode, pos, count,
+ opflags, &read);
+ else if (fuse_iomap_is_write(opflags))
+ ret = fuse4fs_iomap_begin_write(ff, ino, &inode, pos, count,
+ opflags, &read);
+ else
+ ret = fuse4fs_iomap_begin_read(ff, ino, &inode, pos, count,
+ opflags, &read);
+ if (ret)
+ goto out_unlock;
+
+ dbg_printf(ff,
+ "%s: ino=%d pos=0x%llx -> addr=0x%llx offset=0x%llx length=0x%llx type=%u flags=0x%x\n",
+ __func__, ino,
+ (unsigned long long)pos,
+ (unsigned long long)read.addr,
+ (unsigned long long)read.offset,
+ (unsigned long long)read.length,
+ read.type,
+ read.flags);
+
+out_unlock:
+ fuse4fs_finish(ff, ret);
+ if (ret)
+ fuse_reply_err(req, -ret);
+ else
+ fuse_reply_iomap_begin(req, &read, NULL);
+}
+
+static void op_iomap_end(fuse_req_t req, fuse_ino_t fino, uint64_t dontcare,
+ off_t pos, uint64_t count, uint32_t opflags,
+ ssize_t written, const struct fuse_file_iomap *iomap)
+{
+ struct fuse4fs *ff = fuse4fs_get(req);
+ ext2_ino_t ino;
+
+ FUSE4FS_CHECK_CONTEXT(req);
+ FUSE4FS_CONVERT_FINO(req, &ino, fino);
+
+ dbg_printf(ff,
+ "%s: ino=%d pos=0x%llx count=0x%llx opflags=0x%x written=0x%zx mapflags=0x%x\n",
+ __func__, ino,
+ (unsigned long long)pos,
+ (unsigned long long)count,
+ opflags,
+ written,
+ iomap->flags);
+
+ fuse_reply_err(req, 0);
+}
+#endif /* HAVE_FUSE_IOMAP */
+
static struct fuse_lowlevel_ops fs_ops = {
.lookup = op_lookup,
.setattr = op_setattr,
@@ -5445,6 +5950,10 @@ static struct fuse_lowlevel_ops fs_ops = {
#ifdef SUPPORT_FALLOCATE
.fallocate = op_fallocate,
#endif
+#ifdef HAVE_FUSE_IOMAP
+ .iomap_begin = op_iomap_begin,
+ .iomap_end = op_iomap_end,
+#endif /* HAVE_FUSE_IOMAP */
};
static int get_random_bytes(void *p, size_t sz)
@@ -5768,17 +6277,19 @@ static int fuse4fs_main(struct fuse_args *args, struct fuse4fs *ff)
int main(int argc, char *argv[])
{
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
- struct fuse4fs fctx;
+ struct fuse4fs fctx = {
+ .magic = FUSE4FS_MAGIC,
+ .opstate = F4OP_WRITABLE,
+ .logfd = -1,
+#ifdef HAVE_FUSE_IOMAP
+ .iomap_state = IOMAP_UNKNOWN,
+#endif
+ };
errcode_t err;
FILE *orig_stderr = stderr;
char extra_args[BUFSIZ];
int ret;
- memset(&fctx, 0, sizeof(fctx));
- fctx.magic = FUSE4FS_MAGIC;
- fctx.logfd = -1;
- fctx.opstate = F4OP_WRITABLE;
-
ret = fuse_opt_parse(&args, &fctx, fuse4fs_opts, fuse4fs_opt_proc);
if (ret)
exit(1);
diff --git a/lib/config.h.in b/lib/config.h.in
index c3379758c3c9bc..55e515020af422 100644
--- a/lib/config.h.in
+++ b/lib/config.h.in
@@ -76,6 +76,9 @@
/* Define to 1 if fuse supports lowlevel API */
#undef HAVE_FUSE_LOWLEVEL
+/* Define to 1 if fuse supports iomap */
+#undef HAVE_FUSE_IOMAP
+
/* Define to 1 if you have the Mac OS X function
CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 6290d22f2b9658..ca61fbc89f5fda 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -137,6 +137,9 @@ static inline uint64_t round_down(uint64_t b, unsigned int align)
return b - m;
}
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#define min(a, b) ((a) < (b) ? (a) : (b))
+
#define dbg_printf(fuse2fs, format, ...) \
while ((fuse2fs)->debug) { \
printf("FUSE2FS (%s): tid=%d " format, (fuse2fs)->shortdev, gettid(), ##__VA_ARGS__); \
@@ -213,6 +216,14 @@ enum fuse2fs_opstate {
F2OP_SHUTDOWN,
};
+#ifdef HAVE_FUSE_IOMAP
+enum fuse2fs_iomap_state {
+ IOMAP_DISABLED,
+ IOMAP_UNKNOWN,
+ IOMAP_ENABLED,
+};
+#endif
+
/* Main program context */
#define FUSE2FS_MAGIC (0xEF53DEADUL)
struct fuse2fs {
@@ -241,6 +252,9 @@ struct fuse2fs {
enum fuse2fs_opstate opstate;
int logfd;
int blocklog;
+#ifdef HAVE_FUSE_IOMAP
+ enum fuse2fs_iomap_state iomap_state;
+#endif
unsigned int blockmask;
unsigned long offset;
unsigned int next_generation;
@@ -536,6 +550,15 @@ static inline void __fuse2fs_finish(struct fuse2fs *ff, int ret,
}
#define fuse2fs_finish(ff, ret) __fuse2fs_finish((ff), (ret), __func__)
+#ifdef HAVE_FUSE_IOMAP
+static inline int fuse2fs_iomap_enabled(const struct fuse2fs *ff)
+{
+ return ff->iomap_state >= IOMAP_ENABLED;
+}
+#else
+# define fuse2fs_iomap_enabled(...) (0)
+#endif
+
static void get_now(struct timespec *now)
{
#ifdef CLOCK_REALTIME
@@ -932,7 +955,7 @@ static errcode_t fuse2fs_open(struct fuse2fs *ff, int libext2_flags)
{
char options[128];
int flags = EXT2_FLAG_64BITS | EXT2_FLAG_THREADS | EXT2_FLAG_RW |
- libext2_flags;
+ EXT2_FLAG_WRITE_FULL_SUPER | libext2_flags;
errcode_t err;
if (ff->lockfile) {
@@ -1300,6 +1323,33 @@ static inline int fuse_set_feature_flag(struct fuse_conn_info *conn,
}
#endif
+#ifdef HAVE_FUSE_IOMAP
+static void fuse2fs_iomap_enable(struct fuse_conn_info *conn,
+ struct fuse2fs *ff)
+{
+ /* Don't let anyone touch iomap until the end of the patchset. */
+ ff->iomap_state = IOMAP_DISABLED;
+ return;
+
+ /* iomap only works with block devices */
+ if (ff->iomap_state != IOMAP_DISABLED && fuse2fs_on_bdev(ff) &&
+ fuse_set_feature_flag(conn, FUSE_CAP_IOMAP)) {
+ /*
+ * If we're mounting in iomap mode, we need to unmount in
+ * op_destroy so that the block device will be released before
+ * umount(2) returns.
+ */
+ ff->unmount_in_destroy = 1;
+ ff->iomap_state = IOMAP_ENABLED;
+ }
+
+ if (ff->iomap_state == IOMAP_UNKNOWN)
+ ff->iomap_state = IOMAP_DISABLED;
+}
+#else
+# define fuse2fs_iomap_enable(...) ((void)0)
+#endif
+
static void *op_init(struct fuse_conn_info *conn,
struct fuse_config *cfg EXT2FS_ATTR((unused)))
{
@@ -1333,6 +1383,8 @@ static void *op_init(struct fuse_conn_info *conn,
#ifdef FUSE_CAP_NO_EXPORT_SUPPORT
fuse_set_feature_flag(conn, FUSE_CAP_NO_EXPORT_SUPPORT);
#endif
+ fuse2fs_iomap_enable(conn, ff);
+
conn->time_gran = 1;
cfg->use_ino = 1;
if (ff->debug)
@@ -4842,6 +4894,459 @@ static int op_fallocate(const char *path EXT2FS_ATTR((unused)), int mode,
}
#endif /* SUPPORT_FALLOCATE */
+#ifdef HAVE_FUSE_IOMAP
+static void fuse2fs_iomap_hole(struct fuse2fs *ff, struct fuse_file_iomap *iomap,
+ off_t pos, uint64_t count)
+{
+ iomap->dev = FUSE_IOMAP_DEV_NULL;
+ iomap->addr = FUSE_IOMAP_NULL_ADDR;
+ iomap->offset = pos;
+ iomap->length = count;
+ iomap->type = FUSE_IOMAP_TYPE_HOLE;
+}
+
+static void fuse2fs_iomap_hole_to_eof(struct fuse2fs *ff,
+ struct fuse_file_iomap *iomap, off_t pos,
+ off_t count,
+ const struct ext2_inode_large *inode)
+{
+ ext2_filsys fs = ff->fs;
+ uint64_t isize = EXT2_I_SIZE(inode);
+
+ /*
+ * We have to be careful about handling a hole to the right of the
+ * entire mapping tree. First, the mapping must start and end on a
+ * block boundary because they must be aligned to at least an LBA for
+ * the block layer; and to the fsblock for smoother operation.
+ *
+ * As for the length -- we could return a mapping all the way to
+ * i_size, but i_size could be less than pos/count if we're zeroing the
+ * EOF block in anticipation of a truncate operation. Similarly, we
+ * don't want to end the mapping at pos+count because we know there's
+ * nothing mapped byeond here.
+ */
+ uint64_t startoff = round_down(pos, fs->blocksize);
+ uint64_t eofoff = round_up(max(pos + count, isize), fs->blocksize);
+
+ dbg_printf(ff,
+ "pos=0x%llx count=0x%llx isize=0x%llx startoff=0x%llx eofoff=0x%llx\n",
+ (unsigned long long)pos,
+ (unsigned long long)count,
+ (unsigned long long)isize,
+ (unsigned long long)startoff,
+ (unsigned long long)eofoff);
+
+ fuse2fs_iomap_hole(ff, iomap, startoff, eofoff - startoff);
+}
+
+#define DEBUG_IOMAP
+#ifdef DEBUG_IOMAP
+# define __DUMP_EXTENT(ff, func, tag, startoff, err, extent) \
+ do { \
+ dbg_printf((ff), \
+ "%s: %s startoff 0x%llx err %ld lblk 0x%llx pblk 0x%llx len 0x%x flags 0x%x\n", \
+ (func), (tag), (startoff), (err), (extent)->e_lblk, \
+ (extent)->e_pblk, (extent)->e_len, \
+ (extent)->e_flags & EXT2_EXTENT_FLAGS_UNINIT); \
+ } while(0)
+# define DUMP_EXTENT(ff, tag, startoff, err, extent) \
+ __DUMP_EXTENT((ff), __func__, (tag), (startoff), (err), (extent))
+
+# define __DUMP_INFO(ff, func, tag, startoff, err, info) \
+ do { \
+ dbg_printf((ff), \
+ "%s: %s startoff 0x%llx err %ld entry %d/%d/%d level %d/%d\n", \
+ (func), (tag), (startoff), (err), \
+ (info)->curr_entry, (info)->num_entries, \
+ (info)->max_entries, (info)->curr_level, \
+ (info)->max_depth); \
+ } while(0)
+# define DUMP_INFO(ff, tag, startoff, err, info) \
+ __DUMP_INFO((ff), __func__, (tag), (startoff), (err), (info))
+#else
+# define __DUMP_EXTENT(...) ((void)0)
+# define DUMP_EXTENT(...) ((void)0)
+# define DUMP_INFO(...) ((void)0)
+#endif
+
+static inline errcode_t __fuse2fs_get_mapping_at(struct fuse2fs *ff,
+ ext2_extent_handle_t handle,
+ blk64_t startoff,
+ struct ext2fs_extent *bmap,
+ const char *func)
+{
+ errcode_t err;
+
+ /*
+ * Find the file mapping at startoff. We don't check the return value
+ * of _goto because _get will error out if _goto failed. There's a
+ * subtlety to the outcome of _goto when startoff falls in a sparse
+ * hole however:
+ *
+ * Most of the time, _goto points the cursor at the mapping whose lblk
+ * is just to the left of startoff. The mapping may or may not overlap
+ * startoff; this is ok. In other words, the tree lookup behaves as if
+ * we asked it to use a less than or equals comparison.
+ *
+ * However, if startoff is to the left of the first mapping in the
+ * extent tree, _goto points the cursor at that first mapping because
+ * it doesn't know how to deal with this situation. In this case,
+ * the tree lookup behaves as if we asked it to use a greater than
+ * or equals comparison.
+ *
+ * Note: If _get() returns 'no current node', that means that there
+ * aren't any mappings at all.
+ */
+ ext2fs_extent_goto(handle, startoff);
+ err = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, bmap);
+ __DUMP_EXTENT(ff, func, "lookup", startoff, err, bmap);
+ if (err == EXT2_ET_NO_CURRENT_NODE)
+ err = EXT2_ET_EXTENT_NOT_FOUND;
+ return err;
+}
+
+static inline errcode_t __fuse2fs_get_next_mapping(struct fuse2fs *ff,
+ ext2_extent_handle_t handle,
+ blk64_t startoff,
+ struct ext2fs_extent *bmap,
+ const char *func)
+{
+ struct ext2fs_extent newex;
+ struct ext2_extent_info info;
+ errcode_t err;
+
+ /*
+ * The extent tree code has this (probably broken) behavior that if
+ * more than two of the highest levels of the cursor point at the
+ * rightmost edge of an extent tree block, a _NEXT_LEAF movement fails
+ * to move the cursor position of any of the lower levels. IOWs, if
+ * leaf level N is at the right edge, it will only advance level N-1
+ * to the right. If N-1 was at the right edge, the cursor resets to
+ * record 0 of that level and goes down to the wrong leaf.
+ *
+ * Work around this by walking up (towards root level 0) the extent
+ * tree until we find a level where we're not already at the rightmost
+ * edge. The _NEXT_LEAF movement will walk down the tree to find the
+ * leaves.
+ */
+ err = ext2fs_extent_get_info(handle, &info);
+ DUMP_INFO(ff, "UP?", startoff, err, &info);
+ if (err)
+ return err;
+
+ while (info.curr_entry == info.num_entries && info.curr_level > 0) {
+ err = ext2fs_extent_get(handle, EXT2_EXTENT_UP, &newex);
+ DUMP_EXTENT(ff, "UP", startoff, err, &newex);
+ if (err)
+ return err;
+ err = ext2fs_extent_get_info(handle, &info);
+ DUMP_INFO(ff, "UP", startoff, err, &info);
+ if (err)
+ return err;
+ }
+
+ /*
+ * If we're at the root and there are no more entries, there's nothing
+ * else to be found.
+ */
+ if (info.curr_level == 0 && info.curr_entry == info.num_entries)
+ return EXT2_ET_EXTENT_NOT_FOUND;
+
+ /* Otherwise grab this next leaf and return it. */
+ err = ext2fs_extent_get(handle, EXT2_EXTENT_NEXT_LEAF, &newex);
+ DUMP_EXTENT(ff, "NEXT", startoff, err, &newex);
+ if (err)
+ return err;
+
+ *bmap = newex;
+ return 0;
+}
+
+#define fuse2fs_get_mapping_at(ff, handle, startoff, bmap) \
+ __fuse2fs_get_mapping_at((ff), (handle), (startoff), (bmap), __func__)
+#define fuse2fs_get_next_mapping(ff, handle, startoff, bmap) \
+ __fuse2fs_get_next_mapping((ff), (handle), (startoff), (bmap), __func__)
+
+static errcode_t fuse2fs_iomap_begin_extent(struct fuse2fs *ff, uint64_t ino,
+ struct ext2_inode_large *inode,
+ off_t pos, uint64_t count,
+ uint32_t opflags,
+ struct fuse_file_iomap *iomap)
+{
+ ext2_extent_handle_t handle;
+ struct ext2fs_extent extent = { };
+ ext2_filsys fs = ff->fs;
+ const blk64_t startoff = FUSE2FS_B_TO_FSBT(ff, pos);
+ errcode_t err;
+ int ret = 0;
+
+ err = ext2fs_extent_open2(fs, ino, EXT2_INODE(inode), &handle);
+ if (err)
+ return translate_error(fs, ino, err);
+
+ err = fuse2fs_get_mapping_at(ff, handle, startoff, &extent);
+ if (err == EXT2_ET_EXTENT_NOT_FOUND) {
+ /* No mappings at all; the whole range is a hole. */
+ fuse2fs_iomap_hole_to_eof(ff, iomap, pos, count, inode);
+ goto out_handle;
+ }
+ if (err) {
+ ret = translate_error(fs, ino, err);
+ goto out_handle;
+ }
+
+ if (startoff < extent.e_lblk) {
+ /*
+ * Mapping starts to the right of the current position.
+ * Synthesize a hole going to that next extent.
+ */
+ fuse2fs_iomap_hole(ff, iomap, FUSE2FS_FSB_TO_B(ff, startoff),
+ FUSE2FS_FSB_TO_B(ff, extent.e_lblk - startoff));
+ goto out_handle;
+ }
+
+ if (startoff >= extent.e_lblk + extent.e_len) {
+ /*
+ * Mapping ends to the left of the current position. Try to
+ * find the next mapping. If there is no next mapping, the
+ * whole range is in a hole.
+ */
+ err = fuse2fs_get_next_mapping(ff, handle, startoff, &extent);
+ if (err == EXT2_ET_EXTENT_NOT_FOUND) {
+ fuse2fs_iomap_hole_to_eof(ff, iomap, pos, count, inode);
+ goto out_handle;
+ }
+
+ /*
+ * If the new mapping starts to the right of startoff, there's
+ * a hole from startoff to the start of the new mapping.
+ */
+ if (startoff < extent.e_lblk) {
+ fuse2fs_iomap_hole(ff, iomap,
+ FUSE2FS_FSB_TO_B(ff, startoff),
+ FUSE2FS_FSB_TO_B(ff, extent.e_lblk - startoff));
+ goto out_handle;
+ }
+
+ /*
+ * The new mapping starts at startoff. Something weird
+ * happened in the extent tree lookup, but we found a valid
+ * mapping so we'll run with it.
+ */
+ }
+
+ /* Mapping overlaps startoff, report this. */
+ iomap->dev = FUSE_IOMAP_DEV_NULL;
+ iomap->addr = FUSE2FS_FSB_TO_B(ff, extent.e_pblk);
+ iomap->offset = FUSE2FS_FSB_TO_B(ff, extent.e_lblk);
+ iomap->length = FUSE2FS_FSB_TO_B(ff, extent.e_len);
+ if (extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT)
+ iomap->type = FUSE_IOMAP_TYPE_UNWRITTEN;
+ else
+ iomap->type = FUSE_IOMAP_TYPE_MAPPED;
+
+out_handle:
+ ext2fs_extent_free(handle);
+ return ret;
+}
+
+static int fuse2fs_iomap_begin_indirect(struct fuse2fs *ff, uint64_t ino,
+ struct ext2_inode_large *inode,
+ off_t pos, uint64_t count,
+ uint32_t opflags,
+ struct fuse_file_iomap *iomap)
+{
+ ext2_filsys fs = ff->fs;
+ blk64_t startoff = FUSE2FS_B_TO_FSBT(ff, pos);
+ uint64_t isize = EXT2_I_SIZE(inode);
+ uint64_t real_count = min(count, 131072);
+ const blk64_t endoff = FUSE2FS_B_TO_FSB(ff, pos + real_count);
+ blk64_t startblock;
+ errcode_t err;
+
+ err = ext2fs_bmap2(fs, ino, EXT2_INODE(inode), NULL, 0, startoff, NULL,
+ &startblock);
+ if (err)
+ return translate_error(fs, ino, err);
+
+ iomap->dev = FUSE_IOMAP_DEV_NULL;
+ iomap->offset = FUSE2FS_FSB_TO_B(ff, startoff);
+ iomap->flags |= FUSE_IOMAP_F_MERGED;
+ if (startblock) {
+ iomap->addr = FUSE2FS_FSB_TO_B(ff, startblock);
+ iomap->type = FUSE_IOMAP_TYPE_MAPPED;
+ } else {
+ iomap->addr = FUSE_IOMAP_NULL_ADDR;
+ iomap->type = FUSE_IOMAP_TYPE_HOLE;
+ }
+ iomap->length = fs->blocksize;
+
+ /* See how long the mapping goes for. */
+ for (startoff++; startoff < endoff; startoff++) {
+ blk64_t prev_startblock = startblock;
+
+ err = ext2fs_bmap2(fs, ino, EXT2_INODE(inode), NULL, 0,
+ startoff, NULL, &startblock);
+ if (err)
+ break;
+
+ if (iomap->type == FUSE_IOMAP_TYPE_MAPPED) {
+ if (startblock == prev_startblock + 1)
+ iomap->length += fs->blocksize;
+ else
+ break;
+ } else {
+ if (startblock == 0)
+ iomap->length += fs->blocksize;
+ else
+ break;
+ }
+ }
+
+ /*
+ * If this is a hole that goes beyond EOF, report this as a hole to the
+ * end of the range queried so that FIEMAP doesn't go mad.
+ */
+ if (iomap->type == FUSE_IOMAP_TYPE_HOLE &&
+ iomap->offset + iomap->length >= isize)
+ fuse2fs_iomap_hole_to_eof(ff, iomap, pos, count, inode);
+
+ return 0;
+}
+
+static int fuse2fs_iomap_begin_inline(struct fuse2fs *ff, ext2_ino_t ino,
+ struct ext2_inode_large *inode, off_t pos,
+ uint64_t count, struct fuse_file_iomap *iomap)
+{
+ uint64_t one_fsb = FUSE2FS_FSB_TO_B(ff, 1);
+
+ if (pos >= one_fsb) {
+ fuse2fs_iomap_hole_to_eof(ff, iomap, pos, count, inode);
+ } else {
+ /* ext4 only supports inline data files up to 1 fsb */
+ iomap->dev = FUSE_IOMAP_DEV_NULL;
+ iomap->addr = FUSE_IOMAP_NULL_ADDR;
+ iomap->offset = 0;
+ iomap->length = one_fsb;
+ iomap->type = FUSE_IOMAP_TYPE_INLINE;
+ }
+
+ return 0;
+}
+
+static int fuse2fs_iomap_begin_report(struct fuse2fs *ff, ext2_ino_t ino,
+ struct ext2_inode_large *inode,
+ off_t pos, uint64_t count,
+ uint32_t opflags,
+ struct fuse_file_iomap *read)
+{
+ if (inode->i_flags & EXT4_INLINE_DATA_FL)
+ return fuse2fs_iomap_begin_inline(ff, ino, inode, pos, count,
+ read);
+
+ if (inode->i_flags & EXT4_EXTENTS_FL)
+ return fuse2fs_iomap_begin_extent(ff, ino, inode, pos, count,
+ opflags, read);
+
+ return fuse2fs_iomap_begin_indirect(ff, ino, inode, pos, count,
+ opflags, read);
+}
+
+static int fuse2fs_iomap_begin_read(struct fuse2fs *ff, ext2_ino_t ino,
+ struct ext2_inode_large *inode, off_t pos,
+ uint64_t count, uint32_t opflags,
+ struct fuse_file_iomap *read)
+{
+ return -ENOSYS;
+}
+
+static int fuse2fs_iomap_begin_write(struct fuse2fs *ff, ext2_ino_t ino,
+ struct ext2_inode_large *inode, off_t pos,
+ uint64_t count, uint32_t opflags,
+ struct fuse_file_iomap *read)
+{
+ return -ENOSYS;
+}
+
+static int op_iomap_begin(const char *path, uint64_t nodeid, uint64_t attr_ino,
+ off_t pos, uint64_t count, uint32_t opflags,
+ struct fuse_file_iomap *read,
+ struct fuse_file_iomap *write)
+{
+ struct fuse2fs *ff = fuse2fs_get();
+ struct ext2_inode_large inode;
+ ext2_filsys fs;
+ errcode_t err;
+ int ret = 0;
+
+ FUSE2FS_CHECK_CONTEXT(ff);
+
+ dbg_printf(ff,
+ "%s: path=%s nodeid=%llu attr_ino=%llu pos=0x%llx count=0x%llx opflags=0x%x\n",
+ __func__, path,
+ (unsigned long long)nodeid,
+ (unsigned long long)attr_ino,
+ (unsigned long long)pos,
+ (unsigned long long)count,
+ opflags);
+
+ fs = fuse2fs_start(ff);
+ err = fuse2fs_read_inode(fs, attr_ino, &inode);
+ if (err) {
+ ret = translate_error(fs, attr_ino, err);
+ goto out_unlock;
+ }
+
+ if (opflags & FUSE_IOMAP_OP_REPORT)
+ ret = fuse2fs_iomap_begin_report(ff, attr_ino, &inode, pos,
+ count, opflags, read);
+ else if (fuse_iomap_is_write(opflags))
+ ret = fuse2fs_iomap_begin_write(ff, attr_ino, &inode, pos,
+ count, opflags, read);
+ else
+ ret = fuse2fs_iomap_begin_read(ff, attr_ino, &inode, pos,
+ count, opflags, read);
+ if (ret)
+ goto out_unlock;
+
+ dbg_printf(ff, "%s: nodeid=%llu attr_ino=%llu pos=0x%llx -> addr=0x%llx offset=0x%llx length=0x%llx type=%u\n",
+ __func__,
+ (unsigned long long)nodeid,
+ (unsigned long long)attr_ino,
+ (unsigned long long)pos,
+ (unsigned long long)read->addr,
+ (unsigned long long)read->offset,
+ (unsigned long long)read->length,
+ read->type);
+
+out_unlock:
+ fuse2fs_finish(ff, ret);
+ return ret;
+}
+
+static int op_iomap_end(const char *path, uint64_t nodeid, uint64_t attr_ino,
+ off_t pos, uint64_t count, uint32_t opflags,
+ ssize_t written, const struct fuse_file_iomap *iomap)
+{
+ struct fuse2fs *ff = fuse2fs_get();
+
+ FUSE2FS_CHECK_CONTEXT(ff);
+
+ dbg_printf(ff,
+ "%s: path=%s nodeid=%llu attr_ino=%llu pos=0x%llx count=0x%llx opflags=0x%x written=0x%zx mapflags=0x%x\n",
+ __func__, path,
+ (unsigned long long)nodeid,
+ (unsigned long long)attr_ino,
+ (unsigned long long)pos,
+ (unsigned long long)count,
+ opflags,
+ written,
+ iomap->flags);
+
+ return 0;
+}
+#endif /* HAVE_FUSE_IOMAP */
+
static struct fuse_operations fs_ops = {
.init = op_init,
.destroy = op_destroy,
@@ -4883,6 +5388,10 @@ static struct fuse_operations fs_ops = {
#ifdef SUPPORT_FALLOCATE
.fallocate = op_fallocate,
#endif
+#ifdef HAVE_FUSE_IOMAP
+ .iomap_begin = op_iomap_begin,
+ .iomap_end = op_iomap_end,
+#endif /* HAVE_FUSE_IOMAP */
};
static int get_random_bytes(void *p, size_t sz)
@@ -5106,17 +5615,19 @@ static void fuse2fs_com_err_proc(const char *whoami, errcode_t code,
int main(int argc, char *argv[])
{
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
- struct fuse2fs fctx;
+ struct fuse2fs fctx = {
+ .magic = FUSE2FS_MAGIC,
+ .opstate = F2OP_WRITABLE,
+ .logfd = -1,
+#ifdef HAVE_FUSE_IOMAP
+ .iomap_state = IOMAP_UNKNOWN,
+#endif
+ };
errcode_t err;
FILE *orig_stderr = stderr;
char extra_args[BUFSIZ];
int ret;
- memset(&fctx, 0, sizeof(fctx));
- fctx.magic = FUSE2FS_MAGIC;
- fctx.logfd = -1;
- fctx.opstate = F2OP_WRITABLE;
-
ret = fuse_opt_parse(&args, &fctx, fuse2fs_opts, fuse2fs_opt_proc);
if (ret)
exit(1);
next prev parent reply other threads:[~2025-09-16 0:58 UTC|newest]
Thread overview: 248+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 0:07 [RFC v5] fuse: containerize ext4 for safer operation Darrick J. Wong
2025-09-16 0:18 ` [PATCHSET RFC v5 1/8] fuse: general bug fixes Darrick J. Wong
2025-09-16 0:24 ` [PATCH 1/8] fuse: fix livelock in synchronous file put from fuseblk workers Darrick J. Wong
2025-09-23 10:57 ` Miklos Szeredi
2025-09-16 0:24 ` [PATCH 2/8] fuse: flush pending fuse events before aborting the connection Darrick J. Wong
2025-09-23 11:11 ` Miklos Szeredi
2025-09-23 14:54 ` Darrick J. Wong
2025-09-23 18:56 ` Miklos Szeredi
2025-09-23 20:59 ` Darrick J. Wong
2025-09-23 22:34 ` Darrick J. Wong
2025-09-24 12:04 ` Miklos Szeredi
2025-09-24 17:50 ` Darrick J. Wong
2025-09-24 18:19 ` Miklos Szeredi
2025-09-24 20:54 ` Darrick J. Wong
2025-09-30 10:29 ` Miklos Szeredi
2025-09-30 17:56 ` Darrick J. Wong
2025-09-16 0:24 ` [PATCH 3/8] fuse: capture the unique id of fuse commands being sent Darrick J. Wong
2025-09-23 10:58 ` Miklos Szeredi
2025-09-16 0:25 ` [PATCH 4/8] fuse: signal that a fuse filesystem should exhibit local fs behaviors Darrick J. Wong
2025-09-17 17:18 ` Joanne Koong
2025-09-18 16:52 ` Darrick J. Wong
2025-09-19 9:24 ` Miklos Szeredi
2025-09-19 17:50 ` Darrick J. Wong
2025-09-23 14:57 ` Miklos Szeredi
2025-09-23 20:51 ` Darrick J. Wong
2025-09-24 13:55 ` Miklos Szeredi
2025-09-24 17:31 ` Darrick J. Wong
2025-09-25 19:17 ` Darrick J. Wong
2025-09-16 0:25 ` [PATCH 5/8] fuse: implement file attributes mask for statx Darrick J. Wong
2025-09-16 0:25 ` [PATCH 6/8] fuse: update file mode when updating acls Darrick J. Wong
2025-09-16 0:25 ` [PATCH 7/8] fuse: propagate default and file acls on creation Darrick J. Wong
2025-09-16 6:41 ` Chen Linxuan
2025-09-16 14:48 ` Darrick J. Wong
2025-09-16 0:26 ` [PATCH 8/8] fuse: enable FUSE_SYNCFS for all fuseblk servers Darrick J. Wong
2025-09-23 10:58 ` Miklos Szeredi
2025-09-16 0:18 ` [PATCHSET RFC v5 2/8] iomap: cleanups ahead of adding fuse support Darrick J. Wong
2025-09-16 0:26 ` [PATCH 1/2] iomap: trace iomap_zero_iter zeroing activities Darrick J. Wong
2025-09-16 13:49 ` Christoph Hellwig
2025-09-16 14:49 ` Darrick J. Wong
2025-09-16 0:26 ` [PATCH 2/2] iomap: error out on file IO when there is no inline_data buffer Darrick J. Wong
2025-09-16 13:50 ` Christoph Hellwig
2025-09-16 14:50 ` Darrick J. Wong
2025-09-16 0:18 ` [PATCHSET RFC v5 3/8] fuse: cleanups ahead of adding fuse support Darrick J. Wong
2025-09-16 0:26 ` [PATCH 1/5] fuse: allow synchronous FUSE_INIT Darrick J. Wong
2025-09-17 17:22 ` Joanne Koong
2025-09-18 18:04 ` Darrick J. Wong
2025-09-16 0:27 ` [PATCH 2/5] fuse: move the backing file idr and code into a new source file Darrick J. Wong
2025-09-25 14:11 ` Miklos Szeredi
2025-09-16 0:27 ` [PATCH 3/5] fuse: move the passthrough-specific code back to passthrough.c Darrick J. Wong
2025-09-17 2:47 ` Amir Goldstein
2025-09-18 18:02 ` Darrick J. Wong
2025-09-19 7:34 ` Miklos Szeredi
2025-09-19 9:36 ` Amir Goldstein
2025-09-19 17:43 ` Darrick J. Wong
2025-09-16 0:27 ` [PATCH 4/5] fuse_trace: " Darrick J. Wong
2025-09-16 0:27 ` [PATCH 5/5] fuse: move CREATE_TRACE_POINTS to a separate file Darrick J. Wong
2025-09-25 14:25 ` Miklos Szeredi
2025-09-16 0:19 ` [PATCHSET RFC v5 4/8] fuse: allow servers to use iomap for better file IO performance Darrick J. Wong
2025-09-16 0:28 ` [PATCH 01/28] fuse: implement the basic iomap mechanisms Darrick J. Wong
2025-09-19 22:36 ` Joanne Koong
2025-09-23 20:32 ` Darrick J. Wong
2025-09-23 21:24 ` Joanne Koong
2025-09-23 22:10 ` Darrick J. Wong
2025-09-23 23:08 ` Darrick J. Wong
2025-09-16 0:28 ` [PATCH 02/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:28 ` [PATCH 03/28] fuse: make debugging configurable at runtime Darrick J. Wong
2025-09-16 0:29 ` [PATCH 04/28] fuse: adapt FUSE_DEV_IOC_BACKING_{OPEN,CLOSE} to add new iomap devices Darrick J. Wong
2025-09-17 3:09 ` Amir Goldstein
2025-09-18 18:17 ` Darrick J. Wong
2025-09-18 18:42 ` Amir Goldstein
2025-09-18 19:03 ` Darrick J. Wong
2025-09-19 7:13 ` Miklos Szeredi
2025-09-19 9:54 ` Amir Goldstein
2025-09-19 17:42 ` Darrick J. Wong
2025-09-23 7:10 ` Miklos Szeredi
2025-09-16 0:29 ` [PATCH 05/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:29 ` [PATCH 06/28] fuse: flush events and send FUSE_SYNCFS and FUSE_DESTROY on unmount Darrick J. Wong
2025-09-16 0:29 ` [PATCH 07/28] fuse: create a per-inode flag for toggling iomap Darrick J. Wong
2025-09-16 0:30 ` [PATCH 08/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:30 ` [PATCH 09/28] fuse: isolate the other regular file IO paths from iomap Darrick J. Wong
2025-09-16 0:30 ` [PATCH 10/28] fuse: implement basic iomap reporting such as FIEMAP and SEEK_{DATA,HOLE} Darrick J. Wong
2025-09-16 0:30 ` [PATCH 11/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:31 ` [PATCH 12/28] fuse: implement direct IO with iomap Darrick J. Wong
2025-09-16 0:31 ` [PATCH 13/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:31 ` [PATCH 14/28] fuse: implement buffered " Darrick J. Wong
2025-09-16 0:31 ` [PATCH 15/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:32 ` [PATCH 16/28] fuse: implement large folios for iomap pagecache files Darrick J. Wong
2025-09-16 0:32 ` [PATCH 17/28] fuse: use an unrestricted backing device with iomap pagecache io Darrick J. Wong
2025-09-16 0:32 ` [PATCH 18/28] fuse: advertise support for iomap Darrick J. Wong
2025-09-16 0:32 ` [PATCH 19/28] fuse: query filesystem geometry when using iomap Darrick J. Wong
2025-09-16 0:33 ` [PATCH 20/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:33 ` [PATCH 21/28] fuse: implement fadvise for iomap files Darrick J. Wong
2025-09-16 0:33 ` [PATCH 22/28] fuse: invalidate ranges of block devices being used for iomap Darrick J. Wong
2025-09-16 0:33 ` [PATCH 23/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:34 ` [PATCH 24/28] fuse: implement inline data file IO via iomap Darrick J. Wong
2025-09-16 0:34 ` [PATCH 25/28] fuse_trace: " Darrick J. Wong
2025-09-16 0:34 ` [PATCH 26/28] fuse: allow more statx fields Darrick J. Wong
2025-09-16 0:35 ` [PATCH 27/28] fuse: support atomic writes with iomap Darrick J. Wong
2025-09-16 0:35 ` [PATCH 28/28] fuse: disable direct reclaim for any fuse server that uses iomap Darrick J. Wong
2025-09-16 0:19 ` [PATCHSET RFC v5 5/8] fuse: allow servers to specify root node id Darrick J. Wong
2025-09-16 0:35 ` [PATCH 1/3] fuse: make the root nodeid dynamic Darrick J. Wong
2025-09-16 0:35 ` [PATCH 2/3] fuse_trace: " Darrick J. Wong
2025-09-16 0:36 ` [PATCH 3/3] fuse: allow setting of root nodeid Darrick J. Wong
2025-09-16 0:19 ` [PATCHSET RFC v5 6/8] fuse: handle timestamps and ACLs correctly when iomap is enabled Darrick J. Wong
2025-09-16 0:36 ` [PATCH 1/9] fuse: enable caching of timestamps Darrick J. Wong
2025-09-16 0:36 ` [PATCH 2/9] fuse: force a ctime update after a fileattr_set call when in iomap mode Darrick J. Wong
2025-09-16 0:36 ` [PATCH 3/9] fuse: allow local filesystems to set some VFS iflags Darrick J. Wong
2025-09-16 0:37 ` [PATCH 4/9] fuse_trace: " Darrick J. Wong
2025-09-16 0:37 ` [PATCH 5/9] fuse: cache atime when in iomap mode Darrick J. Wong
2025-09-16 0:37 ` [PATCH 6/9] fuse: let the kernel handle KILL_SUID/KILL_SGID for iomap filesystems Darrick J. Wong
2025-09-16 0:37 ` [PATCH 7/9] fuse_trace: " Darrick J. Wong
2025-09-16 0:38 ` [PATCH 8/9] fuse: update ctime when updating acls on an iomap inode Darrick J. Wong
2025-09-16 0:38 ` [PATCH 9/9] fuse: always cache ACLs when using iomap Darrick J. Wong
2025-09-16 0:19 ` [PATCHSET RFC v5 7/8] fuse: cache iomap mappings for even better file IO performance Darrick J. Wong
2025-09-16 0:38 ` [PATCH 01/10] fuse: cache iomaps Darrick J. Wong
2025-09-16 0:38 ` [PATCH 02/10] fuse_trace: " Darrick J. Wong
2025-09-16 0:39 ` [PATCH 03/10] fuse: use the iomap cache for iomap_begin Darrick J. Wong
2025-09-16 0:39 ` [PATCH 04/10] fuse_trace: " Darrick J. Wong
2025-09-16 0:39 ` [PATCH 05/10] fuse: invalidate iomap cache after file updates Darrick J. Wong
2025-09-16 0:39 ` [PATCH 06/10] fuse_trace: " Darrick J. Wong
2025-09-16 0:40 ` [PATCH 07/10] fuse: enable iomap cache management Darrick J. Wong
2025-09-16 0:40 ` [PATCH 08/10] fuse_trace: " Darrick J. Wong
2025-09-16 0:40 ` [PATCH 09/10] fuse: overlay iomap inode info in struct fuse_inode Darrick J. Wong
2025-09-16 0:41 ` [PATCH 10/10] fuse: enable iomap Darrick J. Wong
2025-09-16 0:20 ` [PATCHSET RFC v5 8/8] fuse: run fuse servers as a contained service Darrick J. Wong
2025-09-16 0:41 ` [PATCH 1/2] fuse: allow privileged mount helpers to pre-approve iomap usage Darrick J. Wong
2025-09-16 0:41 ` [PATCH 2/2] fuse: set iomap backing device block size Darrick J. Wong
2025-09-16 0:20 ` [PATCHSET RFC v5 1/6] libfuse: general bug fixes Darrick J. Wong
2025-09-16 0:41 ` [PATCH 1/1] libfuse: don't put HAVE_STATX in a public header Darrick J. Wong
2025-09-16 14:38 ` Bernd Schubert
2025-09-16 16:16 ` Darrick J. Wong
2025-09-16 0:20 ` [PATCHSET RFC v5 2/6] libfuse: allow servers to use iomap for better file IO performance Darrick J. Wong
2025-09-16 0:42 ` [PATCH 01/18] libfuse: bump kernel and library ABI versions Darrick J. Wong
2025-09-16 0:42 ` [PATCH 02/18] libfuse: add kernel gates for FUSE_IOMAP Darrick J. Wong
2025-09-16 0:42 ` [PATCH 03/18] libfuse: add fuse commands for iomap_begin and end Darrick J. Wong
2025-09-16 0:42 ` [PATCH 04/18] libfuse: add upper level iomap commands Darrick J. Wong
2025-09-16 0:43 ` [PATCH 05/18] libfuse: add a lowlevel notification to add a new device to iomap Darrick J. Wong
2025-09-16 0:43 ` [PATCH 06/18] libfuse: add upper-level iomap add device function Darrick J. Wong
2025-09-16 0:43 ` [PATCH 07/18] libfuse: add iomap ioend low level handler Darrick J. Wong
2025-09-16 0:43 ` [PATCH 08/18] libfuse: add upper level iomap ioend commands Darrick J. Wong
2025-09-16 0:44 ` [PATCH 09/18] libfuse: add a reply function to send FUSE_ATTR_* to the kernel Darrick J. Wong
2025-09-16 0:44 ` [PATCH 10/18] libfuse: connect high level fuse library to fuse_reply_attr_iflags Darrick J. Wong
2025-09-16 0:44 ` [PATCH 11/18] libfuse: support direct I/O through iomap Darrick J. Wong
2025-09-16 0:44 ` [PATCH 12/18] libfuse: don't allow hardlinking of iomap files in the upper level fuse library Darrick J. Wong
2025-09-16 0:45 ` [PATCH 13/18] libfuse: allow discovery of the kernel's iomap capabilities Darrick J. Wong
2025-09-16 0:45 ` [PATCH 14/18] libfuse: add lower level iomap_config implementation Darrick J. Wong
2025-09-16 0:45 ` [PATCH 15/18] libfuse: add upper " Darrick J. Wong
2025-09-16 0:45 ` [PATCH 16/18] libfuse: add low level code to invalidate iomap block device ranges Darrick J. Wong
2025-09-16 0:46 ` [PATCH 17/18] libfuse: add upper-level API to invalidate parts of an iomap block device Darrick J. Wong
2025-09-16 0:46 ` [PATCH 18/18] libfuse: add atomic write support Darrick J. Wong
2025-09-16 0:20 ` [PATCHSET RFC v5 3/6] libfuse: allow servers to specify root node id Darrick J. Wong
2025-09-16 0:46 ` [PATCH 1/1] libfuse: allow root_nodeid mount option Darrick J. Wong
2025-09-16 0:21 ` [PATCHSET RFC v5 4/6] libfuse: implement syncfs Darrick J. Wong
2025-09-16 0:46 ` [PATCH 1/4] libfuse: add strictatime/lazytime mount options Darrick J. Wong
2025-09-16 0:47 ` [PATCH 2/4] libfuse: set sync, immutable, and append when loading files Darrick J. Wong
2025-09-16 0:47 ` [PATCH 3/4] libfuse: wire up FUSE_SYNCFS to the low level library Darrick J. Wong
2025-09-16 0:47 ` [PATCH 4/4] libfuse: add syncfs support to the upper library Darrick J. Wong
2025-09-16 0:21 ` [PATCHSET RFC v5 5/6] libfuse: cache iomap mappings for even better file IO performance Darrick J. Wong
2025-09-16 0:48 ` [PATCH 1/3] libfuse: enable iomap cache management for lowlevel fuse Darrick J. Wong
2025-09-16 0:48 ` [PATCH 2/3] libfuse: add upper-level iomap cache management Darrick J. Wong
2025-09-16 0:48 ` [PATCH 3/3] libfuse: enable iomap Darrick J. Wong
2025-09-16 0:21 ` [PATCHSET RFC v5 6/6] libfuse: run fuse servers as a contained service Darrick J. Wong
2025-09-16 0:48 ` [PATCH 1/4] libfuse: add systemd/inetd socket service mounting helper Darrick J. Wong
2025-09-16 0:49 ` [PATCH 2/4] libfuse: integrate fuse services into mount.fuse3 Darrick J. Wong
2025-09-16 0:49 ` [PATCH 3/4] libfuse: delegate iomap privilege from mount.service to fuse services Darrick J. Wong
2025-09-16 0:49 ` [PATCH 4/4] libfuse: enable setting iomap block device block size Darrick J. Wong
2025-09-16 0:22 ` [PATCHSET RFC v5 2/9] fuse4fs: fork a low level fuse server Darrick J. Wong
2025-09-16 0:50 ` [PATCH 01/21] fuse2fs: separate libfuse3 and fuse2fs detection in configure Darrick J. Wong
2025-09-16 0:51 ` [PATCH 02/21] fuse2fs: start porting fuse2fs to lowlevel libfuse API Darrick J. Wong
2025-09-16 0:51 ` [PATCH 03/21] debian: create new package for fuse4fs Darrick J. Wong
2025-09-16 0:51 ` [PATCH 04/21] fuse4fs: namespace some helpers Darrick J. Wong
2025-09-16 0:51 ` [PATCH 05/21] fuse4fs: convert to low level API Darrick J. Wong
2025-09-16 0:52 ` [PATCH 06/21] libsupport: port the kernel list.h to libsupport Darrick J. Wong
2025-09-16 0:52 ` [PATCH 07/21] libsupport: add a cache Darrick J. Wong
2025-09-16 0:52 ` [PATCH 08/21] cache: disable debugging Darrick J. Wong
2025-09-16 0:53 ` [PATCH 09/21] cache: use modern list iterator macros Darrick J. Wong
2025-09-16 0:53 ` [PATCH 10/21] cache: embed struct cache in the owner Darrick J. Wong
2025-09-16 0:53 ` [PATCH 11/21] cache: pass cache pointer to callbacks Darrick J. Wong
2025-09-16 0:53 ` [PATCH 12/21] cache: pass a private data pointer through cache_walk Darrick J. Wong
2025-09-16 0:54 ` [PATCH 13/21] cache: add a helper to grab a new refcount for a cache_node Darrick J. Wong
2025-09-16 0:54 ` [PATCH 14/21] cache: return results of a cache flush Darrick J. Wong
2025-09-16 0:54 ` [PATCH 15/21] cache: add a "get only if incore" flag to cache_node_get Darrick J. Wong
2025-09-16 0:54 ` [PATCH 16/21] cache: support gradual expansion Darrick J. Wong
2025-09-16 0:55 ` [PATCH 17/21] cache: implement automatic shrinking Darrick J. Wong
2025-09-16 0:55 ` [PATCH 18/21] fuse4fs: add cache to track open files Darrick J. Wong
2025-09-16 0:55 ` [PATCH 19/21] fuse4fs: use the orphaned inode list Darrick J. Wong
2025-09-16 0:55 ` [PATCH 20/21] fuse4fs: implement FUSE_TMPFILE Darrick J. Wong
2025-09-16 0:56 ` [PATCH 21/21] fuse4fs: create incore reverse orphan list Darrick J. Wong
2025-09-16 0:22 ` [PATCHSET RFC v5 3/9] libext2fs: refactoring for fuse2fs iomap support Darrick J. Wong
2025-09-16 0:56 ` [PATCH 01/10] libext2fs: make it possible to extract the fd from an IO manager Darrick J. Wong
2025-09-16 0:56 ` [PATCH 02/10] libext2fs: always fsync the device when flushing the cache Darrick J. Wong
2025-09-16 0:56 ` [PATCH 03/10] libext2fs: always fsync the device when closing the unix IO manager Darrick J. Wong
2025-09-16 0:57 ` [PATCH 04/10] libext2fs: only fsync the unix fd if we wrote to the device Darrick J. Wong
2025-09-16 0:57 ` [PATCH 05/10] libext2fs: invalidate cached blocks when freeing them Darrick J. Wong
2025-09-16 0:57 ` [PATCH 06/10] libext2fs: only flush affected blocks in unix_write_byte Darrick J. Wong
2025-09-16 0:57 ` [PATCH 07/10] libext2fs: allow unix_write_byte when the write would be aligned Darrick J. Wong
2025-09-16 0:58 ` [PATCH 08/10] libext2fs: allow clients to ask to write full superblocks Darrick J. Wong
2025-09-16 0:58 ` [PATCH 09/10] libext2fs: allow callers to disallow I/O to file data blocks Darrick J. Wong
2025-09-16 0:58 ` [PATCH 10/10] libext2fs: add posix advisory locking to the unix IO manager Darrick J. Wong
2025-10-08 22:09 ` Darrick J. Wong
2025-09-16 0:22 ` [PATCHSET RFC v5 4/9] fuse2fs: use fuse iomap data paths for better file I/O performance Darrick J. Wong
2025-09-16 0:58 ` Darrick J. Wong [this message]
2025-09-16 0:59 ` [PATCH 02/17] fuse2fs: add iomap= mount option Darrick J. Wong
2025-09-16 0:59 ` [PATCH 03/17] fuse2fs: implement iomap configuration Darrick J. Wong
2025-09-16 0:59 ` [PATCH 04/17] fuse2fs: register block devices for use with iomap Darrick J. Wong
2025-09-16 1:00 ` [PATCH 05/17] fuse2fs: implement directio file reads Darrick J. Wong
2025-09-16 1:00 ` [PATCH 06/17] fuse2fs: add extent dump function for debugging Darrick J. Wong
2025-09-16 1:00 ` [PATCH 07/17] fuse2fs: implement direct write support Darrick J. Wong
2025-09-16 1:00 ` [PATCH 08/17] fuse2fs: turn on iomap for pagecache IO Darrick J. Wong
2025-09-16 1:01 ` [PATCH 09/17] fuse2fs: don't zero bytes in punch hole Darrick J. Wong
2025-09-16 1:01 ` [PATCH 10/17] fuse2fs: don't do file data block IO when iomap is enabled Darrick J. Wong
2025-09-16 1:01 ` [PATCH 11/17] fuse2fs: avoid fuseblk mode if fuse-iomap support is likely Darrick J. Wong
2025-09-16 1:01 ` [PATCH 12/17] fuse2fs: enable file IO to inline data files Darrick J. Wong
2025-09-16 1:02 ` [PATCH 13/17] fuse2fs: set iomap-related inode flags Darrick J. Wong
2025-09-16 1:02 ` [PATCH 14/17] fuse2fs: configure block device block size Darrick J. Wong
2025-09-16 1:02 ` [PATCH 15/17] fuse4fs: separate invalidation Darrick J. Wong
2025-09-16 1:02 ` [PATCH 16/17] fuse2fs: implement statx Darrick J. Wong
2025-09-16 1:03 ` [PATCH 17/17] fuse2fs: enable atomic writes Darrick J. Wong
2025-09-16 0:22 ` [PATCHSET RFC v5 5/9] fuse4fs: specify the root node id Darrick J. Wong
2025-09-16 1:03 ` [PATCH 1/1] fuse4fs: don't use inode number translation when possible Darrick J. Wong
2025-09-16 0:23 ` [PATCHSET RFC v5 6/9] fuse2fs: handle timestamps and ACLs correctly when iomap is enabled Darrick J. Wong
2025-09-16 1:03 ` [PATCH 01/10] fuse2fs: add strictatime/lazytime mount options Darrick J. Wong
2025-09-16 1:03 ` [PATCH 02/10] fuse2fs: skip permission checking on utimens when iomap is enabled Darrick J. Wong
2025-09-16 1:04 ` [PATCH 03/10] fuse2fs: let the kernel tell us about acl/mode updates Darrick J. Wong
2025-09-16 1:04 ` [PATCH 04/10] fuse2fs: better debugging for file mode updates Darrick J. Wong
2025-09-16 1:04 ` [PATCH 05/10] fuse2fs: debug timestamp updates Darrick J. Wong
2025-09-16 1:05 ` [PATCH 06/10] fuse2fs: use coarse timestamps for iomap mode Darrick J. Wong
2025-09-16 1:05 ` [PATCH 07/10] fuse2fs: add tracing for retrieving timestamps Darrick J. Wong
2025-09-16 1:05 ` [PATCH 08/10] fuse2fs: enable syncfs Darrick J. Wong
2025-09-16 1:05 ` [PATCH 09/10] fuse2fs: skip the gdt write in op_destroy if syncfs is working Darrick J. Wong
2025-09-16 1:06 ` [PATCH 10/10] fuse2fs: set sync, immutable, and append at file load time Darrick J. Wong
2025-09-16 0:23 ` [PATCHSET RFC v5 7/9] fuse2fs: cache iomap mappings for even better file IO performance Darrick J. Wong
2025-09-16 1:06 ` [PATCH 1/3] fuse2fs: enable caching of iomaps Darrick J. Wong
2025-09-16 1:06 ` [PATCH 2/3] fuse2fs: be smarter about caching iomaps Darrick J. Wong
2025-09-16 1:06 ` [PATCH 3/3] fuse2fs: enable iomap Darrick J. Wong
2025-09-16 0:23 ` [PATCHSET RFC v5 8/9] fuse2fs: improve block and inode caching Darrick J. Wong
2025-09-16 1:07 ` [PATCH 1/6] libsupport: add caching IO manager Darrick J. Wong
2025-09-16 1:07 ` [PATCH 2/6] iocache: add the actual buffer cache Darrick J. Wong
2025-09-16 1:07 ` [PATCH 3/6] iocache: bump buffer mru priority every 50 accesses Darrick J. Wong
2025-09-16 1:07 ` [PATCH 4/6] fuse2fs: enable caching IO manager Darrick J. Wong
2025-09-16 1:08 ` [PATCH 5/6] fuse2fs: increase inode cache size Darrick J. Wong
2025-09-16 1:08 ` [PATCH 6/6] libext2fs: improve caching for inodes Darrick J. Wong
2025-09-16 0:24 ` [PATCHSET RFC v5 9/9] fuse4fs: run servers as a contained service Darrick J. Wong
2025-09-16 1:08 ` [PATCH 1/4] libext2fs: fix MMP code to work with unixfd IO manager Darrick J. Wong
2025-09-16 1:08 ` [PATCH 2/4] fuse4fs: enable safe service mode Darrick J. Wong
2025-09-16 1:09 ` [PATCH 3/4] fuse4fs: set proc title when in fuse " Darrick J. Wong
2025-09-16 1:09 ` [PATCH 4/4] fuse4fs: set iomap backing device blocksize Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
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
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=175798161736.390496.6190342206145513213.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=John@groves.net \
--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 \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).