summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2025-10-27 10:05:55 +0300
committerCarlos Maiolino <cem@kernel.org>2025-11-12 13:09:25 +0300
commitbc2dd9f2ba004cb4cce671dbe62f5193f58e4abc (patch)
tree573dcede05b2f426f865a3a50116c88fbf959f8e /fs/xfs/xfs_log.c
parentef1e275638fe6f6d54c18a770c138e4d5972b280 (diff)
downloadlinux-bc2dd9f2ba004cb4cce671dbe62f5193f58e4abc.tar.xz
xfs: remove l_iclog_heads
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>
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c11
1 files changed, 6 insertions, 5 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);
}
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;
}