The commit is pushed to "branch-rh9-5.14.0-427.44.1.vz9.80.x-ovz" and will 
appear at g...@bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.44.1.vz9.80.4
------>
commit 603f9f5f6915f6462b0aaba7e0653e8578047cca
Author: Alexey Kuznetsov <kuz...@virtuozzo.com>
Date:   Sat Jan 18 02:09:28 2025 +0800

    fs/fuse: add some options to request routing
    
    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 are still 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 <kuz...@virtuozzo.com>
    Feature: vStorage
---
 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 2112dcf2fa0a..4b701af5a205 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 @@ __acquires(fi->lock)
        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);
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to