[PATCH 9/9] xfs: log ticket reservation underestimates the number of iclogs
Christoph Hellwig
hch at infradead.org
Mon Mar 15 10:44:35 CDT 2010
> > + iclog_space = log->l_iclog_size - log->l_iclog_hsize;
> > + num_headers = (unit_bytes + iclog_space - 1) / iclog_space;
> > +
> > + /* for split-recs - ophdrs added when data split over LRs */
> > + unit_bytes += sizeof(xlog_op_header_t) * num_headers;
> > +
> > + /* add extra header reservations if we overrun */
> > + while (!num_headers ||
> > + ((unit_bytes + iclog_space - 1) / iclog_space) > num_headers) {
> > + unit_bytes += sizeof(xlog_op_header_t);
> > + num_headers++;
> > + }
>
> Looks good, but why do you check for a zero num_headers here? The only way
> this could happen after the roundup above is if unit_bytes is zero, which
> can't ever happen - one caller has it hardcoded to 1, and the the other
> has a conditional for it beeing bigger than 0 around the call.
BTW: use of the howmany macro might make some of the above easier
to read.
More information about the xfs
mailing list