From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 6/3] libxfs: factor common xfs_trans_bjoin code
Date: Mon, 20 May 2019 16:12:27 -0700 [thread overview]
Message-ID: <20190520231227.GK5335@magnolia> (raw)
In-Reply-To: <467b059a-e99c-a2dc-5c63-606212e5505f@redhat.com>
On Mon, May 20, 2019 at 05:58:29PM -0500, Eric Sandeen wrote:
> On 5/20/19 5:56 PM, Darrick J. Wong wrote:
> > On Thu, May 16, 2019 at 03:39:49PM -0500, Eric Sandeen wrote:
> >> Most of xfs_trans_bjoin is duplicated in xfs_trans_get_buf_map,
> >> xfs_trans_getsb and xfs_trans_read_buf_map. Add a new
> >> _xfs_trans_bjoin which can be called by all three functions.
> >>
> >> Source kernel commit: d7e84f413726876c0ec66bbf90770f69841f7663
> >>
> >> Signed-off-by: Christoph Hellwig <hch@lst.de>
> >> Reviewed-by: Dave Chinner <david@fromorbit.com>
> >> Signed-off-by: Alex Elder <aelder@sgi.com>
> >> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> >> ---
> >> libxfs/trans.c | 53 +++++++++++++++++++++++++++++++++++++-------------
> >> 1 file changed, 39 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/libxfs/trans.c b/libxfs/trans.c
> >> index f3c28fa7..f78222fd 100644
> >> --- a/libxfs/trans.c
> >> +++ b/libxfs/trans.c
> >> @@ -537,19 +537,50 @@ xfs_trans_binval(
> >> tp->t_flags |= XFS_TRANS_DIRTY;
> >> }
> >>
> >> -void
> >> -xfs_trans_bjoin(
> >> - xfs_trans_t *tp,
> >> - xfs_buf_t *bp)
> >> +/*
> >> + * Add the locked buffer to the transaction.
> >> + *
> >> + * The buffer must be locked, and it cannot be associated with any
> >> + * transaction.
> >> + *
> >> + * If the buffer does not yet have a buf log item associated with it,
> >> + * then allocate one for it. Then add the buf item to the transaction.
> >> + */
> >> +STATIC void
> >> +_xfs_trans_bjoin(
> >> + struct xfs_trans *tp,
> >> + struct xfs_buf *bp,
> >> + int reset_recur)
> >
> > bool?
>
> If you fix it in the kernel I'll merge it to xfsprogs ;)
LOL, ok.
--D
> >> {
> >> - xfs_buf_log_item_t *bip;
> >> + struct xfs_buf_log_item *bip;
> >>
> >> ASSERT(bp->b_transp == NULL);
> >>
> >> + /*
> >> + * The xfs_buf_log_item pointer is stored in b_log_item. If
> >> + * it doesn't have one yet, then allocate one and initialize it.
> >> + * The checks to see if one is there are in xfs_buf_item_init().
> >> + */
> >> xfs_buf_item_init(bp, tp->t_mountp);
> >> bip = bp->b_log_item;
> >> + if (reset_recur)
> >> + bip->bli_recur = 0;
> >> +
> >> + /*
> >> + * Attach the item to the transaction so we can find it in
> >> + * xfs_trans_get_buf() and friends.
> >> + */
> >> xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
> >
> > Kill typedef here ^^^^^^?
>
> ditto.
>
> Point of all this is to match the kernel for easier future syncups.
>
> (oh wait, actually, this is fixed in a later patch, getting rid of the dumb
> cast altogether)
>
> -Eric
>
> > --D
> >
> >> bp->b_transp = tp;
> >> +
> >> +}
> >> +
> >> +void
> >> +xfs_trans_bjoin(
> >> + struct xfs_trans *tp,
> >> + struct xfs_buf *bp)
> >> +{
> >> + _xfs_trans_bjoin(tp, bp, 0);
> >> trace_xfs_trans_bjoin(bp->b_log_item);
> >> }
> >>
> >> @@ -594,9 +625,7 @@ xfs_trans_get_buf_map(
> >> if (bp == NULL)
> >> return NULL;
> >>
> >> - xfs_trans_bjoin(tp, bp);
> >> - bip = bp->b_log_item;
> >> - bip->bli_recur = 0;
> >> + _xfs_trans_bjoin(tp, bp, 1);
> >> trace_xfs_trans_get_buf(bp->b_log_item);
> >> return bp;
> >> }
> >> @@ -626,9 +655,7 @@ xfs_trans_getsb(
> >>
> >> bp = xfs_getsb(mp);
> >>
> >> - xfs_trans_bjoin(tp, bp);
> >> - bip = bp->b_log_item;
> >> - bip->bli_recur = 0;
> >> + _xfs_trans_bjoin(tp, bp, 1);
> >> trace_xfs_trans_getsb(bp->b_log_item);
> >> return bp;
> >> }
> >> @@ -677,9 +704,7 @@ xfs_trans_read_buf_map(
> >> if (bp->b_error)
> >> goto out_relse;
> >>
> >> - xfs_trans_bjoin(tp, bp);
> >> - bip = bp->b_log_item;
> >> - bip->bli_recur = 0;
> >> + _xfs_trans_bjoin(tp, bp, 1);
> >> done:
> >> trace_xfs_trans_read_buf(bp->b_log_item);
> >> *bpp = bp;
> >> --
> >> 2.17.0
> >>
>
next prev parent reply other threads:[~2019-05-20 23:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 17:42 [PATCH 0/3] xfsprogs: more libxfs/ spring cleaning Eric Sandeen
2019-05-16 17:43 ` [PATCH 1/3] libxfs: rename shared kernel functions from libxfs_ to xfs_ Eric Sandeen
2019-05-17 20:49 ` Allison Collins
2019-05-17 21:00 ` Eric Sandeen
2019-05-16 17:45 ` [PATCH 2/3] libxfs: remove libxfs API #defines for unexported xfs functions Eric Sandeen
2019-05-17 21:06 ` Allison Collins
2019-05-16 17:46 ` [PATCH 3/3] xfsprogs: remove unused flags arg from getsb interfaces Eric Sandeen
2019-05-17 21:09 ` Allison Collins
2019-05-16 20:38 ` [PATCH 4/3] libxfs: Remove XACT_DEBUG #ifdefs Eric Sandeen
2019-05-17 21:36 ` Allison Collins
2019-05-20 22:53 ` Darrick J. Wong
2019-05-16 20:39 ` [PATCH 5/3] libxfs: rename bli_format to avoid confusion with bli_formats Eric Sandeen
2019-05-17 22:29 ` Allison Collins
2019-05-17 23:01 ` Eric Sandeen
2019-05-17 23:41 ` Allison Collins
2019-05-16 20:39 ` [PATCH 6/3] libxfs: factor common xfs_trans_bjoin code Eric Sandeen
2019-05-17 22:56 ` Allison Collins
2019-05-20 22:56 ` Darrick J. Wong
2019-05-20 22:58 ` Eric Sandeen
2019-05-20 23:12 ` Darrick J. Wong [this message]
2019-05-16 20:40 ` [PATCH 7/3] libxfs: fix argument to xfs_trans_add_item Eric Sandeen
2019-05-17 22:57 ` Allison Collins
2019-05-16 20:41 ` [PATCH 8/3] xfs: factor log item initialisation Eric Sandeen
2019-05-17 23:50 ` Allison Collins
2019-05-17 19:46 ` [PATCH 9/3] libxfs: create current_time helper and sync xfs_trans_ichgtime Eric Sandeen
2019-05-17 19:50 ` [PATCH 10/3] libxfs: share kernel's xfs_trans_inode.c Eric Sandeen
2019-05-20 23:00 ` Darrick J. Wong
2019-05-20 23:03 ` [PATCH 0/3] xfsprogs: more libxfs/ spring cleaning Darrick J. Wong
2019-05-20 23:10 ` 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=20190520231227.GK5335@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/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