From: Darrick J. Wong <djwong@xxxxxxxxxx> When iomap is in use for the pagecache, it will take care of zeroing the unaligned parts of punched out regions so we don't have to do it ourselves. Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> --- misc/fuse2fs.c | 9 +++++++++ misc/fuse4fs.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 895addcbc59e04..dcf002f380b843 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -576,6 +576,7 @@ static inline int fuse2fs_iomap_enabled(const struct fuse2fs *ff) } #else # define fuse2fs_iomap_enabled(...) (0) +# define fuse2fs_iomap_enabled(...) (0) #endif static inline void fuse2fs_dump_extents(struct fuse2fs *ff, ext2_ino_t ino, @@ -4857,6 +4858,10 @@ static errcode_t clean_block_middle(struct fuse2fs *ff, ext2_ino_t ino, int retflags; errcode_t err; + /* the kernel does this for us in iomap mode */ + if (fuse2fs_iomap_enabled(ff)) + return 0; + if (!*buf) { err = ext2fs_get_mem(fs->blocksize, buf); if (err) @@ -4893,6 +4898,10 @@ static errcode_t clean_block_edge(struct fuse2fs *ff, ext2_ino_t ino, off_t residue; errcode_t err; + /* the kernel does this for us in iomap mode */ + if (fuse2fs_iomap_enabled(ff)) + return 0; + residue = FUSE2FS_OFF_IN_FSB(ff, offset); if (residue == 0) return 0; diff --git a/misc/fuse4fs.c b/misc/fuse4fs.c index 2373c5a371e2b0..3082c23e398adf 100644 --- a/misc/fuse4fs.c +++ b/misc/fuse4fs.c @@ -5265,6 +5265,10 @@ static errcode_t fuse4fs_zero_middle(struct fuse4fs *ff, ext2_ino_t ino, int retflags; errcode_t err; + /* the kernel does this for us in iomap mode */ + if (fuse4fs_iomap_enabled(ff)) + return 0; + if (!*buf) { err = ext2fs_get_mem(fs->blocksize, buf); if (err) @@ -5301,6 +5305,10 @@ static errcode_t fuse4fs_zero_edge(struct fuse4fs *ff, ext2_ino_t ino, off_t residue; errcode_t err; + /* the kernel does this for us in iomap mode */ + if (fuse4fs_iomap_enabled(ff)) + return 0; + residue = FUSE4FS_OFF_IN_FSB(ff, offset); if (residue == 0) return 0;