Skip to content

Commit

Permalink
GFS2: Allocate reservation during splice_write
Browse files Browse the repository at this point in the history
This patch adds a GFS2-specific function for splice_write which
first calls function gfs2_rs_alloc to make sure a reservation
structure has been allocated before attempting to reserve blocks.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Bob Peterson committed Mar 18, 2015
1 parent 932e468 commit f42a69f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,22 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
}
}

static ssize_t gfs2_file_splice_write(struct pipe_inode_info *pipe,
struct file *out, loff_t *ppos,
size_t len, unsigned int flags)
{
int error;
struct gfs2_inode *ip = GFS2_I(out->f_mapping->host);

error = gfs2_rs_alloc(ip);
if (error)
return (ssize_t)error;

gfs2_size_hint(out, *ppos, len);

return iter_file_splice_write(pipe, out, ppos, len, flags);
}

const struct file_operations gfs2_file_fops = {
.llseek = gfs2_llseek,
.read = new_sync_read,
Expand All @@ -1077,7 +1093,7 @@ const struct file_operations gfs2_file_fops = {
.lock = gfs2_lock,
.flock = gfs2_flock,
.splice_read = generic_file_splice_read,
.splice_write = iter_file_splice_write,
.splice_write = gfs2_file_splice_write,
.setlease = simple_nosetlease,
.fallocate = gfs2_fallocate,
};
Expand Down Expand Up @@ -1107,7 +1123,7 @@ const struct file_operations gfs2_file_fops_nolock = {
.release = gfs2_release,
.fsync = gfs2_fsync,
.splice_read = generic_file_splice_read,
.splice_write = iter_file_splice_write,
.splice_write = gfs2_file_splice_write,
.setlease = generic_setlease,
.fallocate = gfs2_fallocate,
};
Expand Down

0 comments on commit f42a69f

Please sign in to comment.