summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2009-04-14 19:48:41 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-04-15 12:10:12 +0200
commit61e0d47c33cc371f725bcda4a47ae0efe652dba8 (patch)
treee00f99b506f1c1a16e3ba987e3390deda6bd2e03 /include
parentf8cc774ce4844811a55e2352f1443055e3994e28 (diff)
downloadlinux-61e0d47c33cc371f725bcda4a47ae0efe652dba8.tar.bz2
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h3
-rw-r--r--include/linux/pipe_fs_i.h5
2 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 907d8f56c6fa..e766be0d4329 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -797,9 +797,6 @@ enum inode_i_mutex_lock_class
I_MUTEX_QUOTA
};
-extern void inode_double_lock(struct inode *inode1, struct inode *inode2);
-extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
-
/*
* NOTE: in a 32bit arch with a preemptable kernel and
* an UP compile the i_size_read/write must be atomic
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 8e4120285f72..c8f038554e80 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -134,6 +134,11 @@ struct pipe_buf_operations {
memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
#define PIPE_SIZE PAGE_SIZE
+/* Pipe lock and unlock operations */
+void pipe_lock(struct pipe_inode_info *);
+void pipe_unlock(struct pipe_inode_info *);
+void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *);
+
/* Drop the inode semaphore and wait for a pipe event, atomically */
void pipe_wait(struct pipe_inode_info *pipe);