public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Chandan Babu R <chandanbabu@kernel.org>, xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs: fix xfs_init_attr_trans not handling explicit operation codes
Date: Tue, 21 May 2024 08:51:39 -0700	[thread overview]
Message-ID: <20240521155139.GQ25518@frogsfrogsfrogs> (raw)
In-Reply-To: <Zkymy4s5LtabyMRm@infradead.org>

On Tue, May 21, 2024 at 06:51:07AM -0700, Christoph Hellwig wrote:
> On Mon, May 20, 2024 at 06:03:38PM -0700, Darrick J. Wong wrote:
> > +	tres->tr_logcount = XFS_ATTRSET_LOG_COUNT;
> >  		tres->tr_logflags = XFS_TRANS_PERM_LOG_RES;
> > +	return args->total;
> 
> Seems like indentation is off for the XFS_TRANS_PERM_LOG_RES
> assignment?

Oops.  I think I could shorten this to:

/* Initialize transaction reservation for an xattr set/replace/upsert */
inline struct xfs_trans_res
xfs_attr_set_resv(
	const struct xfs_da_args	*args)
{
	struct xfs_mount		*mp = args->dp->i_mount;
	struct xfs_trans_res		ret = {
		.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
			    M_RES(mp)->tr_attrsetrt.tr_logres * args->total,
		.tr_logcount		= XFS_ATTRSET_LOG_COUNT,
		.tr_logflags		= XFS_TRANS_PERM_LOG_RES,
	};

	return ret;
}

> Also wju does this need to return args->total vs just handling it
> in the caller? 

I'm not sure, @total for the remove action used to be in xfs_attr_set
prior to the creation of xfs_attr_recover_work.

> > +/* Initialize transaction reservation for an xattr remove */
> > +unsigned int
> > +xfs_attr_init_remove_trans(
> > +	struct xfs_da_args	*args,
> > +	struct xfs_trans_res	*tres)
> > +{
> > +	struct xfs_mount	*mp = args->dp->i_mount;
> > +
> > +	*tres = M_RES(mp)->tr_attrrm;
> > +	return XFS_ATTRRM_SPACE_RES(mp);
> 
> And do we even need this helper vs open coding it like we do in
> most transaction allocations?

Not really.

--D

  reply	other threads:[~2024-05-21 15:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21  1:03 [PATCH] xfs: fix xfs_init_attr_trans not handling explicit operation codes Darrick J. Wong
2024-05-21 13:51 ` Christoph Hellwig
2024-05-21 15:51   ` Darrick J. Wong [this message]
2024-05-21 16:05 ` [PATCH v2] " Darrick J. Wong
2024-05-21 16:24   ` Christoph Hellwig

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=20240521155139.GQ25518@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=chandanbabu@kernel.org \
    --cc=hch@infradead.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