[Devel] [PATCH RHEL7 COMMIT] fuse: Change interrupt requests allocation algorhythm

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 4 12:04:52 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.2
------>
commit 2ba8138aebf2c3eb41090b40d8f4ac33668af181
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Oct 4 11:57:52 2018 +0300

    fuse: Change interrupt requests allocation algorhythm
    
    (this is going to ms)
    
    Using of two unconnected IDs req->in.h.unique and
    req->intr_unique does not allow to link requests
    to a hash table. We need can't use none of them
    as a key to calculate hash.
    
    This patch changes the algorhythm of allocation
    of IDs for a request. Plain requests obtain even
    ID, while interrupt requests are encoded in
    the low bit. So, in next patches we will be able
    to use the rest of ID bits to caculate hash,
    and the hash will be the same for plain and
    interrupt requests.
    
    https://pmc.acronis.com/browse/VSTOR-14760
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/dev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 612e9701abcf..c343c799f3ae 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -25,6 +25,10 @@
 MODULE_ALIAS_MISCDEV(FUSE_MINOR);
 MODULE_ALIAS("devname:fuse");
 
+/* Ordinary requests have even IDs, while interrupts IDs are odd */
+#define FUSE_INT_REQ_BIT (1ULL << 0)
+#define FUSE_REQ_ID_STEP (1ULL << 1)
+
 static struct kmem_cache *fuse_req_cachep;
 extern struct workqueue_struct *fuse_fput_wq;
 
@@ -345,7 +349,8 @@ static unsigned len_args(unsigned numargs, struct fuse_arg *args)
 
 static u64 fuse_get_unique(struct fuse_iqueue *fiq)
 {
-	return ++fiq->reqctr;
+	fiq->reqctr += FUSE_REQ_ID_STEP;
+	return fiq->reqctr;
 }
 
 static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req)
@@ -1127,7 +1132,7 @@ __releases(fiq->waitq.lock)
 	int err;
 
 	list_del_init(&req->intr_entry);
-	req->intr_unique = fuse_get_unique(fiq);
+	req->intr_unique = (req->in.h.unique | FUSE_INT_REQ_BIT);
 	memset(&ih, 0, sizeof(ih));
 	memset(&arg, 0, sizeof(arg));
 	ih.len = reqsize;



More information about the Devel mailing list