last_tid = 0;
last_flush_seq = 0;
- last_flush_tid = 0;
unsafe_sync_write = 0;
}
in->flushing_caps |= flush;
in->dirty_caps = 0;
- flush_tid = ++last_flush_tid;
+ flush_tid = ++in->last_flush_tid;
//set the tid for each cap we're flushing
for (int i = 0; i < CEPH_CAP_BITS; ++i) {
if (flush & (1<<i))
<< " on " << *in << dendl;
if (p->second.dirty_data || p->second.writing)
continue;
- p->second.flush_tid = ++last_flush_tid;
+ p->second.flush_tid = ++in->last_flush_tid;
MClientCaps *m = new MClientCaps(CEPH_CAP_OP_FLUSHSNAP, in->ino, in->snaprealm->ino, 0, mseq);
m->set_client_tid(p->second.flush_tid);
m->head.snap_follows = p->first;
dout(20) << " reflushing caps on " << *in << " to mds" << mds << dendl;
InodeCap *cap = in->auth_cap;
assert(cap->session == session);
- //ugh, it's a lot of comparisons to push the caps on same tid out together
- int flush_now;
- int already_flushed = 0;
- for (int i=0; i<CEPH_CAP_BITS; ++i) {
- if ((in->flushing_caps & 1<<i) &&
- !(already_flushed & 1<<i)) {
- flush_now = 0;
- flush_now |= 1<<i;
- for (int j=i+1; j<CEPH_CAP_BITS; ++j) {
- if ((in->flushing_caps & 1<<j) &&
- ( in->flushing_cap_tid[j] == in->flushing_cap_tid[i]))
- flush_now |= 1<<j;
+ //if the inode is flushing caps, pick a new tid,
+ //set all the cap acks to that tid, and send off
+ //a message saying so to the new MDS.
+ if (in->flushing_caps) {
+ tid_t new_flush_tid = ++in->last_flush_tid;
+ for (int i=0; i<CEPH_CAP_BITS; ++i) {
+ if ((in->flushing_caps & 1<<i)) {
+ in->flushing_cap_tid[i] = new_flush_tid;
}
- send_cap(in, mds, cap, in->caps_used(), in->caps_wanted(),
- cap->issued | cap->implemented,
- flush_now, in->flushing_cap_tid[i]);
}
+ send_cap(in, mds, cap, in->caps_used(), in->caps_wanted(),
+ cap->issued | cap->implemented,
+ in->flushing_caps, new_flush_tid);
}
}
}
ceph_seq_t exporting_mseq;
utime_t hold_caps_until;
xlist<Inode*>::item cap_item, flushing_cap_item;
+ tid_t last_flush_tid;
SnapRealm *snaprealm;
xlist<Inode*>::item snaprealm_item;
dirty_caps(0), flushing_caps(0), flushing_cap_seq(0), shared_gen(0), cache_gen(0),
snap_caps(0), snap_cap_refs(0),
exporting_issued(0), exporting_mds(-1), exporting_mseq(0),
- cap_item(this), flushing_cap_item(this),
+ cap_item(this), flushing_cap_item(this), last_flush_tid(0),
snaprealm(0), snaprealm_item(this), snapdir_parent(0),
reported_size(0), wanted_max_size(0), requested_max_size(0),
ref(0), ll_ref(0),
// mds requests
- tid_t last_tid, last_flush_seq, last_flush_tid;
+ tid_t last_tid, last_flush_seq;
map<tid_t, MetaRequest*> mds_requests;
set<int> failed_mds;