Skip to content

Commit

Permalink
client: rename flush_caps() with no arguments to flush_caps_sync()
Browse files Browse the repository at this point in the history
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 <jlayton@redhat.com>
  • Loading branch information
jtlayton committed Nov 10, 2016
1 parent f23f959 commit ff9f277
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/client/Client.cc
Expand Up @@ -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<Inode*>::iterator p = delayed_caps.begin();
while (!p.end()) {
unsigned flags = CHECK_CAPS_NODELAY;
Expand Down Expand Up @@ -5773,7 +5778,7 @@ void Client::unmount()
}
}

flush_caps();
flush_caps_sync();
wait_sync_caps(last_flush_tid);

// empty lru cache
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/client/Client.h
Expand Up @@ -627,7 +627,7 @@ class Client : public Dispatcher, public md_config_obs_t {
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);
Expand Down

0 comments on commit ff9f277

Please sign in to comment.