From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v5 01/11] xfs: track active state of allocation btree cursors
Date: Mon, 30 Sep 2019 22:35:28 -0700 [thread overview]
Message-ID: <20191001053528.GF13108@magnolia> (raw)
In-Reply-To: <20190927171802.45582-2-bfoster@redhat.com>
On Fri, Sep 27, 2019 at 01:17:52PM -0400, Brian Foster wrote:
> The upcoming allocation algorithm update searches multiple
> allocation btree cursors concurrently. As such, it requires an
> active state to track when a particular cursor should continue
> searching. While active state will be modified based on higher level
> logic, we can define base functionality based on the result of
> allocation btree lookups.
>
> Define an active flag in the private area of the btree cursor.
> Update it based on the result of lookups in the existing allocation
> btree helpers. Finally, provide a new helper to query the current
> state.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
Looks good to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> fs/xfs/libxfs/xfs_alloc.c | 24 +++++++++++++++++++++---
> fs/xfs/libxfs/xfs_alloc_btree.c | 1 +
> fs/xfs/libxfs/xfs_btree.h | 3 +++
> 3 files changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index 533b04aaf6f6..0ecc142c833b 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -146,9 +146,13 @@ xfs_alloc_lookup_eq(
> xfs_extlen_t len, /* length of extent */
> int *stat) /* success/failure */
> {
> + int error;
> +
> cur->bc_rec.a.ar_startblock = bno;
> cur->bc_rec.a.ar_blockcount = len;
> - return xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat);
> + error = xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat);
> + cur->bc_private.a.priv.abt.active = (*stat == 1);
> + return error;
> }
>
> /*
> @@ -162,9 +166,13 @@ xfs_alloc_lookup_ge(
> xfs_extlen_t len, /* length of extent */
> int *stat) /* success/failure */
> {
> + int error;
> +
> cur->bc_rec.a.ar_startblock = bno;
> cur->bc_rec.a.ar_blockcount = len;
> - return xfs_btree_lookup(cur, XFS_LOOKUP_GE, stat);
> + error = xfs_btree_lookup(cur, XFS_LOOKUP_GE, stat);
> + cur->bc_private.a.priv.abt.active = (*stat == 1);
> + return error;
> }
>
> /*
> @@ -178,9 +186,19 @@ xfs_alloc_lookup_le(
> xfs_extlen_t len, /* length of extent */
> int *stat) /* success/failure */
> {
> + int error;
> cur->bc_rec.a.ar_startblock = bno;
> cur->bc_rec.a.ar_blockcount = len;
> - return xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat);
> + error = xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat);
> + cur->bc_private.a.priv.abt.active = (*stat == 1);
> + return error;
> +}
> +
> +static inline bool
> +xfs_alloc_cur_active(
> + struct xfs_btree_cur *cur)
> +{
> + return cur && cur->bc_private.a.priv.abt.active;
> }
>
> /*
> diff --git a/fs/xfs/libxfs/xfs_alloc_btree.c b/fs/xfs/libxfs/xfs_alloc_btree.c
> index 2a94543857a1..279694d73e4e 100644
> --- a/fs/xfs/libxfs/xfs_alloc_btree.c
> +++ b/fs/xfs/libxfs/xfs_alloc_btree.c
> @@ -507,6 +507,7 @@ xfs_allocbt_init_cursor(
>
> cur->bc_private.a.agbp = agbp;
> cur->bc_private.a.agno = agno;
> + cur->bc_private.a.priv.abt.active = false;
>
> if (xfs_sb_version_hascrc(&mp->m_sb))
> cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
> diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
> index ced1e65d1483..b4e3ec1d7ff9 100644
> --- a/fs/xfs/libxfs/xfs_btree.h
> +++ b/fs/xfs/libxfs/xfs_btree.h
> @@ -183,6 +183,9 @@ union xfs_btree_cur_private {
> unsigned long nr_ops; /* # record updates */
> int shape_changes; /* # of extent splits */
> } refc;
> + struct {
> + bool active; /* allocation cursor state */
> + } abt;
> };
>
> /*
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-10-01 5:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-27 17:17 [PATCH v5 00/11] xfs: rework near mode extent allocation Brian Foster
2019-09-27 17:17 ` [PATCH v5 01/11] xfs: track active state of allocation btree cursors Brian Foster
2019-09-30 8:11 ` Christoph Hellwig
2019-09-30 12:17 ` Brian Foster
2019-10-01 6:36 ` Christoph Hellwig
2019-10-01 10:30 ` Brian Foster
2019-10-01 5:35 ` Darrick J. Wong [this message]
2019-09-27 17:17 ` [PATCH v5 02/11] xfs: introduce allocation cursor data structure Brian Foster
2019-09-27 17:17 ` [PATCH v5 03/11] xfs: track allocation busy state in allocation cursor Brian Foster
2019-09-27 17:17 ` [PATCH v5 04/11] xfs: track best extent from cntbt lastblock scan in alloc cursor Brian Foster
2019-10-04 22:35 ` Darrick J. Wong
2019-09-27 17:17 ` [PATCH v5 05/11] xfs: refactor cntbt lastblock scan best extent logic into helper Brian Foster
2019-10-04 22:40 ` Darrick J. Wong
2019-09-27 17:17 ` [PATCH v5 06/11] xfs: reuse best extent tracking logic for bnobt scan Brian Foster
2019-10-04 22:45 ` Darrick J. Wong
2019-09-27 17:17 ` [PATCH v5 07/11] xfs: refactor allocation tree fixup code Brian Foster
2019-09-27 17:17 ` [PATCH v5 08/11] xfs: refactor and reuse best extent scanning logic Brian Foster
2019-10-04 22:59 ` Darrick J. Wong
2019-09-27 17:18 ` [PATCH v5 09/11] xfs: refactor near mode alloc bnobt scan into separate function Brian Foster
2019-09-27 17:18 ` [PATCH v5 10/11] xfs: factor out tree fixup logic into helper Brian Foster
2019-09-27 17:18 ` [PATCH v5 11/11] xfs: optimize near mode bnobt scans with concurrent cntbt lookups Brian Foster
2019-10-04 23:20 ` Darrick J. Wong
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=20191001053528.GF13108@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).