]> git.baikalelectronics.ru Git - kernel.git/commit
[XFS] extend completions to provide XFS object flush requirements
authorDavid Chinner <david@fromorbit.com>
Wed, 13 Aug 2008 06:40:43 +0000 (16:40 +1000)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Wed, 13 Aug 2008 06:40:43 +0000 (16:40 +1000)
commit957d704e6abdb280118984b7822dba330ce16b57
tree47ee9ab904387a2062705c69197725596e6b2661
parente226392823a0dbcad0312cc57be1a5485c6ca7ff
[XFS] extend completions to provide XFS object flush requirements

XFS object flushing doesn't quite match existing completion semantics.  It
mixed exclusive access with completion.  That is, we need to mark an object as
being flushed before flushing it to disk, and then block any other attempt to
flush it until the completion occurs.  We do this but adding an extra count to
the completion before we start using them.  However, we still need to
determine if there is a completion in progress, and allow no-blocking attempts
fo completions to decrement the count.

To do this we introduce:

int try_wait_for_completion(struct completion *x)
returns a failure status if done == 0, otherwise decrements done
to zero and returns a "started" status. This is provided
to allow counted completions to begin safely while holding
object locks in inverted order.

int completion_done(struct completion *x)
returns 1 if there is no waiter, 0 if there is a waiter
(i.e. a completion in progress).

This replaces the use of semaphores for providing this exclusion
and completion mechanism.

SGI-PV: 981498

SGI-Modid: xfs-linux-melb:xfs-kern:31816a

Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
include/linux/completion.h