xfs: clean up calculation of LR header blocks

Let's use DIV_ROUND_UP() to calculate log record header
blocks as what did in xlog_get_iclog_buffer_size() and
wrap up a common helper for log recovery.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
Gao Xiang
2020-09-22 09:41:06 -07:00
committed by Darrick J. Wong
parent f692d09e9c
commit 0c771b99d6
2 changed files with 18 additions and 35 deletions

View File

@@ -1604,9 +1604,7 @@ xlog_cksum(
int i;
int xheads;
xheads = size / XLOG_HEADER_CYCLE_SIZE;
if (size % XLOG_HEADER_CYCLE_SIZE)
xheads++;
xheads = DIV_ROUND_UP(size, XLOG_HEADER_CYCLE_SIZE);
for (i = 1; i < xheads; i++) {
crc = crc32c(crc, &xhdr[i].hic_xheader,