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>
This commit is contained in:
parent
ba5bb14733
commit
72b0d9aacb
3 changed files with 7 additions and 6 deletions
|
@ -2465,8 +2465,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
|
||||||
out->f_path.dentry->d_name.len,
|
out->f_path.dentry->d_name.len,
|
||||||
out->f_path.dentry->d_name.name, len);
|
out->f_path.dentry->d_name.name, len);
|
||||||
|
|
||||||
if (pipe->inode)
|
pipe_lock(pipe);
|
||||||
mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT);
|
|
||||||
|
|
||||||
splice_from_pipe_begin(&sd);
|
splice_from_pipe_begin(&sd);
|
||||||
do {
|
do {
|
||||||
|
@ -2486,8 +2485,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
|
||||||
} while (ret > 0);
|
} while (ret > 0);
|
||||||
splice_from_pipe_end(pipe, &sd);
|
splice_from_pipe_end(pipe, &sd);
|
||||||
|
|
||||||
if (pipe->inode)
|
pipe_unlock(pipe);
|
||||||
mutex_unlock(&pipe->inode->i_mutex);
|
|
||||||
|
|
||||||
if (sd.num_spliced)
|
if (sd.num_spliced)
|
||||||
ret = sd.num_spliced;
|
ret = sd.num_spliced;
|
||||||
|
|
|
@ -56,7 +56,7 @@ unsigned int pipe_min_size = PAGE_SIZE;
|
||||||
static void pipe_lock_nested(struct pipe_inode_info *pipe, int subclass)
|
static void pipe_lock_nested(struct pipe_inode_info *pipe, int subclass)
|
||||||
{
|
{
|
||||||
if (pipe->inode)
|
if (pipe->inode)
|
||||||
mutex_lock_nested(&pipe->inode->i_mutex, subclass);
|
mutex_lock_nested(&pipe->mutex, subclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pipe_lock(struct pipe_inode_info *pipe)
|
void pipe_lock(struct pipe_inode_info *pipe)
|
||||||
|
@ -71,7 +71,7 @@ EXPORT_SYMBOL(pipe_lock);
|
||||||
void pipe_unlock(struct pipe_inode_info *pipe)
|
void pipe_unlock(struct pipe_inode_info *pipe)
|
||||||
{
|
{
|
||||||
if (pipe->inode)
|
if (pipe->inode)
|
||||||
mutex_unlock(&pipe->inode->i_mutex);
|
mutex_unlock(&pipe->mutex);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(pipe_unlock);
|
EXPORT_SYMBOL(pipe_unlock);
|
||||||
|
|
||||||
|
@ -777,6 +777,7 @@ struct pipe_inode_info * alloc_pipe_info(struct inode *inode)
|
||||||
pipe->r_counter = pipe->w_counter = 1;
|
pipe->r_counter = pipe->w_counter = 1;
|
||||||
pipe->inode = inode;
|
pipe->inode = inode;
|
||||||
pipe->buffers = PIPE_DEF_BUFFERS;
|
pipe->buffers = PIPE_DEF_BUFFERS;
|
||||||
|
mutex_init(&pipe->mutex);
|
||||||
return pipe;
|
return pipe;
|
||||||
}
|
}
|
||||||
kfree(pipe);
|
kfree(pipe);
|
||||||
|
|
|
@ -27,6 +27,7 @@ struct pipe_buffer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct pipe_inode_info - a linux kernel pipe
|
* struct pipe_inode_info - a linux kernel pipe
|
||||||
|
* @mutex: mutex protecting the whole thing
|
||||||
* @wait: reader/writer wait point in case of empty/full pipe
|
* @wait: reader/writer wait point in case of empty/full pipe
|
||||||
* @nrbufs: the number of non-empty pipe buffers in this pipe
|
* @nrbufs: the number of non-empty pipe buffers in this pipe
|
||||||
* @buffers: total number of buffers (should be a power of 2)
|
* @buffers: total number of buffers (should be a power of 2)
|
||||||
|
@ -44,6 +45,7 @@ struct pipe_buffer {
|
||||||
* @bufs: the circular array of pipe buffers
|
* @bufs: the circular array of pipe buffers
|
||||||
**/
|
**/
|
||||||
struct pipe_inode_info {
|
struct pipe_inode_info {
|
||||||
|
struct mutex mutex;
|
||||||
wait_queue_head_t wait;
|
wait_queue_head_t wait;
|
||||||
unsigned int nrbufs, curbuf, buffers;
|
unsigned int nrbufs, curbuf, buffers;
|
||||||
unsigned int readers;
|
unsigned int readers;
|
||||||
|
|
Loading…
Add table
Reference in a new issue