Message ID | 20250313171310.1886394-10-john.g.garry@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | large atomic writes for xfs with CoW | expand |
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@oracle.com> Looks pretty straightforward to me... Reviewed-by: "Darrick J. Wong" <djwong@kernel.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 > >
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
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@oracle.com> --- fs/xfs/xfs_reflink.c | 8 ++++++-- fs/xfs/xfs_reflink.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)