Re: [Cluster-devel] [GFS2 PATCH] GFS2: Allocate reservation during splice_write
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 rpete...@redhat.com Acked-by: Steven Whitehouse swhit...@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, };
[Cluster-devel] [GFS2 PATCH] GFS2: Allocate reservation during splice_write
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 rpete...@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, };
[Cluster-devel] [PATCH] libgfs2: Use the correct parent for rgrp tree insertion
lgfs2_rgrps_append() was using the parent of the last rgrp instead of the last rgrp itself as the intended parent when inserting new rgrps into the tree. This left the tree unbalanced in such a way as to make lookups of the last node in the tree effectively a linear list search. This was done for each rgrp insertion so, although it didn't cause a noticeable slow-down for smaller file sytems, tests on 250TB volumes requiring over a million resource groups would become CPU bound and could take hours to complete. This patch fixes lgfs2_rgrps_append() to use the correct parent node for rgrp tree insertions, giving a significant performance improvement when creating file systems on large volumes. Resolves: rhbz#1194446 Signed-off-by: Andrew Price anpr...@redhat.com --- gfs2/libgfs2/rgrp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c index ed8e01d..cf4385a 100644 --- a/gfs2/libgfs2/rgrp.c +++ b/gfs2/libgfs2/rgrp.c @@ -539,9 +539,9 @@ struct osi_node *lgfs2_rgrps_root(lgfs2_rgrps_t rgs) lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry) { lgfs2_rgrp_t rg; - lgfs2_rgrp_t lastrg = (lgfs2_rgrp_t)osi_last(rgs-root); struct osi_node **link = rgs-root.osi_node; - struct osi_node *parent = NULL; + struct osi_node *parent = osi_last(rgs-root); + lgfs2_rgrp_t lastrg = (lgfs2_rgrp_t)parent; errno = EINVAL; if (entry == NULL) @@ -550,7 +550,6 @@ lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry) if (lastrg != NULL) { /* Tree is not empty */ if (entry-ri_addr = lastrg-ri.ri_addr) return NULL; /* Appending with a lower address doesn't make sense */ - parent = osi_parent(lastrg-node); link = lastrg-node.osi_right; } -- 1.9.3