From: "Darrick J. Wong" <djwong@kernel.org>
To: Long Li <leo.lilong@huawei.com>
Cc: linux-xfs@vger.kernel.org, chandanbabu@kernel.org, hch@lst.de
Subject: Re: [PATCH 5/7] xfs: recreate work items when recovering intent items
Date: Thu, 30 Nov 2023 09:19:05 -0800 [thread overview]
Message-ID: <20231130171905.GJ361584@frogsfrogsfrogs> (raw)
In-Reply-To: <20231130131315.GA1772751@ceph-admin>
On Thu, Nov 30, 2023 at 09:13:15PM +0800, Long Li wrote:
> On Tue, Nov 28, 2023 at 12:26:57PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Recreate work items for each xfs_defer_pending object when we are
> > recovering intent items.
> >
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> > fs/xfs/libxfs/xfs_defer.h | 9 ++++
> > fs/xfs/xfs_attr_item.c | 94 +++++++++++++++++++++----------------
> > fs/xfs/xfs_bmap_item.c | 56 ++++++++++++++--------
> > fs/xfs/xfs_extfree_item.c | 50 ++++++++++++-------
> > fs/xfs/xfs_refcount_item.c | 61 +++++++++++-------------
> > fs/xfs/xfs_rmap_item.c | 113 ++++++++++++++++++++++++--------------------
> > 6 files changed, 221 insertions(+), 162 deletions(-)
> >
> >
> > diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h
> > index 3c923a728323..ee1e76d3f7e8 100644
> > --- a/fs/xfs/libxfs/xfs_defer.h
> > +++ b/fs/xfs/libxfs/xfs_defer.h
> > @@ -130,6 +130,15 @@ struct xfs_defer_pending *xfs_defer_start_recovery(struct xfs_log_item *lip,
> > void xfs_defer_cancel_recovery(struct xfs_mount *mp,
> > struct xfs_defer_pending *dfp);
> >
> > +static inline void
> > +xfs_defer_recover_work_item(
> > + struct xfs_defer_pending *dfp,
> > + struct list_head *work)
> > +{
> > + list_add_tail(work, &dfp->dfp_work);
> > + dfp->dfp_count++;
> > +}
> > +
> > int __init xfs_defer_init_item_caches(void);
> > void xfs_defer_destroy_item_caches(void);
> >
> > diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
> > index 82775e9537df..fbc88325848a 100644
> > --- a/fs/xfs/xfs_attr_item.c
> > +++ b/fs/xfs/xfs_attr_item.c
> > @@ -539,47 +539,22 @@ xfs_attri_validate(
> > return xfs_verify_ino(mp, attrp->alfi_ino);
> > }
> >
> > -/*
> > - * Process an attr intent item that was recovered from the log. We need to
> > - * delete the attr that it describes.
> > - */
> > -STATIC int
> > -xfs_attri_item_recover(
> > +static inline struct xfs_attr_intent *
> > +xfs_attri_recover_work(
> > + struct xfs_mount *mp,
> > struct xfs_defer_pending *dfp,
> > - struct list_head *capture_list)
> > + struct xfs_attri_log_format *attrp,
> > + struct xfs_inode *ip,
> > + struct xfs_attri_log_nameval *nv)
> > {
> > - struct xfs_log_item *lip = dfp->dfp_intent;
> > - struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip);
> > struct xfs_attr_intent *attr;
> > - struct xfs_mount *mp = lip->li_log->l_mp;
> > - struct xfs_inode *ip;
> > struct xfs_da_args *args;
> > - struct xfs_trans *tp;
> > - struct xfs_trans_res resv;
> > - struct xfs_attri_log_format *attrp;
> > - struct xfs_attri_log_nameval *nv = attrip->attri_nameval;
> > - int error;
> > - int total;
> > - int local;
> > - struct xfs_attrd_log_item *done_item = NULL;
> > -
> > - /*
> > - * First check the validity of the attr described by the ATTRI. If any
> > - * are bad, then assume that all are bad and just toss the ATTRI.
> > - */
> > - attrp = &attrip->attri_format;
> > - if (!xfs_attri_validate(mp, attrp) ||
> > - !xfs_attr_namecheck(nv->name.i_addr, nv->name.i_len))
> > - return -EFSCORRUPTED;
> > -
> > - error = xlog_recover_iget(mp, attrp->alfi_ino, &ip);
> > - if (error)
> > - return error;
> >
> > attr = kmem_zalloc(sizeof(struct xfs_attr_intent) +
> > sizeof(struct xfs_da_args), KM_NOFS);
> > args = (struct xfs_da_args *)(attr + 1);
> >
> > + INIT_LIST_HEAD(&attr->xattri_list);
> > attr->xattri_da_args = args;
> > attr->xattri_op_flags = attrp->alfi_op_flags &
> > XFS_ATTRI_OP_FLAGS_TYPE_MASK;
> > @@ -607,6 +582,8 @@ xfs_attri_item_recover(
> > switch (attr->xattri_op_flags) {
> > case XFS_ATTRI_OP_FLAGS_SET:
> > case XFS_ATTRI_OP_FLAGS_REPLACE:
> > + int local;
> > +
> > args->value = nv->value.i_addr;
> > args->valuelen = nv->value.i_len;
> > args->total = xfs_attr_calc_size(args, &local);
>
> When I compile the kernel with this set of patches, I get the following error:
>
> fs/xfs/xfs_attr_item.c: In function ‘xfs_attri_recover_work’:
> fs/xfs/xfs_attr_item.c:585:3: error: a label can only be part of a statement and a declaration is not a statement
> 585 | int local;
> | ^~~
Yeah, the build bots complained about my ham-handed attempt to reduce
variable scope as well. Oddly, gcc 12.2 doesn't seem to mind it. That
error message is puzzling.
--D
> Thanks,
> Long Li
>
>
next prev parent reply other threads:[~2023-11-30 17:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 20:26 [PATCHSET RFC 0/7] xfs: log intent item recovery should reconstruct defer work state Darrick J. Wong
2023-11-28 20:26 ` [PATCH 1/7] xfs: don't leak recovered attri intent items Darrick J. Wong
2023-11-30 7:34 ` Christoph Hellwig
2023-11-30 17:02 ` Darrick J. Wong
2023-12-04 4:50 ` Christoph Hellwig
2023-11-28 20:26 ` [PATCH 2/7] xfs: use xfs_defer_pending objects to recover " Darrick J. Wong
2023-11-30 7:53 ` Christoph Hellwig
2023-11-30 17:14 ` Darrick J. Wong
2023-12-04 4:50 ` Christoph Hellwig
2023-11-28 20:26 ` [PATCH 3/7] xfs: pass the xfs_defer_pending object to iop_recover Darrick J. Wong
2023-11-30 7:53 ` Christoph Hellwig
2023-11-28 20:26 ` [PATCH 4/7] xfs: transfer recovered intent item ownership in ->iop_recover Darrick J. Wong
2023-11-30 7:55 ` Christoph Hellwig
2023-11-28 20:26 ` [PATCH 5/7] xfs: recreate work items when recovering intent items Darrick J. Wong
2023-11-30 8:06 ` Christoph Hellwig
2023-11-30 17:36 ` Darrick J. Wong
2023-11-30 13:13 ` Long Li
2023-11-30 17:19 ` Darrick J. Wong [this message]
2023-11-28 20:27 ` [PATCH 6/7] xfs: use xfs_defer_finish_one to finish recovered work items Darrick J. Wong
2023-11-30 8:10 ` Christoph Hellwig
2023-11-30 17:59 ` Darrick J. Wong
2023-11-28 20:27 ` [PATCH 7/7] xfs: move ->iop_recover to xfs_defer_op_type Darrick J. Wong
2023-11-30 8:11 ` Christoph Hellwig
2023-11-30 12:06 ` [PATCHSET RFC 0/7] xfs: log intent item recovery should reconstruct defer work state Long Li
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=20231130171905.GJ361584@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=chandanbabu@kernel.org \
--cc=hch@lst.de \
--cc=leo.lilong@huawei.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