[PATCH 4/5] xfs: introduce background inode reclaim work
Christoph Hellwig
hch at infradead.org
Thu Mar 3 09:36:34 CST 2011
> +void
> +xfs_syncd_queue_reclaim(
> + struct xfs_mount *mp,
> + int flags)
> +{
> + mutex_lock(&xfs_syncd_lock);
> + if (!delayed_work_pending(&mp->m_reclaim_work))
> + queue_delayed_work(xfs_syncd_wq, &mp->m_reclaim_work,
> + xfs_syncd_centisecs / 5 * msecs_to_jiffies(10));
> + mutex_unlock(&xfs_syncd_lock);
> +
> + if (flags & SYNC_WAIT)
> + flush_delayed_work_sync(&mp->m_reclaim_work);
> +}
queue_work/queue_delayed_work have a test_set_bit on
WORK_STRUCT_PENDING_BIT, so can just call queue_work/queue_delayed_work
and it will do the right thing if it is in use. So you can remove the
mutex and delayed_work_pending check here.
At least currently SYNC_WAIT is never set by any caller, and I wonder if
we should just leave the waiting to the caller if we ever grow one.
More information about the xfs
mailing list