On Wed, Dec 01, 2010 at 07:30:32AM -0500, Christoph Hellwig wrote:
> On Mon, Nov 29, 2010 at 12:38:20PM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > xlog_grant_log_space and xlog_regrant_log_write_space both have very
> > similar structure. Both have a "wait on non-empty queue" section at
> > the start, followed by a "wait for space" loop of which the contents
> > are almost identical to the initial non-empty queue section.
> > In both cases, the non-empty queue wait can be folded into the wait
> > for space loop, simply by entering the loop if the queue is not
> > empty and the current ticket is not on the queue. If we trigger the
> > non-empty queue case, we always add ourselves to the queue, and
> > hence the second and subsequent loops are always driven by the "wait
> > for space" test.
> > IOWs, both wait conditions can be folded into the one loop, removing
> > a bunch of duplicated code and making it simpler to modify in
> > future patches.
> I don't really like this patch. The new conditions are overly
> complicated because of the desire to only go through the loop once
> for the queue not empty case. In addition there's some behaviour
> - in xlog_grant_log_space we previously didn't call xlog_grant_push_ail
> for the queue not empty case, and now we do.
As you point out, there's no actual harm in doing that.
> - in xlog_regrant_write_log_space the old version of the queue not
> empty case would loop over all waiting tickets, and if we could
> wake up all of them we'll skip the first wait, and given enough
> free space also the second wait, while the new code always adds it
> to the writeq, although it will still skip the actualy wait later.
I didn't think there's any harm in that, either, because we're
walking the entire queue anyway and it does not dirty any global
shared cachelines we aren't already dirtying by taking the queue
> My recommendation would be to skip this patch for now and revisit the
> area later.
Ugh. That means the following 10 patches need to be reworked.
> For example the superflous xlog_grant_push_ail actually
> is rather harmless these days with the xfsaild threshold, so not
> skipping it for the first case probably is fine in the end. Then again
> the whole add to the queue just in case if it's non-empty doesn't make
> much sense to me to start with. As soon as xfs_log_move_tail makes
> space in the log it wakes up all tickets waiting for it anyway, so
> adding us to the queue just in case seems rather inefficient, and not
> overl helpful.
Ok, so your main objection is the needless addition to the queue?
That can be avoided easily enough via a local variable. Would that
be sufficient to alleviate your concerns?