// CDir
CDir::CDir(CInode *in, frag_t fg, MDCache *mdcache, bool auth) :
+ dirty_rstat_inodes(member_offset(CInode, dirty_rstat_item)),
item_dirty(this), item_new(this)
{
g_num_dir++;
snapid_t first;
map<snapid_t,old_rstat_t> dirty_old_rstat; // [value.first,key]
+ // my inodes with dirty rstat data
+ elist<CInode*> dirty_rstat_inodes;
+
protected:
version_t projected_version;
list<fnode_t*> projected_fnode;
}
+
+void CInode::mark_dirty_rstat()
+{
+ if (!state_test(STATE_DIRTYRSTAT)) {
+ dout(10) << "mark_dirty_rstat" << dendl;
+ state_set(STATE_DIRTYRSTAT);
+ get(PIN_DIRTYRSTAT);
+ CDentry *dn = get_projected_parent_dn();
+ dn->dir->dirty_rstat_inodes.push_back(&dirty_rstat_item);
+ }
+}
+void CInode::clear_dirty_rstat()
+{
+ if (state_test(STATE_DIRTYRSTAT)) {
+ dout(10) << "clear_dirty_rstat" << dendl;
+ state_clear(STATE_DIRTYRSTAT);
+ put(PIN_DIRTYRSTAT);
+ dirty_rstat_item.remove_myself();
+ }
+}
+
inode_t *CInode::project_inode(map<string,bufferptr> *px)
{
if (projected_nodes.empty()) {
static const int PIN_TRUNCATING = 18;
static const int PIN_STRAY = 19; // we pin our stray inode while active
static const int PIN_NEEDSNAPFLUSH = 20;
+ static const int PIN_DIRTYRSTAT = 21;
const char *pin_name(int p) {
switch (p) {
case PIN_TRUNCATING: return "truncating";
case PIN_STRAY: return "stray";
case PIN_NEEDSNAPFLUSH: return "needsnapflush";
+ case PIN_DIRTYRSTAT: return "dirtyrstat";
default: return generic_pin_name(p);
}
}
static const int STATE_RECOVERING = (1<<12);
static const int STATE_PURGING = (1<<13);
static const int STATE_DIRTYPARENT = (1<<14);
+ static const int STATE_DIRTYRSTAT = (1<<15);
// -- waiters --
static const uint64_t WAIT_DIR = (1<<0);
//loff_t last_open_journaled; // log offset for the last journaled EOpen
utime_t last_dirstat_prop;
+
+ // list item node for when we have unpropagated rstat data
+ elist<CInode*>::item dirty_rstat_item;
+
+ bool is_dirty_rstat() {
+ return state_test(STATE_DIRTYRSTAT);
+ }
+ void mark_dirty_rstat();
+ void clear_dirty_rstat();
+
//bool hack_accessed;
//utime_t hack_load_stamp;