Hi Brian, On Tue, Sep 22, 2020 at 11:22:48AM -0400, Brian Foster wrote: > On Thu, Sep 17, 2020 at 01:13:41PM +0800, Gao Xiang wrote: > > 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. > > > > Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxx> > > --- > > v2: https://lore.kernel.org/r/20200904082516.31205-3-hsiangkao@xxxxxxxxxx > > > > changes since v2: > > - get rid of xlog_logrecv2_hblks() and use xlog_logrec_hblks() > > entirely (Brian). > > > > fs/xfs/xfs_log.c | 4 +--- > > fs/xfs/xfs_log_recover.c | 48 ++++++++++++++-------------------------- > > 2 files changed, 17 insertions(+), 35 deletions(-) > > > > diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c > > index ad0c69ee8947..7a4ba408a3a2 100644 > > --- a/fs/xfs/xfs_log.c > > +++ b/fs/xfs/xfs_log.c > > @@ -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, > > diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c > > index 782ec3eeab4d..28dd98b5a703 100644 > > --- a/fs/xfs/xfs_log_recover.c > > +++ b/fs/xfs/xfs_log_recover.c > > @@ -371,6 +371,18 @@ xlog_find_verify_cycle( > > return error; > > } > > > > +static inline int xlog_logrec_hblks(struct xlog *log, xlog_rec_header_t *rh) > > +{ > > We're trying to gradually eliminate various structure typedefs so it's > frowned upon to introduce new instances. If you replace the above with > 'struct xlog_rec_header,' the rest looks good to me: > > Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> Thanks for your review. Yeah, I noticed the eliminate movement and I used xlog_rec_header_t by mistake. I will resend a follow-up "in-reply-to" patch to fix that. Thanks, Gao Xiang