diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-21 02:32:24 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-09 14:13:00 -0400 |
commit | 72b0d9aacb89f3759931ec440e1b535671145bb4 (patch) | |
tree | 65b5d6166912b1c406fad596e06138d60cf3b8ff | |
parent | ba5bb147330a8737b6b5a812cc774c79c070704b (diff) |
pipe: don't use ->i_mutex
now it can be done - put mutex into pipe_inode_info, use it instead
of ->i_mutex
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/ocfs2/file.c | 6 | ||||
-rw-r--r-- | fs/pipe.c | 5 | ||||
-rw-r--r-- | include/linux/pipe_fs_i.h | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 1c93e771e950..8a7509f9e6f5 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2465,8 +2465,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, | |||
2465 | out->f_path.dentry->d_name.len, | 2465 | out->f_path.dentry->d_name.len, |
2466 | out->f_path.dentry->d_name.name, len); | 2466 | out->f_path.dentry->d_name.name, len); |
2467 | 2467 | ||
2468 | if (pipe->inode) | 2468 | pipe_lock(pipe); |
2469 | mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT); | ||
2470 | 2469 | ||
2471 | splice_from_pipe_begin(&sd); | 2470 | splice_from_pipe_begin(&sd); |
2472 | do { | 2471 | do { |
@@ -2486,8 +2485,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, | |||
2486 | } while (ret > 0); | 2485 | } while (ret > 0); |
2487 | splice_from_pipe_end(pipe, &sd); | 2486 | splice_from_pipe_end(pipe, &sd); |
2488 | 2487 | ||
2489 | if (pipe->inode) | 2488 | pipe_unlock(pipe); |
2490 | mutex_unlock(&pipe->inode->i_mutex); | ||
2491 | 2489 | ||
2492 | if (sd.num_spliced) | 2490 | if (sd.num_spliced) |
2493 | ret = sd.num_spliced; | 2491 | ret = sd.num_spliced; |
@@ -56,7 +56,7 @@ unsigned int pipe_min_size = PAGE_SIZE; | |||
56 | static void pipe_lock_nested(struct pipe_inode_info *pipe, int subclass) | 56 | static void pipe_lock_nested(struct pipe_inode_info *pipe, int subclass) |
57 | { | 57 | { |
58 | if (pipe->inode) | 58 | if (pipe->inode) |
59 | mutex_lock_nested(&pipe->inode->i_mutex, subclass); | 59 | mutex_lock_nested(&pipe->mutex, subclass); |
60 | } | 60 | } |
61 | 61 | ||
62 | void pipe_lock(struct pipe_inode_info *pipe) | 62 | void pipe_lock(struct pipe_inode_info *pipe) |
@@ -71,7 +71,7 @@ EXPORT_SYMBOL(pipe_lock); | |||
71 | void pipe_unlock(struct pipe_inode_info *pipe) | 71 | void pipe_unlock(struct pipe_inode_info *pipe) |
72 | { | 72 | { |
73 | if (pipe->inode) | 73 | if (pipe->inode) |
74 | mutex_unlock(&pipe->inode->i_mutex); | 74 | mutex_unlock(&pipe->mutex); |
75 | } | 75 | } |
76 | EXPORT_SYMBOL(pipe_unlock); | 76 | EXPORT_SYMBOL(pipe_unlock); |
77 | 77 | ||
@@ -777,6 +777,7 @@ struct pipe_inode_info * alloc_pipe_info(struct inode *inode) | |||
777 | pipe->r_counter = pipe->w_counter = 1; | 777 | pipe->r_counter = pipe->w_counter = 1; |
778 | pipe->inode = inode; | 778 | pipe->inode = inode; |
779 | pipe->buffers = PIPE_DEF_BUFFERS; | 779 | pipe->buffers = PIPE_DEF_BUFFERS; |
780 | mutex_init(&pipe->mutex); | ||
780 | return pipe; | 781 | return pipe; |
781 | } | 782 | } |
782 | kfree(pipe); | 783 | kfree(pipe); |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 59778e1c9c08..d803a85a64b6 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -27,6 +27,7 @@ struct pipe_buffer { | |||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * struct pipe_inode_info - a linux kernel pipe | 29 | * struct pipe_inode_info - a linux kernel pipe |
30 | * @mutex: mutex protecting the whole thing | ||
30 | * @wait: reader/writer wait point in case of empty/full pipe | 31 | * @wait: reader/writer wait point in case of empty/full pipe |
31 | * @nrbufs: the number of non-empty pipe buffers in this pipe | 32 | * @nrbufs: the number of non-empty pipe buffers in this pipe |
32 | * @buffers: total number of buffers (should be a power of 2) | 33 | * @buffers: total number of buffers (should be a power of 2) |
@@ -44,6 +45,7 @@ struct pipe_buffer { | |||
44 | * @bufs: the circular array of pipe buffers | 45 | * @bufs: the circular array of pipe buffers |
45 | **/ | 46 | **/ |
46 | struct pipe_inode_info { | 47 | struct pipe_inode_info { |
48 | struct mutex mutex; | ||
47 | wait_queue_head_t wait; | 49 | wait_queue_head_t wait; |
48 | unsigned int nrbufs, curbuf, buffers; | 50 | unsigned int nrbufs, curbuf, buffers; |
49 | unsigned int readers; | 51 | unsigned int readers; |