mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christian Brauner <brauner@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [GIT PULL] vfs iomap fixes
Date: Fri,  1 Nov 2024 13:43:33 +0100	[thread overview]
Message-ID: <20241101-vfs-iomap-fixes-6ef0e93508fe@brauner> (raw)

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(-)

             reply	other threads:[~2024-11-01 12:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 12:43 Christian Brauner [this message]
2024-11-01 17:48 ` pr-tracker-bot

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=20241101-vfs-iomap-fixes-6ef0e93508fe@brauner \
    --to=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®