Re: [PATCH] xfs: fix xfs_init_attr_trans not handling explicit operation codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux