[PATCH 1/3] xfs: add RWF_NONBLOCK support
Dave Chinner
david at fromorbit.com
Wed Oct 1 17:23:27 CDT 2014
On Wed, Oct 01, 2014 at 11:04:52PM +0200, Christoph Hellwig wrote:
> Add support for non-blocking reads. The guts are handled by the generic
> code, the only addition is a non-blocking variant of xfs_rw_ilock.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> fs/xfs/xfs_file.c | 30 +++++++++++++++++++++++++-----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index cf61271..f9efffc 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -61,6 +61,23 @@ xfs_rw_ilock(
> xfs_ilock(ip, type);
> }
>
> +static inline bool
> +xfs_rw_ilock_nowait(
> + struct xfs_inode *ip,
> + int type)
> +{
> + if (type & XFS_IOLOCK_EXCL) {
> + if (!mutex_trylock(&VFS_I(ip)->i_mutex))
> + return false;
> + }
> + if (!xfs_ilock_nowait(ip, type)) {
> + mutex_unlock(&VFS_I(ip)->i_mutex);
Shouldn't that be:
if (type & XFS_IOLOCK_EXCL) {
mutex_unlock(&VFS_I(ip)->i_mutex);
Cheers,
Dave.
--
Dave Chinner
david at fromorbit.com
More information about the xfs
mailing list