Skip to content

Commit 99fb6b7

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
xfs: upgrade the extent counters in xfs_reflink_end_cow_extent later
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. Fixes: 4f86bb4 ("xfs: Conditionally upgrade existing inodes to use large extent counters") Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
1 parent cc3c92e commit 99fb6b7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/xfs/xfs_reflink.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,6 @@ xfs_reflink_end_cow_extent(
732732
xfs_ilock(ip, XFS_ILOCK_EXCL);
733733
xfs_trans_ijoin(tp, ip, 0);
734734

735-
error = xfs_iext_count_may_overflow(ip, XFS_DATA_FORK,
736-
XFS_IEXT_REFLINK_END_COW_CNT);
737-
if (error == -EFBIG)
738-
error = xfs_iext_count_upgrade(tp, ip,
739-
XFS_IEXT_REFLINK_END_COW_CNT);
740-
if (error)
741-
goto out_cancel;
742-
743735
/*
744736
* In case of racing, overlapping AIO writes no COW extents might be
745737
* left by the time I/O completes for the loser of the race. In that
@@ -768,6 +760,14 @@ xfs_reflink_end_cow_extent(
768760
del = got;
769761
xfs_trim_extent(&del, *offset_fsb, end_fsb - *offset_fsb);
770762

763+
error = xfs_iext_count_may_overflow(ip, XFS_DATA_FORK,
764+
XFS_IEXT_REFLINK_END_COW_CNT);
765+
if (error == -EFBIG)
766+
error = xfs_iext_count_upgrade(tp, ip,
767+
XFS_IEXT_REFLINK_END_COW_CNT);
768+
if (error)
769+
goto out_cancel;
770+
771771
/* Grab the corresponding mapping in the data fork. */
772772
nmaps = 1;
773773
error = xfs_bmapi_read(ip, del.br_startoff, del.br_blockcount, &data,

0 commit comments

Comments
 (0)