From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/5] xfs: log stripe roundoff is a property of the log
Date: Thu, 28 Jan 2021 09:57:03 -0500 [thread overview]
Message-ID: <20210128145703.GA2599027@bfoster> (raw)
In-Reply-To: <20210128044154.806715-2-david@fromorbit.com>
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?"
> + if (xfs_sb_version_haslogv2(&mp->m_sb) && mp->m_sb.sb_logsunit > 1)
> + log->l_iclog_roundoff = mp->m_sb.sb_logsunit;
> + else
> + log->l_iclog_roundoff = BBSIZE;
> +
> xlog_grant_head_init(&log->l_reserve_head);
> xlog_grant_head_init(&log->l_write_head);
>
...
> @@ -3485,18 +3475,20 @@ xfs_log_calc_unit_res(
> /* for commit-rec LR header - note: padding will subsume the ophdr */
> unit_bytes += log->l_iclog_hsize;
>
> - /* for roundoff padding for transaction data and one for commit record */
> - if (xfs_sb_version_haslogv2(&mp->m_sb) && mp->m_sb.sb_logsunit > 1) {
> - /* log su roundoff */
> - unit_bytes += 2 * mp->m_sb.sb_logsunit;
> - } else {
> - /* BB roundoff */
> - unit_bytes += 2 * BBSIZE;
> - }
> + /* roundoff padding for transaction data and one for commit record */
> + unit_bytes += log->l_iclog_roundoff;
>
> return unit_bytes;
> }
>
> +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.
Brian
> /*
> * Allocate and initialise a new log ticket.
> */
> @@ -3513,7 +3505,7 @@ xlog_ticket_alloc(
>
> tic = kmem_cache_zalloc(xfs_log_ticket_zone, GFP_NOFS | __GFP_NOFAIL);
>
> - unit_res = xfs_log_calc_unit_res(log->l_mp, unit_bytes);
> + unit_res = xlog_calc_unit_res(log, unit_bytes);
>
> atomic_set(&tic->t_ref, 1);
> tic->t_task = current;
> diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
> index 1c6fdbf3d506..037950cf1061 100644
> --- a/fs/xfs/xfs_log_priv.h
> +++ b/fs/xfs/xfs_log_priv.h
> @@ -436,6 +436,8 @@ struct xlog {
> #endif
> /* log recovery lsn tracking (for buffer submission */
> xfs_lsn_t l_recovery_lsn;
> +
> + uint32_t l_iclog_roundoff;/* padding roundoff */
> };
>
> #define XLOG_BUF_CANCEL_BUCKET(log, blkno) \
> --
> 2.28.0
>
next prev parent reply other threads:[~2021-01-28 14:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 4:41 [PATCH 0/5] xfs: various log stuff Dave Chinner
2021-01-28 4:41 ` [PATCH 1/5] xfs: log stripe roundoff is a property of the log Dave Chinner
2021-01-28 14:57 ` Brian Foster [this message]
2021-01-28 20:59 ` Dave Chinner
2021-01-28 21:25 ` Darrick J. Wong
2021-01-28 22:00 ` Dave Chinner
2021-01-28 4:41 ` [PATCH 2/5] xfs: separate CIL commit record IO Dave Chinner
2021-01-28 15:07 ` Brian Foster
2021-01-28 21:22 ` Dave Chinner
[not found] ` <20210129145851.GB2660974@bfoster>
2021-01-29 22:25 ` Dave Chinner
2021-02-01 16:07 ` Brian Foster
2021-01-30 9:13 ` Chandan Babu R
2021-02-01 12:59 ` Christoph Hellwig
2021-01-28 4:41 ` [PATCH 3/5] xfs: journal IO cache flush reductions Dave Chinner
2021-01-28 15:12 ` Brian Foster
2021-01-28 21:46 ` Dave Chinner
2021-01-28 21:26 ` Dave Chinner
2021-01-30 12:56 ` Chandan Babu R
2021-01-28 4:41 ` [PATCH 4/5] xfs: Fix CIL throttle hang when CIL space used going backwards Dave Chinner
2021-01-28 16:53 ` Brian Foster
2021-02-02 5:52 ` Chandan Babu R
2021-02-17 11:33 ` Paul Menzel
2021-02-17 21:06 ` Donald Buczek
2021-01-28 4:41 ` [PATCH 5/5] xfs: reduce buffer log item shadow allocations Dave Chinner
2021-01-28 16:54 ` Brian Foster
2021-01-28 21:58 ` Dave Chinner
2021-02-02 12:01 ` Chandan Babu R
2021-02-01 12:39 ` [PATCH 0/5] xfs: various log stuff Christoph Hellwig
2021-02-03 21:20 ` Dave Chinner
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=20210128145703.GA2599027@bfoster \
--to=bfoster@redhat.com \
--cc=david@fromorbit.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