]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: adjust the Fh class members order
authorXiubo Li <xiubli@redhat.com>
Wed, 10 Feb 2021 06:17:11 +0000 (14:17 +0800)
committerXiubo Li <xiubli@redhat.com>
Mon, 16 Aug 2021 05:26:03 +0000 (13:26 +0800)
Some members once ininitalized in the Fh constructor they won't
change in the whole lifetime, and putting them under the client_lock
makes no sense.

And this could help simplify the inode lock code in some cases.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/client/Fh.cc
src/client/Fh.h

index e72390df714c6ee19a1b28d1b6aa7dbf22ec96d8..e7dd10b366641a167597556bcad7d55cd9a04089 100644 (file)
@@ -19,7 +19,7 @@
 #include "Fh.h"
 
 Fh::Fh(InodeRef in, int flags, int cmode, uint64_t _gen, const UserPerm &perms) :
-    inode(in), mode(cmode), gen(_gen), flags(flags), actor_perms(perms),
+    inode(in), flags(flags), gen(_gen), actor_perms(perms), mode(cmode),
     readahead()
 {
   inode->add_fh(this);
index 3448f5b6ac88e4419d53faf9c79077983d1ccc01..4657fac8457ddf92e11bb7d757fbeddf4d384029 100644 (file)
@@ -13,18 +13,22 @@ class Inode;
 
 struct Fh {
   InodeRef  inode;
+  int       flags;
+  uint64_t  gen;
+  UserPerm  actor_perms; // perms I opened the file with
+
+  // the members above once ininitalized in the constructor
+  // they won't change, and putting them under the client_lock
+  // makes no sense.
+
   int       _ref = 1;
   loff_t    pos = 0;
   int       mds = 0;        // have to talk to mds we opened with (for now)
   int       mode;       // the mode i opened the file with
-  uint64_t  gen;
 
-  int flags;
   bool pos_locked = false;           // pos is currently in use
   std::list<ceph::condition_variable*> pos_waiters;   // waiters for pos
 
-  UserPerm actor_perms; // perms I opened the file with
-
   Readahead readahead;
 
   // file lock