Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/7] xfs: remove l_iclog_heads
Date: Wed, 17 Sep 2025 14:00:11 -0400	[thread overview]
Message-ID: <aMr3K1gW2IqvhpKr@bfoster> (raw)
In-Reply-To: <20250916135646.218644-8-hch@lst.de>

On Tue, Sep 16, 2025 at 06:56:31AM -0700, 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_log.c      | 11 +++--------
>  fs/xfs/xfs_log_priv.h |  1 -
>  2 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index a8e2539defbf..ca46cdef4ea4 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -1277,13 +1277,8 @@ xlog_get_iclog_buffer_size(
>  
>  	log->l_iclog_bufs = mp->m_logbufs;
>  	log->l_iclog_size = mp->m_logbsize;
> -
> -	/*
> -	 * # headers = size / 32k - one header holds cycles from 32k of data.
> -	 */
> -	log->l_iclog_heads =
> -		DIV_ROUND_UP(mp->m_logbsize, XLOG_HEADER_CYCLE_SIZE);
> -	log->l_iclog_hsize = log->l_iclog_heads << BBSHIFT;
> +	/* combined size of the log record headers: */
> +	log->l_iclog_hsize = DIV_ROUND_UP(mp->m_logbsize, XLOG_CYCLE_DATA_SIZE);

I haven't grokked the full series but this looked suspicious at first
glance because it rounds a byte unit field (logbsize) to a sector unit
value. After some rubber ducking with AI, it suggests this might be
problematic for log buf sizes < 32k (i.e. 16kb is the min supported).
I've since closed the window and lost the output, but I think it
suggested open coding the original calculation:

	hsize = DIV_ROUND_UP(m_logbsize, XLOG_HEADER_CYCLE_SIZE) << BBSHIFT;

Brian

>  }
>  
>  void
> @@ -1534,7 +1529,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.2
> 
> 


      reply	other threads:[~2025-09-17 17:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 13:56 kill xlog_in_core_2_t Christoph Hellwig
2025-09-16 13:56 ` [PATCH 1/7] xfs: add a XLOG_CYCLE_DATA_SIZE constant Christoph Hellwig
2025-09-16 13:56 ` [PATCH 2/7] xfs: add a on-disk log header cycle array accessor Christoph Hellwig
2025-09-16 13:56 ` [PATCH 3/7] xfs: don't use xlog_in_core_2_t in struct xlog_in_core Christoph Hellwig
2025-09-16 13:56 ` [PATCH 4/7] xfs: cleanup xlog_alloc_log a bit Christoph Hellwig
2025-09-16 13:56 ` [PATCH 5/7] xfs: remove xlog_in_core_2_t Christoph Hellwig
2025-09-16 13:56 ` [PATCH 6/7] xfs: remove the xlog_rec_header_t typedef Christoph Hellwig
2025-09-16 13:56 ` [PATCH 7/7] xfs: remove l_iclog_heads Christoph Hellwig
2025-09-17 18:00   ` Brian Foster [this message]

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=aMr3K1gW2IqvhpKr@bfoster \
    --to=bfoster@redhat.com \
    --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