tick_event(NULL),
monclient(mc), messenger(m), whoami(m->get_myname().num()),
cap_epoch_barrier(0),
- last_tid(0), oldest_tid(0), last_flush_seq(0), last_flush_tid(1),
+ last_tid(0), oldest_tid(0), last_flush_tid(1),
initialized(false), authenticated(false),
mounted(false), unmounting(false),
local_osd(-1), local_osd_epoch(0),
if (!in->flushing_caps) {
ldout(cct, 10) << "mark_caps_flushing " << ccap_string(flushing) << " " << *in << dendl;
- in->flushing_cap_seq = ++last_flush_seq;
num_flushing_caps++;
} else {
ldout(cct, 10) << "mark_caps_flushing (more) " << ccap_string(flushing) << " " << *in << dendl;
}
}
-void Client::wait_sync_caps(uint64_t want)
+void Client::wait_sync_caps(ceph_tid_t want)
{
retry:
- ldout(cct, 10) << "wait_sync_caps want " << want << " (last is " << last_flush_seq << ", "
+ ldout(cct, 10) << "wait_sync_caps want " << want << " (last is " << last_flush_tid << ", "
<< num_flushing_caps << " total flushing)" << dendl;
for (map<mds_rank_t,MetaSession*>::iterator p = mds_sessions.begin();
p != mds_sessions.end();
++p) {
- if (p->second->flushing_caps.empty())
+ MetaSession *s = p->second;
+ if (s->flushing_caps_tids.empty())
continue;
- Inode *in = p->second->flushing_caps.front();
- if (in->flushing_cap_seq <= want) {
- ldout(cct, 10) << " waiting on mds." << p->first << " tid " << in->flushing_cap_seq
- << " (want " << want << ")" << dendl;
+ ceph_tid_t oldest_tid = *s->flushing_caps_tids.begin();
+ if (oldest_tid <= want) {
+ ldout(cct, 10) << " waiting on mds." << p->first << " tid " << oldest_tid
+ << " (want " << want << ")" << dendl;
sync_cond.Wait(client_lock);
goto retry;
}
<< " cleaned " << ccap_string(cleaned) << " on " << *in
<< " with " << ccap_string(dirty) << dendl;
- if (flushed)
+ if (flushed) {
signal_cond_list(in->waitfor_caps);
+ if (session->flushing_caps_tids.empty() ||
+ *session->flushing_caps_tids.begin() > flush_ack_tid)
+ sync_cond.Signal();
+ }
if (!cleaned) {
ldout(cct, 10) << " tid " << m->get_client_tid() << " != any cap bit tids" << dendl;
ldout(cct, 10) << " " << *in << " !flushing" << dendl;
in->flushing_cap_item.remove_myself();
num_flushing_caps--;
- sync_cond.Signal();
}
if (!in->caps_dirty())
put_inode(in);
}
flush_caps();
- wait_sync_caps(last_flush_seq);
+ wait_sync_caps(last_flush_tid);
// empty lru cache
lru.lru_set_max(0);
// flush caps
flush_caps();
- wait_sync_caps(last_flush_seq);
+ wait_sync_caps(last_flush_tid);
// flush file data
// FIXME
// mds requests
ceph_tid_t last_tid;
ceph_tid_t oldest_tid; // oldest incomplete mds request, excluding setfilelock requests
- ceph_tid_t last_flush_seq;
ceph_tid_t last_flush_tid;
map<ceph_tid_t, MetaRequest*> mds_requests;
void put_cap_ref(Inode *in, int cap);
void flush_snaps(Inode *in, bool all_again=false, CapSnap *again=0);
void wait_sync_caps(Inode *in, ceph_tid_t want);
- void wait_sync_caps(uint64_t want);
+ void wait_sync_caps(ceph_tid_t want);
void queue_cap_snap(Inode *in, SnapContext &old_snapc);
void finish_cap_snap(Inode *in, CapSnap *capsnap, int used);
void _flushed_cap_snap(Inode *in, snapid_t seq);
map<mds_rank_t, Cap*> caps; // mds -> Cap
Cap *auth_cap;
unsigned dirty_caps, flushing_caps;
- uint64_t flushing_cap_seq;
std::map<ceph_tid_t, int> flushing_cap_tids;
int shared_gen, cache_gen;
int snap_caps, snap_cap_refs;
flags(0),
qtree(NULL),
dir_hashed(false), dir_replicated(false), auth_cap(NULL),
- dirty_caps(0), flushing_caps(0), flushing_cap_seq(0), shared_gen(0), cache_gen(0),
+ dirty_caps(0), flushing_caps(0), shared_gen(0), cache_gen(0),
snap_caps(0), snap_cap_refs(0),
cap_item(this), flushing_cap_item(this),
snaprealm(0), snaprealm_item(this),