[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250313180332.GY2803749@frogsfrogsfrogs>
Date: Thu, 13 Mar 2025 11:03:32 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: John Garry <john.g.garry@...cle.com>
Cc: brauner@...nel.org, cem@...nel.org, dchinner@...hat.com, hch@....de,
linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, ojaswin@...ux.ibm.com,
ritesh.list@...il.com, martin.petersen@...cle.com, tytso@....edu,
linux-ext4@...r.kernel.org
Subject: Re: [PATCH v6 09/13] xfs: add XFS_REFLINK_ALLOC_EXTSZALIGN
On Thu, Mar 13, 2025 at 05:13:06PM +0000, John Garry wrote:
> Add a flag for the xfs_reflink_allocate_cow() API to allow the caller
> indirectly set XFS_BMAPI_EXTSZALIGN.
>
> Signed-off-by: John Garry <john.g.garry@...cle.com>
Looks pretty straightforward to me...
Reviewed-by: "Darrick J. Wong" <djwong@...nel.org>
--D
> ---
> fs/xfs/xfs_reflink.c | 8 ++++++--
> fs/xfs/xfs_reflink.h | 2 ++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 690b1eefeb0e..9a419af89949 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -444,6 +444,11 @@ xfs_reflink_fill_cow_hole(
> int nimaps;
> int error;
> bool found;
> + uint32_t bmapi_flags = XFS_BMAPI_COWFORK |
> + XFS_BMAPI_PREALLOC;
> +
> + if (flags & XFS_REFLINK_ALLOC_EXTSZALIGN)
> + bmapi_flags |= XFS_BMAPI_EXTSZALIGN;
>
> resaligned = xfs_aligned_fsb_count(imap->br_startoff,
> imap->br_blockcount, xfs_get_cowextsz_hint(ip));
> @@ -477,8 +482,7 @@ xfs_reflink_fill_cow_hole(
> /* Allocate the entire reservation as unwritten blocks. */
> nimaps = 1;
> error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount,
> - XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC, 0, cmap,
> - &nimaps);
> + bmapi_flags, 0, cmap, &nimaps);
> if (error)
> goto out_trans_cancel;
>
> diff --git a/fs/xfs/xfs_reflink.h b/fs/xfs/xfs_reflink.h
> index f4115836064b..0ab1857074e5 100644
> --- a/fs/xfs/xfs_reflink.h
> +++ b/fs/xfs/xfs_reflink.h
> @@ -13,6 +13,8 @@
> #define XFS_REFLINK_CONVERT_UNWRITTEN (1u << 0)
> /* force a new COW mapping to be allocated */
> #define XFS_REFLINK_FORCE_COW (1u << 1)
> +/* request block allocations aligned to extszhint */
> +#define XFS_REFLINK_ALLOC_EXTSZALIGN (1u << 2)
>
> /*
> * Check whether it is safe to free COW fork blocks from an inode. It is unsafe
> --
> 2.31.1
>
>
Powered by blists - more mailing lists