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 changes: - in xlog_grant_log_space we previously didn't call xlog_grant_push_ail for the queue not empty case, and now we do. - 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. My recommendation would be to skip this patch for now and revisit the area later. 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. _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs