Re: [PATCH 1/5] xfs: log stripe roundoff is a property of the log

Dave Chinner
2021-01-28T21:00:46Z

On Thu, Jan 28, 2021 at 09:57:03AM -0500, Brian Foster wrote:
> On Thu, Jan 28, 2021 at 03:41:50PM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > We don't need to look at the xfs_mount and superblock every time we
> > need to do an iclog roundoff calculation. The property is fixed for
> > the life of the log, so store the roundoff in the log at mount time
> > and use that everywhere.
> >
> > On a debug build:
> >
> > $ size fs/xfs/xfs_log.o.*
> > text data bss dec hex filename
> > 27360 560 8 27928 6d18 fs/xfs/xfs_log.o.orig
> > 27219 560 8 27787 6c8b fs/xfs/xfs_log.o.patched
> >
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
> > fs/xfs/libxfs/xfs_log_format.h | 3 --
> > fs/xfs/xfs_log.c | 60 +++++++++++++++-------------------
> > fs/xfs/xfs_log_priv.h | 2 ++
> > 3 files changed, 28 insertions(+), 37 deletions(-)
> >
> ...
> > diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> > index 58699881c100..c5f507c24577 100644
> > --- a/fs/xfs/xfs_log.c
> > +++ b/fs/xfs/xfs_log.c
> > @@ -1400,6 +1400,12 @@ xlog_alloc_log(
> > xlog_assign_atomic_lsn(&log->l_last_sync_lsn, 1, 0);
> > log->l_curr_cycle = 1; /* 0 is bad since this is initial value */
> >
> > + /* roundoff padding for transaction data and one for commit record */
>
> I don't follow this comment. What do you mean by "... and one for commit
> record?"

I just copied the comment from the code I lifted it from. I will
remove it.

> > +int
> > +xfs_log_calc_unit_res(
> > + struct xfs_mount *mp,
> > + int unit_bytes)
> > +{
> > + return xlog_calc_unit_res(mp->m_log, unit_bytes);
> > +}
> > +
>
> Could this be moved to the header as an inline? Otherwise looks
> reasonable.

Not without making everything that includes the header file this is
added to first including all the log header files.

We really need to clean up the mess that are external log interfaces
xfs_log_...(mp...) vs internal log interfaces xlog_...(log...) and
the random distribution of such functions through xfs_log.c,
xfs_log_recover.c, xfs_mount.c, xfs_log.h, xfs_log_priv.h,
xfs_trans.h, and xfs_log_format.h....

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com