[Devel,vz7,14/46] fuse: simplify unique ctr

Submitted by Maxim Patlasov on March 25, 2017, 2:17 a.m.

Details

Message ID 149040825964.25341.853174238788685355.stgit@maxim-thinkpad
State New
Series "fuse: add multi-threading support"
Headers show

Commit Message

Maxim Patlasov March 25, 2017, 2:17 a.m.
Backport from ml:

commit 7d2e0a099c7685a7355c27a2c3dc76ea7cfc8283
Author: Miklos Szeredi <mszeredi@suse.cz>
Date:   Wed Jul 1 16:26:00 2015 +0200

    fuse: simplify unique ctr

    Since it's a 64bit counter, it's never gonna wrap around.  Remove code
    dealing with that possibility.

    Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
    Reviewed-by: Ashish Samant <ashish.samant@oracle.com>

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 fs/fuse/dev.c   |    7 +------
 fs/fuse/inode.c |    1 -
 2 files changed, 1 insertion(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 0091d12..22e2547 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -302,12 +302,7 @@  static unsigned len_args(unsigned numargs, struct fuse_arg *args)
 
 static u64 fuse_get_unique(struct fuse_conn *fc)
 {
-	fc->reqctr++;
-	/* zero is special */
-	if (fc->reqctr == 0)
-		fc->reqctr = 1;
-
-	return fc->reqctr;
+	return ++fc->reqctr;
 }
 
 static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index fbd6d38..bf7f411 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -725,7 +725,6 @@  void fuse_conn_init(struct fuse_conn *fc)
 	fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD;
 	fc->khctr = 0;
 	fc->polled_files = RB_ROOT;
-	fc->reqctr = 0;
 	fc->blocked = 0;
 	fc->initialized = 0;
 	fc->attr_version = 1;