Message ID | 20241211085636.1380516-14-hch@lst.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/43] xfs: constify feature checks | expand |
On Wed, Dec 11, 2024 at 09:54:38AM +0100, Christoph Hellwig wrote: > The zone allocator wants to be able to remove a delalloc mapping in the > COW fork while keeping the block reservation. To support that pass the > blags argument down to xfs_bmap_del_extent_delay and support the bflags > XFS_BMAPI_REMAP flag to keep the reservation. Is REMAP the only bmapi flag that will be valid here? --D > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > fs/xfs/libxfs/xfs_bmap.c | 10 +++++++--- > fs/xfs/libxfs/xfs_bmap.h | 2 +- > fs/xfs/xfs_bmap_util.c | 2 +- > fs/xfs/xfs_reflink.c | 2 +- > 4 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c > index 861945a5fce3..512f1ceca47f 100644 > --- a/fs/xfs/libxfs/xfs_bmap.c > +++ b/fs/xfs/libxfs/xfs_bmap.c > @@ -4666,7 +4666,8 @@ xfs_bmap_del_extent_delay( > int whichfork, > struct xfs_iext_cursor *icur, > struct xfs_bmbt_irec *got, > - struct xfs_bmbt_irec *del) > + struct xfs_bmbt_irec *del, > + uint32_t bflags) /* bmapi flags */ > { > struct xfs_mount *mp = ip->i_mount; > struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); > @@ -4786,7 +4787,9 @@ xfs_bmap_del_extent_delay( > da_diff = da_old - da_new; > fdblocks = da_diff; > > - if (isrt) > + if (bflags & XFS_BMAPI_REMAP) > + ; > + else if (isrt) > xfs_add_frextents(mp, xfs_blen_to_rtbxlen(mp, del->br_blockcount)); > else > fdblocks += del->br_blockcount; > @@ -5388,7 +5391,8 @@ __xfs_bunmapi( > > delete: > if (wasdel) { > - xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, &del); > + xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, > + &del, flags); > } else { > error = xfs_bmap_del_extent_real(ip, tp, &icur, cur, > &del, &tmp_logflags, whichfork, > diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h > index 4d48087fd3a8..b4d9c6e0f3f9 100644 > --- a/fs/xfs/libxfs/xfs_bmap.h > +++ b/fs/xfs/libxfs/xfs_bmap.h > @@ -204,7 +204,7 @@ int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip, > xfs_extnum_t nexts, int *done); > void xfs_bmap_del_extent_delay(struct xfs_inode *ip, int whichfork, > struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got, > - struct xfs_bmbt_irec *del); > + struct xfs_bmbt_irec *del, uint32_t bflags); > void xfs_bmap_del_extent_cow(struct xfs_inode *ip, > struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got, > struct xfs_bmbt_irec *del); > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c > index 0836fea2d6d8..c623688e457c 100644 > --- a/fs/xfs/xfs_bmap_util.c > +++ b/fs/xfs/xfs_bmap_util.c > @@ -467,7 +467,7 @@ xfs_bmap_punch_delalloc_range( > continue; > } > > - xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, &del); > + xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, &del, 0); > if (!xfs_iext_get_extent(ifp, &icur, &got)) > break; > } > diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c > index 3e778e077d09..b7dba5ad2f34 100644 > --- a/fs/xfs/xfs_reflink.c > +++ b/fs/xfs/xfs_reflink.c > @@ -651,7 +651,7 @@ xfs_reflink_cancel_cow_blocks( > > if (isnullstartblock(del.br_startblock)) { > xfs_bmap_del_extent_delay(ip, XFS_COW_FORK, &icur, &got, > - &del); > + &del, 0); > } else if (del.br_state == XFS_EXT_UNWRITTEN || cancel_real) { > ASSERT((*tpp)->t_highest_agno == NULLAGNUMBER); > > -- > 2.45.2 > >
On Thu, Dec 12, 2024 at 01:47:20PM -0800, Darrick J. Wong wrote: > On Wed, Dec 11, 2024 at 09:54:38AM +0100, Christoph Hellwig wrote: > > The zone allocator wants to be able to remove a delalloc mapping in the > > COW fork while keeping the block reservation. To support that pass the > > blags argument down to xfs_bmap_del_extent_delay and support the > > bflags > > > XFS_BMAPI_REMAP flag to keep the reservation. > > Is REMAP the only bmapi flag that will be valid here? Yes. I'll add an assert.
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 861945a5fce3..512f1ceca47f 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -4666,7 +4666,8 @@ xfs_bmap_del_extent_delay( int whichfork, struct xfs_iext_cursor *icur, struct xfs_bmbt_irec *got, - struct xfs_bmbt_irec *del) + struct xfs_bmbt_irec *del, + uint32_t bflags) /* bmapi flags */ { struct xfs_mount *mp = ip->i_mount; struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); @@ -4786,7 +4787,9 @@ xfs_bmap_del_extent_delay( da_diff = da_old - da_new; fdblocks = da_diff; - if (isrt) + if (bflags & XFS_BMAPI_REMAP) + ; + else if (isrt) xfs_add_frextents(mp, xfs_blen_to_rtbxlen(mp, del->br_blockcount)); else fdblocks += del->br_blockcount; @@ -5388,7 +5391,8 @@ __xfs_bunmapi( delete: if (wasdel) { - xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, &del); + xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, + &del, flags); } else { error = xfs_bmap_del_extent_real(ip, tp, &icur, cur, &del, &tmp_logflags, whichfork, diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h index 4d48087fd3a8..b4d9c6e0f3f9 100644 --- a/fs/xfs/libxfs/xfs_bmap.h +++ b/fs/xfs/libxfs/xfs_bmap.h @@ -204,7 +204,7 @@ int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip, xfs_extnum_t nexts, int *done); void xfs_bmap_del_extent_delay(struct xfs_inode *ip, int whichfork, struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got, - struct xfs_bmbt_irec *del); + struct xfs_bmbt_irec *del, uint32_t bflags); void xfs_bmap_del_extent_cow(struct xfs_inode *ip, struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got, struct xfs_bmbt_irec *del); diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 0836fea2d6d8..c623688e457c 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -467,7 +467,7 @@ xfs_bmap_punch_delalloc_range( continue; } - xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, &del); + xfs_bmap_del_extent_delay(ip, whichfork, &icur, &got, &del, 0); if (!xfs_iext_get_extent(ifp, &icur, &got)) break; } diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 3e778e077d09..b7dba5ad2f34 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -651,7 +651,7 @@ xfs_reflink_cancel_cow_blocks( if (isnullstartblock(del.br_startblock)) { xfs_bmap_del_extent_delay(ip, XFS_COW_FORK, &icur, &got, - &del); + &del, 0); } else if (del.br_state == XFS_EXT_UNWRITTEN || cancel_real) { ASSERT((*tpp)->t_highest_agno == NULLAGNUMBER);
The zone allocator wants to be able to remove a delalloc mapping in the COW fork while keeping the block reservation. To support that pass the blags argument down to xfs_bmap_del_extent_delay and support the XFS_BMAPI_REMAP flag to keep the reservation. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/libxfs/xfs_bmap.c | 10 +++++++--- fs/xfs/libxfs/xfs_bmap.h | 2 +- fs/xfs/xfs_bmap_util.c | 2 +- fs/xfs/xfs_reflink.c | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-)