From: Jeff Layton Date: Thu, 10 Nov 2016 11:30:27 +0000 (-0500) Subject: client: rename flush_caps() with no arguments to flush_caps_sync() X-Git-Tag: v11.1.0~333^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a374166c68bb5a47654352560b971be62ad83be8;p=ceph.git client: rename flush_caps() with no arguments to flush_caps_sync() Per Greg's recommendation, change the name of this function to better indicate what it does now that we always request a journal flush on the last cap flush. Also, add a comment above the function to better explain why we do this. Signed-off-by: Jeff Layton --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 9f0517a6b7b..44dd55ae485 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -4113,9 +4113,14 @@ void Client::adjust_session_flushing_caps(Inode *in, MetaSession *old_s, MetaSe new_s->flushing_caps.push_back(&in->flushing_cap_item); } -void Client::flush_caps() +/* + * Flush all caps back to the MDS. Because the callers generally wait on the + * result of this function (syncfs and umount cases), we set + * CHECK_CAPS_SYNCHRONOUS on the last check_caps call. + */ +void Client::flush_caps_sync() { - ldout(cct, 10) << "flush_caps" << dendl; + ldout(cct, 10) << __func__ << dendl; xlist::iterator p = delayed_caps.begin(); while (!p.end()) { unsigned flags = CHECK_CAPS_NODELAY; @@ -5773,7 +5778,7 @@ void Client::unmount() } } - flush_caps(); + flush_caps_sync(); wait_sync_caps(last_flush_tid); // empty lru cache @@ -9670,7 +9675,7 @@ int Client::_sync_fs() flush_done = true; // flush caps - flush_caps(); + flush_caps_sync(); ceph_tid_t flush_tid = last_flush_tid; // wait for unsafe mds requests diff --git a/src/client/Client.h b/src/client/Client.h index 155385d192f..636de56f27b 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -627,7 +627,7 @@ protected: void mark_caps_dirty(Inode *in, int caps); int mark_caps_flushing(Inode *in, ceph_tid_t *ptid); void adjust_session_flushing_caps(Inode *in, MetaSession *old_s, MetaSession *new_s); - void flush_caps(); + void flush_caps_sync(); void flush_caps(Inode *in, MetaSession *session, bool sync=false); void kick_flushing_caps(MetaSession *session); void early_kick_flushing_caps(MetaSession *session);