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)
commit61e0d47c33cc371f725bcda4a47ae0efe652dba8
treee00f99b506f1c1a16e3ba987e3390deda6bd2e03
parentf8cc774ce4844811a55e2352f1443055e3994e28
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