aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2018-09-11 06:11:56 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2018-09-28 10:43:23 -0400
commitc59fd85e4fd07fdf0ab523a5e9734f5338d6aa19 (patch)
tree8ff912dba1ee787929c8bda338386b94e7f1e587 /fs/fuse
parent63825b4e1da5a3cba79d835a5925e5daf7db3a77 (diff)
fuse: change interrupt requests allocation algorithm
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 algorithm 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 calculate hash, and the hash will be the same for plain and interrupt requests. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dev.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 071feb8cb265..38bb46ab2d7b 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -25,6 +25,10 @@
25MODULE_ALIAS_MISCDEV(FUSE_MINOR); 25MODULE_ALIAS_MISCDEV(FUSE_MINOR);
26MODULE_ALIAS("devname:fuse"); 26MODULE_ALIAS("devname:fuse");
27 27
28/* Ordinary requests have even IDs, while interrupts IDs are odd */
29#define FUSE_INT_REQ_BIT (1ULL << 0)
30#define FUSE_REQ_ID_STEP (1ULL << 1)
31
28static struct kmem_cache *fuse_req_cachep; 32static struct kmem_cache *fuse_req_cachep;
29 33
30static struct fuse_dev *fuse_get_dev(struct file *file) 34static struct fuse_dev *fuse_get_dev(struct file *file)
@@ -319,7 +323,8 @@ static unsigned len_args(unsigned numargs, struct fuse_arg *args)
319 323
320static u64 fuse_get_unique(struct fuse_iqueue *fiq) 324static u64 fuse_get_unique(struct fuse_iqueue *fiq)
321{ 325{
322 return ++fiq->reqctr; 326 fiq->reqctr += FUSE_REQ_ID_STEP;
327 return fiq->reqctr;
323} 328}
324 329
325static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req) 330static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req)
@@ -1090,7 +1095,7 @@ __releases(fiq->waitq.lock)
1090 int err; 1095 int err;
1091 1096
1092 list_del_init(&req->intr_entry); 1097 list_del_init(&req->intr_entry);
1093 req->intr_unique = fuse_get_unique(fiq); 1098 req->intr_unique = (req->in.h.unique | FUSE_INT_REQ_BIT);
1094 memset(&ih, 0, sizeof(ih)); 1099 memset(&ih, 0, sizeof(ih));
1095 memset(&arg, 0, sizeof(arg)); 1100 memset(&arg, 0, sizeof(arg));
1096 ih.len = reqsize; 1101 ih.len = reqsize;