]> Gentwo Git Trees - linux/.git/commitdiff
xfs: remove l_iclog_heads
authorChristoph Hellwig <hch@lst.de>
Mon, 27 Oct 2025 07:05:55 +0000 (08:05 +0100)
committerCarlos Maiolino <cem@kernel.org>
Wed, 12 Nov 2025 10:09:25 +0000 (11:09 +0100)
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>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_log.c
fs/xfs/xfs_log_priv.h

index 8b3b7969959600abdbe5adee7e8cff24273b0e86..47a8e74c8c5ce0453002991f775b740a59d51bef 100644 (file)
@@ -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);
 }
 
 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;
 }
 
index ac98ac71152d4c91e3a2592c1260cb7c6dd21ad1..17733ba7f25119fdd62bb7e265166aef3e4ddfc7 100644 (file)
@@ -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 */