[PATCH 2/2] xfs: push stale, pinned buffers on trylock failures
Christoph Hellwig
hch at infradead.org
Wed Nov 24 11:20:51 CST 2010
> - /* Attempt to get the semaphore without sleeping,
> - * if this does not work then we need to drop the
> - * spinlock and do a hard attempt on the semaphore.
> + /*
> + * Attempt to get the semaphore without sleeping first. if we fail then
> + * do a blocking lock if requested.
> */
You might as well remove the comment entirely, as it's utterly
pointless.
> - if (down_trylock(&bp->b_sema)) {
> + if (xfs_buf_cond_lock(bp)) {
> if (!(flags & XBF_TRYLOCK)) {
> /* wait for buffer ownership */
> xfs_buf_lock(bp);
> XFS_STATS_INC(xb_get_locked_waited);
> } else {
> - /* We asked for a trylock and failed, no need
> - * to look at file offset and length here, we
> - * know that this buffer at least overlaps our
> - * buffer and is locked, therefore our buffer
> - * either does not exist, or is this buffer.
> - */
> + /* We asked for a trylock and failed. */
> xfs_buf_rele(bp);
> XFS_STATS_INC(xb_busy_locked);
> return NULL;
> }
In case we wait for the lock we now do the log force twice, but that
should be fine.
More information about the xfs
mailing list