From bc3dd60e9903eaf3228e06729880109a5da66175 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 16 Mar 2017 14:30:52 -0400 Subject: [PATCH] client: move Fh init to ctor Signed-off-by: Patrick Donnelly --- src/client/Client.cc | 9 ++------- src/client/Fh.cc | 6 +++--- src/client/Fh.h | 3 ++- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 049f33b8ad7..f4ef49ea817 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -8329,15 +8329,10 @@ int Client::lookup_name(Inode *ino, Inode *parent, const UserPerm& perms) } - Fh *Client::_create_fh(Inode *in, int flags, int cmode, const UserPerm& perms) +Fh *Client::_create_fh(Inode *in, int flags, int cmode, const UserPerm& perms) { assert(in); - Fh *f = new Fh(in); - f->mode = cmode; - f->flags = flags; - - // inode - f->actor_perms = perms; + Fh *f = new Fh(in, flags, cmode, perms); ldout(cct, 10) << "_create_fh " << in->ino << " mode " << cmode << dendl; diff --git a/src/client/Fh.cc b/src/client/Fh.cc index e42a9d4128e..b2c68a2cb37 100644 --- a/src/client/Fh.cc +++ b/src/client/Fh.cc @@ -18,9 +18,9 @@ #include "Fh.h" -Fh::Fh(Inode *in) : inode(in), _ref(1), pos(0), mds(0), mode(0), flags(0), - pos_locked(false), actor_perms(), readahead(), - fcntl_locks(NULL), flock_locks(NULL) +Fh::Fh(InodeRef in, int flags, int cmode, const UserPerm &perms) : + inode(in), _ref(1), pos(0), mds(0), mode(cmode), flags(flags), pos_locked(false), + actor_perms(perms), readahead(), fcntl_locks(NULL), flock_locks(NULL) { inode->add_fh(this); } diff --git a/src/client/Fh.h b/src/client/Fh.h index 33733a5e1c1..979456c5a16 100644 --- a/src/client/Fh.h +++ b/src/client/Fh.h @@ -44,7 +44,8 @@ struct Fh { return e; } - Fh(Inode *in); + Fh() = delete; + Fh(InodeRef in, int flags, int cmode, const UserPerm &perms); ~Fh(); void get() { ++_ref; } int put() { return --_ref; } -- 2.47.3