diff mbox series

[v2,02/10] xfs: allow xfs_bmapi_convert_delalloc() to pass NULL seq

Message ID 20240315125354.2480344-3-yi.zhang@huaweicloud.com (mailing list archive)
State New
Headers show
Series xfs/iomap: fix non-atomic clone operation and don't update size when zeroing range post eof | expand

Commit Message

Zhang Yi March 15, 2024, 12:53 p.m. UTC
From: Zhang Yi <yi.zhang@huawei.com>

xfs_bmapi_convert_delalloc() always pass out ifp->if_seq now, make it
support not passing out this value if caller doesn't care about it.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
---
 fs/xfs/libxfs/xfs_bmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig March 18, 2024, 1:28 a.m. UTC | #1
The patch looks good to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>

But maybe I'd reword the commit message a bit, i.e.:

xfs: make the seq argument to xfs_bmapi_convert_delalloc optional

Allow callers to pass a NULLL seq argument if they don't care about
the fork sequence number.
Zhang Yi March 18, 2024, 6:36 a.m. UTC | #2
On 2024/3/18 9:28, Christoph Hellwig wrote:
> The patch looks good to me:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> But maybe I'd reword the commit message a bit, i.e.:
> 
> xfs: make the seq argument to xfs_bmapi_convert_delalloc optional
> 
> Allow callers to pass a NULLL seq argument if they don't care about
> the fork sequence number.
> 

Okay, that's clearer.

Thanks,
Yi.
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index f362345467fa..07dc35de8ce5 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -4574,7 +4574,8 @@  xfs_bmapi_convert_delalloc(
 	if (!isnullstartblock(bma.got.br_startblock)) {
 		xfs_bmbt_to_iomap(ip, iomap, &bma.got, 0, flags,
 				xfs_iomap_inode_sequence(ip, flags));
-		*seq = READ_ONCE(ifp->if_seq);
+		if (seq)
+			*seq = READ_ONCE(ifp->if_seq);
 		goto out_trans_cancel;
 	}
 
@@ -4623,7 +4624,8 @@  xfs_bmapi_convert_delalloc(
 	ASSERT(!isnullstartblock(bma.got.br_startblock));
 	xfs_bmbt_to_iomap(ip, iomap, &bma.got, 0, flags,
 				xfs_iomap_inode_sequence(ip, flags));
-	*seq = READ_ONCE(ifp->if_seq);
+	if (seq)
+		*seq = READ_ONCE(ifp->if_seq);
 
 	if (whichfork == XFS_COW_FORK)
 		xfs_refcount_alloc_cow_extent(tp, bma.blkno, bma.length);