* [Cluster-devel] [GFS2 PATCH] GFS2: Allocate reservation during splice_write
[not found] <1430204999.16233751.1424370137061.JavaMail.zimbra@redhat.com>
@ 2015-02-19 18:24 ` Bob Peterson
2015-02-19 20:58 ` Steven Whitehouse
0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2015-02-19 18:24 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
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.
Regards,
Bob Peterson
Red Hat File Systems
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/file.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index ec9c2d3..bd86e79 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -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,
@@ -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,
};
@@ -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,
};
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Allocate reservation during splice_write
2015-02-19 18:24 ` [Cluster-devel] [GFS2 PATCH] GFS2: Allocate reservation during splice_write Bob Peterson
@ 2015-02-19 20:58 ` Steven Whitehouse
0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2015-02-19 20:58 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
On 19/02/15 18:24, Bob Peterson wrote:
> Hi,
>
> 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.
>
> Regards,
>
> Bob Peterson
> Red Hat File Systems
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Steve.
> ---
> fs/gfs2/file.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
> index ec9c2d3..bd86e79 100644
> --- a/fs/gfs2/file.c
> +++ b/fs/gfs2/file.c
> @@ -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,
> @@ -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,
> };
> @@ -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,
> };
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-19 20:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1430204999.16233751.1424370137061.JavaMail.zimbra@redhat.com>
2015-02-19 18:24 ` [Cluster-devel] [GFS2 PATCH] GFS2: Allocate reservation during splice_write Bob Peterson
2015-02-19 20:58 ` Steven Whitehouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).