From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 10/11] xfs: use a xfs_btree_cur for the ->finish_cleanup state
Date: Thu, 30 Apr 2020 07:04:40 -0400 [thread overview]
Message-ID: <20200430110440.GJ5349@bfoster> (raw)
In-Reply-To: <20200429150511.2191150-11-hch@lst.de>
On Wed, Apr 29, 2020 at 05:05:10PM +0200, Christoph Hellwig wrote:
> Given how XFS is all based around btrees it doesn't make much sense
> to offer a totally generic state when we can just use the btree cursor.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/libxfs/xfs_defer.c | 2 +-
> fs/xfs/libxfs/xfs_defer.h | 6 ++++--
> fs/xfs/xfs_bmap_item.c | 2 +-
> fs/xfs/xfs_extfree_item.c | 4 ++--
> fs/xfs/xfs_refcount_item.c | 24 +++++-------------------
> fs/xfs/xfs_rmap_item.c | 27 ++++++---------------------
> 6 files changed, 19 insertions(+), 46 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
> index 5f37f42cda67b..1172fbf072d84 100644
> --- a/fs/xfs/libxfs/xfs_defer.c
> +++ b/fs/xfs/libxfs/xfs_defer.c
> @@ -361,7 +361,7 @@ xfs_defer_finish_one(
> struct xfs_defer_pending *dfp)
> {
> const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type];
> - void *state = NULL;
> + struct xfs_btree_cur *state = NULL;
> struct list_head *li, *n;
> int error;
>
> diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h
> index a86c890e63d20..f2b65981bace4 100644
> --- a/fs/xfs/libxfs/xfs_defer.h
> +++ b/fs/xfs/libxfs/xfs_defer.h
> @@ -6,6 +6,7 @@
> #ifndef __XFS_DEFER_H__
> #define __XFS_DEFER_H__
>
> +struct xfs_btree_cur;
> struct xfs_defer_op_type;
>
> /*
> @@ -49,8 +50,9 @@ struct xfs_defer_op_type {
> struct xfs_log_item *(*create_done)(struct xfs_trans *tp,
> struct xfs_log_item *intent, unsigned int count);
> int (*finish_item)(struct xfs_trans *tp, struct xfs_log_item *done,
> - struct list_head *item, void **state);
> - void (*finish_cleanup)(struct xfs_trans *, void *, int);
> + struct list_head *item, struct xfs_btree_cur **state);
> + void (*finish_cleanup)(struct xfs_trans *tp,
> + struct xfs_btree_cur *state, int error);
> void (*cancel_item)(struct list_head *);
> unsigned int max_items;
> };
> diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
> index feadd44a67e4b..7768fb2b71357 100644
> --- a/fs/xfs/xfs_bmap_item.c
> +++ b/fs/xfs/xfs_bmap_item.c
> @@ -367,7 +367,7 @@ xfs_bmap_update_finish_item(
> struct xfs_trans *tp,
> struct xfs_log_item *done,
> struct list_head *item,
> - void **state)
> + struct xfs_btree_cur **state)
> {
> struct xfs_bmap_intent *bmap;
> xfs_filblks_t count;
> diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
> index 633628f70e128..c8cde4122a0fe 100644
> --- a/fs/xfs/xfs_extfree_item.c
> +++ b/fs/xfs/xfs_extfree_item.c
> @@ -474,7 +474,7 @@ xfs_extent_free_finish_item(
> struct xfs_trans *tp,
> struct xfs_log_item *done,
> struct list_head *item,
> - void **state)
> + struct xfs_btree_cur **state)
> {
> struct xfs_extent_free_item *free;
> int error;
> @@ -525,7 +525,7 @@ xfs_agfl_free_finish_item(
> struct xfs_trans *tp,
> struct xfs_log_item *done,
> struct list_head *item,
> - void **state)
> + struct xfs_btree_cur **state)
> {
> struct xfs_mount *mp = tp->t_mountp;
> struct xfs_efd_log_item *efdp = EFD_ITEM(done);
> diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
> index f1c2e559a7ae7..0316eab2fc351 100644
> --- a/fs/xfs/xfs_refcount_item.c
> +++ b/fs/xfs/xfs_refcount_item.c
> @@ -366,7 +366,7 @@ xfs_refcount_update_finish_item(
> struct xfs_trans *tp,
> struct xfs_log_item *done,
> struct list_head *item,
> - void **state)
> + struct xfs_btree_cur **state)
> {
> struct xfs_refcount_intent *refc;
> xfs_fsblock_t new_fsb;
> @@ -375,11 +375,9 @@ xfs_refcount_update_finish_item(
>
> refc = container_of(item, struct xfs_refcount_intent, ri_list);
> error = xfs_trans_log_finish_refcount_update(tp, CUD_ITEM(done),
> - refc->ri_type,
> - refc->ri_startblock,
> - refc->ri_blockcount,
> - &new_fsb, &new_aglen,
> - (struct xfs_btree_cur **)state);
> + refc->ri_type, refc->ri_startblock, refc->ri_blockcount,
> + &new_fsb, &new_aglen, state);
> +
> /* Did we run out of reservation? Requeue what we didn't finish. */
> if (!error && new_aglen > 0) {
> ASSERT(refc->ri_type == XFS_REFCOUNT_INCREASE ||
> @@ -392,18 +390,6 @@ xfs_refcount_update_finish_item(
> return error;
> }
>
> -/* Clean up after processing deferred refcounts. */
> -STATIC void
> -xfs_refcount_update_finish_cleanup(
> - struct xfs_trans *tp,
> - void *state,
> - int error)
> -{
> - struct xfs_btree_cur *rcur = state;
> -
> - xfs_refcount_finish_one_cleanup(tp, rcur, error);
> -}
> -
> /* Abort all pending CUIs. */
> STATIC void
> xfs_refcount_update_abort_intent(
> @@ -429,7 +415,7 @@ const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
> .abort_intent = xfs_refcount_update_abort_intent,
> .create_done = xfs_refcount_update_create_done,
> .finish_item = xfs_refcount_update_finish_item,
> - .finish_cleanup = xfs_refcount_update_finish_cleanup,
> + .finish_cleanup = xfs_refcount_finish_one_cleanup,
> .cancel_item = xfs_refcount_update_cancel_item,
> };
>
> diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
> index f6a2a388e5ac9..e3bba2aec8682 100644
> --- a/fs/xfs/xfs_rmap_item.c
> +++ b/fs/xfs/xfs_rmap_item.c
> @@ -418,36 +418,21 @@ xfs_rmap_update_finish_item(
> struct xfs_trans *tp,
> struct xfs_log_item *done,
> struct list_head *item,
> - void **state)
> + struct xfs_btree_cur **state)
> {
> struct xfs_rmap_intent *rmap;
> int error;
>
> rmap = container_of(item, struct xfs_rmap_intent, ri_list);
> error = xfs_trans_log_finish_rmap_update(tp, RUD_ITEM(done),
> - rmap->ri_type,
> - rmap->ri_owner, rmap->ri_whichfork,
> - rmap->ri_bmap.br_startoff,
> - rmap->ri_bmap.br_startblock,
> - rmap->ri_bmap.br_blockcount,
> - rmap->ri_bmap.br_state,
> - (struct xfs_btree_cur **)state);
> + rmap->ri_type, rmap->ri_owner, rmap->ri_whichfork,
> + rmap->ri_bmap.br_startoff, rmap->ri_bmap.br_startblock,
> + rmap->ri_bmap.br_blockcount, rmap->ri_bmap.br_state,
> + state);
> kmem_free(rmap);
> return error;
> }
>
> -/* Clean up after processing deferred rmaps. */
> -STATIC void
> -xfs_rmap_update_finish_cleanup(
> - struct xfs_trans *tp,
> - void *state,
> - int error)
> -{
> - struct xfs_btree_cur *rcur = state;
> -
> - xfs_rmap_finish_one_cleanup(tp, rcur, error);
> -}
> -
> /* Abort all pending RUIs. */
> STATIC void
> xfs_rmap_update_abort_intent(
> @@ -473,7 +458,7 @@ const struct xfs_defer_op_type xfs_rmap_update_defer_type = {
> .abort_intent = xfs_rmap_update_abort_intent,
> .create_done = xfs_rmap_update_create_done,
> .finish_item = xfs_rmap_update_finish_item,
> - .finish_cleanup = xfs_rmap_update_finish_cleanup,
> + .finish_cleanup = xfs_rmap_finish_one_cleanup,
> .cancel_item = xfs_rmap_update_cancel_item,
> };
>
> --
> 2.26.2
>
next prev parent reply other threads:[~2020-04-30 11:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 15:05 deferred operations cleanup Christoph Hellwig
2020-04-29 15:05 ` [PATCH 01/11] xfs: remove the xfs_efi_log_item_t typedef Christoph Hellwig
2020-04-30 11:02 ` Brian Foster
2020-04-29 15:05 ` [PATCH 02/11] xfs: remove the xfs_efd_log_item_t typedef Christoph Hellwig
2020-04-30 11:03 ` Brian Foster
2020-04-29 15:05 ` [PATCH 03/11] xfs: remove the xfs_inode_log_item_t typedef Christoph Hellwig
2020-04-30 11:03 ` Brian Foster
2020-04-29 15:05 ` [PATCH 04/11] xfs: factor out a xfs_defer_create_intent helper Christoph Hellwig
2020-04-30 11:03 ` Brian Foster
2020-04-29 15:05 ` [PATCH 05/11] xfs: merge the ->log_item defer op into ->create_intent Christoph Hellwig
2020-04-30 11:04 ` Brian Foster
2020-04-29 15:05 ` [PATCH 06/11] xfs: merge the ->diff_items " Christoph Hellwig
2020-04-30 11:04 ` Brian Foster
2020-04-29 15:05 ` [PATCH 07/11] xfs: turn dfp_intent into a xfs_log_item Christoph Hellwig
2020-04-30 11:04 ` Brian Foster
2020-04-29 15:05 ` [PATCH 08/11] xfs: refactor xfs_defer_finish_noroll Christoph Hellwig
2020-04-30 11:04 ` Brian Foster
2020-04-29 15:05 ` [PATCH 09/11] xfs: turn dfp_done into a xfs_log_item Christoph Hellwig
2020-04-30 11:04 ` Brian Foster
2020-04-29 15:05 ` [PATCH 10/11] xfs: use a xfs_btree_cur for the ->finish_cleanup state Christoph Hellwig
2020-04-30 11:04 ` Brian Foster [this message]
2020-04-29 15:05 ` [PATCH 11/11] xfs: spell out the parameter name for ->cancel_item Christoph Hellwig
2020-04-30 11:04 ` Brian Foster
2020-04-30 15:35 ` deferred operations cleanup 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=20200430110440.GJ5349@bfoster \
--to=bfoster@redhat.com \
--cc=hch@lst.de \
--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).