fnode_t *p = new fnode_t;
*p = *get_projected_fnode();
projected_fnode.push_back(p);
+
if (scrub_infop && scrub_infop->last_scrub_dirty) {
+ p->localized_scrub_stamp = scrub_infop->last_local.time;
+ p->localized_scrub_version = scrub_infop->last_local.version;
p->recursive_scrub_stamp = scrub_infop->last_recursive.time;
p->recursive_scrub_version = scrub_infop->last_recursive.version;
scrub_infop->last_scrub_dirty = false;
scrub_maybe_delete_info();
+ }
+
dout(10) << "project_fnode " << p << dendl;
return p;
}
si->last_recursive.time = si->recursive_start.time =
fn->recursive_scrub_stamp;
+ si->last_local.version = fn->localized_scrub_version;
+ si->last_local.time = fn->localized_scrub_stamp;
+
me->scrub_infop = si;
}
scrub_infop->others_to_scrub.insert(i->first);
}
scrub_infop->directory_scrubbing = true;
+
+ assert(scrub_local()); // TODO: handle failure
}
void CDir::scrub_finished()
scrub_infop = NULL;
}
}
+
+bool CDir::scrub_local()
+{
+ assert(is_complete());
+ bool rval = check_rstats();
+
+ if (rval) {
+ scrub_info();
+ scrub_infop->last_local.time = ceph_clock_now(g_ceph_context);
+ scrub_infop->last_local.version = get_projected_version();
+ scrub_infop->last_scrub_dirty = true;
+ }
+ return rval;
+}
scrub_stamps recursive_start; // when we last started a recursive scrub
scrub_stamps last_recursive; // when we last finished a recursive scrub
+ scrub_stamps last_local; // when we last did a local scrub
+
bool directory_scrubbing; /// safety check
bool last_scrub_dirty; /// is scrub info dirty or is it flushed to fnode?
* scrub_dentry_next's listing. It finalizes the scrub statistics.
*/
void scrub_finished();
+ /**
+ * Tell the CDir to do a local scrub of itself.
+ * @pre The CDir is_complete().
+ * @returns true if the rstats and directory contents match, false otherwise.
+ */
+ bool scrub_local();
private:
/**
* Create a scrub_info_t struct for the scrub_infop pointer.
results->raw_rstats.error_str << "dirfrag is INCOMPLETE despite fetching; probably too large compared to MDS cache size?\n";
return true;
}
- assert(p->second->check_rstats());
+ assert(p->second->scrub_local());
sub_info.add(p->second->fnode.accounted_rstat);
}
// ...and that their sum matches our inode settings