From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Chandan Babu R <chandan.babu@oracle.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/8] xfs: upgrade the extent counters in xfs_reflink_end_cow_extent later
Date: Mon, 29 Apr 2024 08:26:52 -0700 [thread overview]
Message-ID: <20240429152652.GV360919@frogsfrogsfrogs> (raw)
In-Reply-To: <20240429044917.1504566-2-hch@lst.de>
On Mon, Apr 29, 2024 at 06:49:10AM +0200, Christoph Hellwig wrote:
> Defer the extent counter size upgrade until we know we're going to
> modify the extent mapping. This also defers dirtying the transaction
> and will allow us safely back out later in the function in later
> changes.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/xfs_reflink.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 7da0e8f961d351..9ce37d366534c3 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -751,14 +751,6 @@ xfs_reflink_end_cow_extent(
> xfs_ilock(ip, XFS_ILOCK_EXCL);
> xfs_trans_ijoin(tp, ip, 0);
>
> - error = xfs_iext_count_may_overflow(ip, XFS_DATA_FORK,
> - XFS_IEXT_REFLINK_END_COW_CNT);
> - if (error == -EFBIG)
> - error = xfs_iext_count_upgrade(tp, ip,
> - XFS_IEXT_REFLINK_END_COW_CNT);
> - if (error)
> - goto out_cancel;
> -
> /*
> * In case of racing, overlapping AIO writes no COW extents might be
> * left by the time I/O completes for the loser of the race. In that
I think this is actually a bug fix. If an xfs_iext_count_upgrade
dirties the transaction and then xfs_iext_lookup_extent cancels the
transaction due to the overlapping AIO race, the _trans_cancel shuts
down the fs, right?
Fixes: 4f86bb4b66c9 ("xfs: Conditionally upgrade existing inodes to use large extent counters")
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> @@ -787,6 +779,14 @@ xfs_reflink_end_cow_extent(
> del = got;
> xfs_trim_extent(&del, *offset_fsb, end_fsb - *offset_fsb);
>
> + error = xfs_iext_count_may_overflow(ip, XFS_DATA_FORK,
> + XFS_IEXT_REFLINK_END_COW_CNT);
> + if (error == -EFBIG)
> + error = xfs_iext_count_upgrade(tp, ip,
> + XFS_IEXT_REFLINK_END_COW_CNT);
> + if (error)
> + goto out_cancel;
> +
> /* Grab the corresponding mapping in the data fork. */
> nmaps = 1;
> error = xfs_bmapi_read(ip, del.br_startoff, del.br_blockcount, &data,
> --
> 2.39.2
>
>
next prev parent reply other threads:[~2024-04-29 15:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-29 4:49 optimize COW end I/O remapping v2 Christoph Hellwig
2024-04-29 4:49 ` [PATCH 1/8] xfs: upgrade the extent counters in xfs_reflink_end_cow_extent later Christoph Hellwig
2024-04-29 15:26 ` Darrick J. Wong [this message]
2024-04-29 17:16 ` Christoph Hellwig
2024-04-29 4:49 ` [PATCH 2/8] xfs: remove a racy if_bytes check in xfs_reflink_end_cow_extent Christoph Hellwig
2024-04-29 15:27 ` Darrick J. Wong
2024-04-29 17:17 ` Christoph Hellwig
2024-04-29 4:49 ` [PATCH 3/8] xfs: consolidate the xfs_quota_reserve_blkres definitions Christoph Hellwig
2024-04-29 4:49 ` [PATCH 4/8] xfs: xfs_quota_unreserve_blkres can't fail Christoph Hellwig
2024-04-29 15:29 ` Darrick J. Wong
2024-04-29 4:49 ` [PATCH 5/8] xfs: simplify iext overflow checking and upgrade Christoph Hellwig
2024-04-29 15:32 ` Darrick J. Wong
2024-04-29 4:49 ` [PATCH 6/8] xfs: lift XREP_MAX_ITRUNCATE_EFIS out of the scrub code Christoph Hellwig
2024-04-29 4:49 ` [PATCH 7/8] xfs: optimize extent remapping in xfs_reflink_end_cow_extent Christoph Hellwig
2024-04-29 15:43 ` Darrick J. Wong
2024-04-30 9:38 ` Christoph Hellwig
2024-04-29 4:49 ` [PATCH 8/8] xfs: rename the del variable " Christoph Hellwig
2024-04-29 15:33 ` Darrick J. Wong
2024-04-29 17:18 ` Christoph Hellwig
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=20240429152652.GV360919@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=chandan.babu@oracle.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.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