Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 8/9] xfs: remove l_iclog_heads
Date: Tue, 14 Oct 2025 15:12:07 -0700	[thread overview]
Message-ID: <20251014221207.GN6188@frogsfrogsfrogs> (raw)
In-Reply-To: <20251013024228.4109032-9-hch@lst.de>

On Mon, Oct 13, 2025 at 11:42:12AM +0900, Christoph Hellwig wrote:
> l_iclog_heads is only used in one place and can be trivially derived
> from l_iclog_hsize by a single shift operation.  Remove it, and switch
> the initialization of l_iclog_hsize to use struct_size so that it is
> directly derived from the on-disk format definition.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_log.c      | 11 ++++++-----
>  fs/xfs/xfs_log_priv.h |  1 -
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 8b3b79699596..47a8e74c8c5c 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -1279,11 +1279,12 @@ xlog_get_iclog_buffer_size(
>  	log->l_iclog_size = mp->m_logbsize;
>  
>  	/*
> -	 * # headers = size / 32k - one header holds cycles from 32k of data.
> +	 * Combined size of the log record headers.  The first 32k cycles
> +	 * are stored directly in the xlog_rec_header, the rest in the
> +	 * variable number of xlog_rec_ext_headers at its end.
>  	 */
> -	log->l_iclog_heads =
> -		DIV_ROUND_UP(mp->m_logbsize, XLOG_HEADER_CYCLE_SIZE);
> -	log->l_iclog_hsize = log->l_iclog_heads << BBSHIFT;
> +	log->l_iclog_hsize = struct_size(log->l_iclog->ic_header, h_ext,
> +		DIV_ROUND_UP(mp->m_logbsize, XLOG_HEADER_CYCLE_SIZE) - 1);

Hrm.  offsetof(xlog_rec_header::h_ext) == 512 and
sizeof(xlog_rec_ext_header) == 512, so I think this computation still
yields the same results.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

>  }
>  
>  void
> @@ -1526,7 +1527,7 @@ xlog_pack_data(
>  		dp += BBSIZE;
>  	}
>  
> -	for (i = 0; i < log->l_iclog_heads - 1; i++)
> +	for (i = 0; i < (log->l_iclog_hsize >> BBSHIFT) - 1; i++)
>  		rhead->h_ext[i].xh_cycle = cycle_lsn;
>  }
>  
> diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
> index ac98ac71152d..17733ba7f251 100644
> --- a/fs/xfs/xfs_log_priv.h
> +++ b/fs/xfs/xfs_log_priv.h
> @@ -406,7 +406,6 @@ struct xlog {
>  	struct list_head	*l_buf_cancel_table;
>  	struct list_head	r_dfops;	/* recovered log intent items */
>  	int			l_iclog_hsize;  /* size of iclog header */
> -	int			l_iclog_heads;  /* # of iclog header sectors */
>  	uint			l_sectBBsize;   /* sector size in BBs (2^n) */
>  	int			l_iclog_size;	/* size of log in bytes */
>  	int			l_iclog_bufs;	/* number of iclog buffers */
> -- 
> 2.47.3
> 
> 

  reply	other threads:[~2025-10-14 22:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13  2:42 kill xlog_in_core_2_t v2 Christoph Hellwig
2025-10-13  2:42 ` [PATCH 1/9] xfs: add a XLOG_CYCLE_DATA_SIZE constant Christoph Hellwig
2025-10-14 21:16   ` Darrick J. Wong
2025-10-13  2:42 ` [PATCH 2/9] xfs: add a on-disk log header cycle array accessor Christoph Hellwig
2025-10-14 21:27   ` Darrick J. Wong
2025-10-15  4:32     ` Christoph Hellwig
2025-10-15 20:25       ` Darrick J. Wong
2025-10-13  2:42 ` [PATCH 3/9] xfs: don't use xlog_in_core_2_t in struct xlog_in_core Christoph Hellwig
2025-10-14 21:47   ` Darrick J. Wong
2025-10-15  4:34     ` Christoph Hellwig
2025-10-15 20:26       ` Darrick J. Wong
2025-10-13  2:42 ` [PATCH 4/9] xfs: cleanup xlog_alloc_log a bit Christoph Hellwig
2025-10-14 21:48   ` Darrick J. Wong
2025-10-13  2:42 ` [PATCH 5/9] xfs: remove a very outdated comment from xlog_alloc_log Christoph Hellwig
2025-10-14 21:52   ` Darrick J. Wong
2025-10-15  4:37     ` Christoph Hellwig
2025-10-13  2:42 ` [PATCH 6/9] xfs: remove xlog_in_core_2_t Christoph Hellwig
2025-10-14 22:07   ` Darrick J. Wong
2025-10-15  4:41     ` Christoph Hellwig
2025-10-15 20:27       ` Darrick J. Wong
2025-10-13  2:42 ` [PATCH 7/9] xfs: remove the xlog_rec_header_t typedef Christoph Hellwig
2025-10-14 22:08   ` Darrick J. Wong
2025-10-13  2:42 ` [PATCH 8/9] xfs: remove l_iclog_heads Christoph Hellwig
2025-10-14 22:12   ` Darrick J. Wong [this message]
2025-10-13  2:42 ` [PATCH 9/9] xfs: remove the xlog_in_core_t typedef Christoph Hellwig
2025-10-14 22:12   ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2025-10-27  7:05 kill xlog_in_core_2_t v3 Christoph Hellwig
2025-10-27  7:05 ` [PATCH 8/9] xfs: remove l_iclog_heads Christoph Hellwig
2025-10-31 14:15   ` Carlos Maiolino

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=20251014221207.GN6188@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --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