From d4688848fa4710d50db5488eaefd05defcb78263 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Wed, 10 Feb 2021 14:17:11 +0800 Subject: [PATCH] client: adjust the Fh class members order 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 --- src/client/Fh.cc | 2 +- src/client/Fh.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/client/Fh.cc b/src/client/Fh.cc index e72390df714..e7dd10b3666 100644 --- a/src/client/Fh.cc +++ b/src/client/Fh.cc @@ -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); diff --git a/src/client/Fh.h b/src/client/Fh.h index 3448f5b6ac8..4657fac8457 100644 --- a/src/client/Fh.h +++ b/src/client/Fh.h @@ -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 pos_waiters; // waiters for pos - UserPerm actor_perms; // perms I opened the file with - Readahead readahead; // file lock -- 2.39.5