[GIT PULL] vfs iomap fixes

Christian Brauner posted 1 patch 3 weeks, 2 days ago
fs/dax.c               | 45 ++++++++++++++++++++++++++++-----------------
fs/iomap/buffered-io.c | 17 +----------------
fs/xfs/xfs_iomap.c     |  2 +-
include/linux/iomap.h  | 19 +++++++++++++++++++
4 files changed, 49 insertions(+), 34 deletions(-)
[GIT PULL] vfs iomap fixes
Posted by Christian Brauner 3 weeks, 2 days ago
Hey Linus,

/* Summary */
This contains fixes for iomap to prevent data corruption bugs in the
fallocate unshare range implementation of fsdax and a small cleanup to
turn iomap_want_unshare_iter() into an inline function.

/* Testing */

gcc version 14.2.0 (Debian 14.2.0-3)
Debian clang version 16.0.6 (27+b1)

All patches are based on v6.11-rc2 and have been sitting in linux-next.
No build failures or warnings were observed.

/* Conflicts */

There will be a minor merge conflict with mainline due to some xfs
changes that came in. After conflict resolution mainline should looke like this:

diff --cc include/linux/iomap.h
index d0420e962ffd,0198f36e521e..000000000000
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@@ -256,20 -256,25 +256,39 @@@ static inline const struct iomap *iomap
        return &i->iomap;
  }

 +/*
 + * Return the file offset for the first unchanged block after a short write.
 + *
 + * If nothing was written, round @pos down to point at the first block in
 + * the range, else round up to include the partially written block.
 + */
 +static inline loff_t iomap_last_written_block(struct inode *inode, loff_t pos,
 +              ssize_t written)
 +{
 +      if (unlikely(!written))
 +              return round_down(pos, i_blocksize(inode));
 +      return round_up(pos + written, i_blocksize(inode));
 +}
 +
+ /*
+  * Check if the range needs to be unshared for a FALLOC_FL_UNSHARE_RANGE
+  * operation.
+  *
+  * Don't bother with blocks that are not shared to start with; or mappings that
+  * cannot be shared, such as inline data, delalloc reservations, holes or
+  * unwritten extents.
+  *
+  * Note that we use srcmap directly instead of iomap_iter_srcmap as unsharing
+  * requires providing a separate source map, and the presence of one is a good
+  * indicator that unsharing is needed, unlike IOMAP_F_SHARED which can be set
+  * for any data that goes into the COW fork for XFS.
+  */
+ static inline bool iomap_want_unshare_iter(const struct iomap_iter *iter)
+ {
+       return (iter->iomap.flags & IOMAP_F_SHARED) &&
+               iter->srcmap.type == IOMAP_MAPPED;
+ }
+
  ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
                const struct iomap_ops *ops, void *private);
  int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops);

The following changes since commit 8cf0b93919e13d1e8d4466eb4080a4c4d9d66d7b:

  Linux 6.12-rc2 (2024-10-06 15:32:27 -0700)

are available in the Git repository at:

  git@gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.12-rc6.iomap

for you to fetch changes up to 6db388585e486c0261aeef55f8bc63a9b45756c0:

  iomap: turn iomap_want_unshare_iter into an inline function (2024-10-21 17:01:01 +0200)

(Note, I'm still not fully recovered so currently with a little reduced
 activity.)
Please consider pulling these changes from the signed vfs-6.12-rc6.iomap tag.

Thanks!
Christian

----------------------------------------------------------------
vfs-6.12-rc6.iomap

----------------------------------------------------------------
Christian Brauner (1):
      Merge patch series "fsdax/xfs: unshare range fixes for 6.12"

Christoph Hellwig (1):
      iomap: turn iomap_want_unshare_iter into an inline function

Darrick J. Wong (4):
      xfs: don't allocate COW extents when unsharing a hole
      iomap: share iomap_unshare_iter predicate code with fsdax
      fsdax: remove zeroing code from dax_unshare_iter
      fsdax: dax_unshare_iter needs to copy entire blocks

 fs/dax.c               | 45 ++++++++++++++++++++++++++++-----------------
 fs/iomap/buffered-io.c | 17 +----------------
 fs/xfs/xfs_iomap.c     |  2 +-
 include/linux/iomap.h  | 19 +++++++++++++++++++
 4 files changed, 49 insertions(+), 34 deletions(-)
Re: [GIT PULL] vfs iomap fixes
Posted by pr-tracker-bot@kernel.org 3 weeks, 2 days ago
The pull request you sent on Fri,  1 Nov 2024 13:43:33 +0100:

> git@gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.12-rc6.iomap

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/17fa6a5f93fcd5dd936e07aee61c014d401df4ae

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html