From: Chandan Babu R <chandan.babu@oracle.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/5] xfs: reduce the size of struct xfs_extent_free_item
Date: Wed, 20 Oct 2021 16:16:12 +0530 [thread overview]
Message-ID: <87y26ogeiz.fsf@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <163466954919.2235671.801665171595051864.stgit@magnolia>
On 20 Oct 2021 at 00:22, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> We only use EFIs to free metadata blocks -- not regular data/attr fork
> extents. Remove all the fields that we never use, for a net reduction
> of 16 bytes.
>
Looks good to me.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/libxfs/xfs_alloc.c | 25 ++++++++++++++++---------
> fs/xfs/libxfs/xfs_alloc.h | 8 ++++++--
> fs/xfs/xfs_extfree_item.c | 13 ++++++++++---
> 3 files changed, 32 insertions(+), 14 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index 9bc1a03a8167..353e53b892e6 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -2462,12 +2462,11 @@ xfs_defer_agfl_block(
> ASSERT(xfs_extfree_item_cache != NULL);
> ASSERT(oinfo != NULL);
>
> - new = kmem_cache_alloc(xfs_extfree_item_cache,
> + new = kmem_cache_zalloc(xfs_extfree_item_cache,
> GFP_KERNEL | __GFP_NOFAIL);
> new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno);
> new->xefi_blockcount = 1;
> - new->xefi_oinfo = *oinfo;
> - new->xefi_skip_discard = false;
> + new->xefi_owner = oinfo->oi_owner;
>
> trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1);
>
> @@ -2505,15 +2504,23 @@ __xfs_free_extent_later(
> #endif
> ASSERT(xfs_extfree_item_cache != NULL);
>
> - new = kmem_cache_alloc(xfs_extfree_item_cache,
> + new = kmem_cache_zalloc(xfs_extfree_item_cache,
> GFP_KERNEL | __GFP_NOFAIL);
> new->xefi_startblock = bno;
> new->xefi_blockcount = (xfs_extlen_t)len;
> - if (oinfo)
> - new->xefi_oinfo = *oinfo;
> - else
> - new->xefi_oinfo = XFS_RMAP_OINFO_SKIP_UPDATE;
> - new->xefi_skip_discard = skip_discard;
> + if (skip_discard)
> + new->xefi_flags |= XFS_EFI_SKIP_DISCARD;
> + if (oinfo) {
> + ASSERT(oinfo->oi_offset == 0);
> +
> + if (oinfo->oi_flags & XFS_OWNER_INFO_ATTR_FORK)
> + new->xefi_flags |= XFS_EFI_ATTR_FORK;
> + if (oinfo->oi_flags & XFS_OWNER_INFO_BMBT_BLOCK)
> + new->xefi_flags |= XFS_EFI_BMBT_BLOCK;
> + new->xefi_owner = oinfo->oi_owner;
> + } else {
> + new->xefi_owner = XFS_RMAP_OWN_NULL;
> + }
> trace_xfs_bmap_free_defer(tp->t_mountp,
> XFS_FSB_TO_AGNO(tp->t_mountp, bno), 0,
> XFS_FSB_TO_AGBNO(tp->t_mountp, bno), len);
> diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h
> index b61aeb6fbe32..1c14a0b1abea 100644
> --- a/fs/xfs/libxfs/xfs_alloc.h
> +++ b/fs/xfs/libxfs/xfs_alloc.h
> @@ -258,12 +258,16 @@ void __xfs_free_extent_later(struct xfs_trans *tp, xfs_fsblock_t bno,
> */
> struct xfs_extent_free_item {
> struct list_head xefi_list;
> + uint64_t xefi_owner;
> xfs_fsblock_t xefi_startblock;/* starting fs block number */
> xfs_extlen_t xefi_blockcount;/* number of blocks in extent */
> - bool xefi_skip_discard;
> - struct xfs_owner_info xefi_oinfo; /* extent owner */
> + unsigned int xefi_flags;
> };
>
> +#define XFS_EFI_SKIP_DISCARD (1U << 0) /* don't issue discard */
> +#define XFS_EFI_ATTR_FORK (1U << 1) /* freeing attr fork block */
> +#define XFS_EFI_BMBT_BLOCK (1U << 2) /* freeing bmap btree block */
> +
> static inline void
> xfs_free_extent_later(
> struct xfs_trans *tp,
> diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
> index eb378e345f13..47ef9c9c5c17 100644
> --- a/fs/xfs/xfs_extfree_item.c
> +++ b/fs/xfs/xfs_extfree_item.c
> @@ -474,14 +474,20 @@ xfs_extent_free_finish_item(
> struct list_head *item,
> struct xfs_btree_cur **state)
> {
> + struct xfs_owner_info oinfo = { };
> struct xfs_extent_free_item *free;
> int error;
>
> free = container_of(item, struct xfs_extent_free_item, xefi_list);
> + oinfo.oi_owner = free->xefi_owner;
> + if (free->xefi_flags & XFS_EFI_ATTR_FORK)
> + oinfo.oi_flags |= XFS_OWNER_INFO_ATTR_FORK;
> + if (free->xefi_flags & XFS_EFI_BMBT_BLOCK)
> + oinfo.oi_flags |= XFS_OWNER_INFO_BMBT_BLOCK;
> error = xfs_trans_free_extent(tp, EFD_ITEM(done),
> free->xefi_startblock,
> free->xefi_blockcount,
> - &free->xefi_oinfo, free->xefi_skip_discard);
> + &oinfo, free->xefi_flags & XFS_EFI_SKIP_DISCARD);
> kmem_cache_free(xfs_extfree_item_cache, free);
> return error;
> }
> @@ -525,6 +531,7 @@ xfs_agfl_free_finish_item(
> struct list_head *item,
> struct xfs_btree_cur **state)
> {
> + struct xfs_owner_info oinfo = { };
> struct xfs_mount *mp = tp->t_mountp;
> struct xfs_efd_log_item *efdp = EFD_ITEM(done);
> struct xfs_extent_free_item *free;
> @@ -539,13 +546,13 @@ xfs_agfl_free_finish_item(
> ASSERT(free->xefi_blockcount == 1);
> agno = XFS_FSB_TO_AGNO(mp, free->xefi_startblock);
> agbno = XFS_FSB_TO_AGBNO(mp, free->xefi_startblock);
> + oinfo.oi_owner = free->xefi_owner;
>
> trace_xfs_agfl_free_deferred(mp, agno, 0, agbno, free->xefi_blockcount);
>
> error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
> if (!error)
> - error = xfs_free_agfl_block(tp, agno, agbno, agbp,
> - &free->xefi_oinfo);
> + error = xfs_free_agfl_block(tp, agno, agbno, agbp, &oinfo);
>
> /*
> * Mark the transaction dirty, even on error. This ensures the
--
chandan
next prev parent reply other threads:[~2021-10-20 10:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 18:52 [PATCHSET 0/5] xfs: use slab caches for deferred log items Darrick J. Wong
2021-10-19 18:52 ` [PATCH 1/5] xfs: compact deferred intent item structures Darrick J. Wong
2021-10-20 10:44 ` Chandan Babu R
2021-10-19 18:52 ` [PATCH 2/5] xfs: create slab caches for frequently-used deferred items Darrick J. Wong
2021-10-20 10:45 ` Chandan Babu R
2021-10-21 1:56 ` Darrick J. Wong
2021-10-19 18:52 ` [PATCH 3/5] xfs: rename xfs_bmap_add_free to xfs_free_extent_later Darrick J. Wong
2021-10-20 10:45 ` Chandan Babu R
2021-10-19 18:52 ` [PATCH 4/5] xfs: reduce the size of struct xfs_extent_free_item Darrick J. Wong
2021-10-20 10:46 ` Chandan Babu R [this message]
2021-10-19 18:52 ` [PATCH 5/5] xfs: remove unused parameter from refcount code Darrick J. Wong
2021-10-20 10:46 ` Chandan Babu R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y26ogeiz.fsf@debian-BULLSEYE-live-builder-AMD64 \
--to=chandan.babu@oracle.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox