]> git.baikalelectronics.ru Git - kernel.git/commit
splice: add helpers for locking pipe inode
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 14 Apr 2009 17:48:41 +0000 (19:48 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 15 Apr 2009 10:10:12 +0000 (12:10 +0200)
commitd043eda6298e2b688e2c9abfd1aa11db5d2ae6cc
treee00f99b506f1c1a16e3ba987e3390deda6bd2e03
parent0cc28be74cd6d9b310a8111f319d1d4f3e41477f
splice: add helpers for locking pipe inode

There are lots of sequences like this, especially in splice code:

if (pipe->inode)
mutex_lock(&pipe->inode->i_mutex);
/* do something */
if (pipe->inode)
mutex_unlock(&pipe->inode->i_mutex);

so introduce helpers which do the conditional locking and unlocking.
Also replace the inode_double_lock() call with a pipe_double_lock()
helper to avoid spreading the use of this functionality beyond the
pipe code.

This patch is just a cleanup, and should cause no behavioral changes.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fs/inode.c
fs/pipe.c
fs/splice.c
include/linux/fs.h
include/linux/pipe_fs_i.h