xfs: introduce xfs_rw_lock() helpers for locking the inode
authorDave Chinner <dchinner@redhat.com>
Wed, 12 Jan 2011 00:37:10 +0000 (11:37 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 12 Jan 2011 00:37:10 +0000 (11:37 +1100)
commit487f84f3f80bc6f00c59725e822653d3ec174b85
treed84117b479269b0a96a3041f67006d25b44300c3
parent4c5cfd1b4157fb75d43b44a147c2feba6422fc4f
xfs: introduce xfs_rw_lock() helpers for locking the inode

We need to obtain the i_mutex, i_iolock and i_ilock during the read
and write paths. Add a set of wrapper functions to neatly
encapsulate the lock ordering and shared/exclusive semantics to make
the locking easier to follow and get right.

Note that this changes some of the exclusive locking serialisation in
that serialisation will occur against the i_mutex instead of the
XFS_IOLOCK_EXCL. This does not change any behaviour, and it is
arguably more efficient to use the mutex for such serialisation than
the rw_sem.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/linux-2.6/xfs_file.c