[Devel] [PATCH VZ9 10/10] fs/fuse: add some options to request routing
Alexey Kuznetsov
kuznet at virtuozzo.com
Fri Jan 17 21:09:28 MSK 2025
Routing is not 100% good, we have situations when we
need to adapt its behaviour to current io profile.
Of course, it must be automatic, but at the moment
we still are not sure what the rules really should be.
So, for now add some handles to change routing behaviour,
they will allow us to test correct choices in various scenarios.
Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
---
fs/fuse/file.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 2112dcf..4b701af 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -23,6 +23,15 @@
#include <linux/file.h>
#include <linux/jhash.h>
+unsigned int hash_seed_r;
+module_param(hash_seed_r, uint, 0644);
+unsigned int hash_seed_w;
+module_param(hash_seed_w, uint, 0644);
+unsigned int read_route_break;
+module_param(read_route_break, uint, 0644);
+unsigned int write_route_break;
+module_param(write_route_break, uint, 0644);
+
unsigned int relax_fallocate = 1;
module_param(relax_fallocate, uint, 0644);
@@ -799,7 +808,7 @@ struct fuse_iqueue *fuse_route_io(struct fuse_conn *fc, struct fuse_rtable *rt,
return fiq;
break;
case FUSE_ROUTING_HASH:
- i = jhash_1word((u32)inode->i_ino, 0) % rt->rt_size;
+ i = jhash_1word((u32)inode->i_ino, hash_seed_r) % rt->rt_size;
fiq = rt->iqs_table + i;
if (fiq->handled_by_fud)
return fiq;
@@ -809,7 +818,8 @@ struct fuse_iqueue *fuse_route_io(struct fuse_conn *fc, struct fuse_rtable *rt,
return NULL;
for (i = 0; i < rt->rt_size; i += rt->divisor) {
- fiq = rt->iqs_table + i + (jhash_1word((u32)inode->i_ino, 0) % rt->divisor);
+ fiq = rt->iqs_table + i +
+ (jhash_1word((u32)inode->i_ino, hash_seed_w) % rt->divisor);
if (iosize <= fiq->size && fiq->handled_by_fud)
return fiq;
}
@@ -838,7 +848,7 @@ void fuse_read_args_fill(struct fuse_io_args *ia, struct file *file, loff_t pos,
args->out_args[0].size = count;
args->io_inode = file_inode(file);
- if (opcode == FUSE_READ) {
+ if (opcode == FUSE_READ && count >= read_route_break) {
args->fiq = fuse_route_io(ff->fm->fc, &ff->fm->fc->rrt, count, args->io_inode);
args->inode = file->f_path.dentry->d_inode;
args->ff = ff;
@@ -1349,7 +1359,8 @@ static void fuse_write_args_fill(struct fuse_io_args *ia, struct fuse_file *ff,
args->io_inode = inode;
args->ff = ff;
- args->fiq = fuse_route_io(ff->fm->fc, &ff->fm->fc->wrt, count, inode);
+ if (count >= write_route_break)
+ args->fiq = fuse_route_io(ff->fm->fc, &ff->fm->fc->wrt, count, inode);
}
static unsigned int fuse_write_flags(struct kiocb *iocb)
@@ -2036,7 +2047,8 @@ static void fuse_send_writepage(struct fuse_mount *fm,
args->force = true;
args->nocreds = true;
- args->fiq = fuse_route_io(fm->fc, &fm->fc->wrt, inarg->size, wpa->inode);
+ if (inarg->size >= write_route_break)
+ args->fiq = fuse_route_io(fm->fc, &fm->fc->wrt, inarg->size, wpa->inode);
spin_unlock(&fi->lock);
err = fuse_simple_background(fm, args, GFP_NOFS | __GFP_NOFAIL);
--
1.8.3.1
More information about the Devel
mailing list