Re: [PATCH 1/4] xfs: refactor xlog_recover_process_data()

Dave Chinner
2014-08-26T04:55:16Z

On Mon, Aug 25, 2014 at 09:09:21PM -0700, Christoph Hellwig wrote:
> > @@ -3556,14 +3622,10 @@ xlog_recover_process_data(
> > xfs_caddr_t dp,
> > int pass)
> > {
> > + struct xlog_op_header *ohead;
> > xfs_caddr_t lp;
> > int num_logops;
> > int error;
> >
> > lp = dp + be32_to_cpu(rhead->h_len);
> > num_logops = be32_to_cpu(rhead->h_num_logops);
> > @@ -3573,69 +3635,24 @@ xlog_recover_process_data(
> > return -EIO;
> >
> > while ((dp < lp) && num_logops) {
> > + ASSERT(dp + sizeof(struct xlog_op_header) <= lp);
> > +
> > + ohead = (struct xlog_op_header *)dp;
> > + dp += sizeof(*ohead);
>
> Using sizeof type and sizeof variable for the same thing right next
> to each other seems weird. Also why duplicate the addition instead
> of moving it below the assignment:

Oh, I missed converting the one in the ASSERT.

> ohead = (struct xlog_op_header *)dp;
> dp += sizeof(*ohead);
>
> ASSERT(dp <= lp);

Yup, that makes sense.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com