diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-12-21 02:29:14 +0100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2010-12-21 02:29:14 +0100 |
commit | d0eb2f38b250b7d6c993adf81b0e4ded0565497e (patch) | |
tree | 660923947f3f7d412bd65c58ba9d2e4c8835320b /fs/xfs/linux-2.6 | |
parent | xfs: introduce new locks for the log grant ticket wait queues (diff) | |
download | linux-d0eb2f38b250b7d6c993adf81b0e4ded0565497e.tar.xz linux-d0eb2f38b250b7d6c993adf81b0e4ded0565497e.zip |
xfs: convert grant head manipulations to lockless algorithm
The only thing that the grant lock remains to protect is the grant head
manipulations when adding or removing space from the log. These calculations
are already based on atomic variables, so we can already update them safely
without locks. However, the grant head manpulations require atomic multi-step
calculations to be executed, which the algorithms currently don't allow.
To make these multi-step calculations atomic, convert the algorithms to
compare-and-exchange loops on the atomic variables. That is, we sample the old
value, perform the calculation and use atomic64_cmpxchg() to attempt to update
the head with the new value. If the head has not changed since we sampled it,
it will succeed and we are done. Otherwise, we rerun the calculation again from
a new sample of the head.
This allows us to remove the grant lock from around all the grant head space
manipulations, and that effectively removes the grant lock from the log
completely. Hence we can remove the grant lock completely from the log at this
point.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/linux-2.6')
0 files changed, 0 insertions, 0 deletions