Skip to content

Commit bc2dd9f

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
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>
1 parent ef1e275 commit bc2dd9f

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

fs/xfs/xfs_log.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,11 +1279,12 @@ xlog_get_iclog_buffer_size(
12791279
log->l_iclog_size = mp->m_logbsize;
12801280

12811281
/*
1282-
* # headers = size / 32k - one header holds cycles from 32k of data.
1282+
* Combined size of the log record headers. The first 32k cycles
1283+
* are stored directly in the xlog_rec_header, the rest in the
1284+
* variable number of xlog_rec_ext_headers at its end.
12831285
*/
1284-
log->l_iclog_heads =
1285-
DIV_ROUND_UP(mp->m_logbsize, XLOG_HEADER_CYCLE_SIZE);
1286-
log->l_iclog_hsize = log->l_iclog_heads << BBSHIFT;
1286+
log->l_iclog_hsize = struct_size(log->l_iclog->ic_header, h_ext,
1287+
DIV_ROUND_UP(mp->m_logbsize, XLOG_HEADER_CYCLE_SIZE) - 1);
12871288
}
12881289

12891290
void
@@ -1526,7 +1527,7 @@ xlog_pack_data(
15261527
dp += BBSIZE;
15271528
}
15281529

1529-
for (i = 0; i < log->l_iclog_heads - 1; i++)
1530+
for (i = 0; i < (log->l_iclog_hsize >> BBSHIFT) - 1; i++)
15301531
rhead->h_ext[i].xh_cycle = cycle_lsn;
15311532
}
15321533

fs/xfs/xfs_log_priv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ struct xlog {
406406
struct list_head *l_buf_cancel_table;
407407
struct list_head r_dfops; /* recovered log intent items */
408408
int l_iclog_hsize; /* size of iclog header */
409-
int l_iclog_heads; /* # of iclog header sectors */
410409
uint l_sectBBsize; /* sector size in BBs (2^n) */
411410
int l_iclog_size; /* size of log in bytes */
412411
int l_iclog_bufs; /* number of iclog buffers */

0 commit comments

Comments
 (0)