]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: remove redundant checks for null ScrubHeader
authorJohn Spray <john.spray@redhat.com>
Mon, 19 Sep 2016 16:35:54 +0000 (17:35 +0100)
committerNathan Cutler <ncutler@suse.com>
Mon, 19 Jun 2017 21:22:52 +0000 (23:22 +0200)
This was originally optional but now all the paths
that kick off a scrub should be going through
enqueue_scrub and thereby getting a header set.

Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 0c890282699f877f42870408d674ec1e9f9322a3)

Conflicts:
src/mds/CInode.cc (jewel does not have 5259683e7819c22c14b21b1dd678a33e14574f21)

src/mds/CDir.cc
src/mds/CInode.cc
src/mds/MDCache.cc
src/mds/ScrubHeader.h

index 475fcc7ef7288993fa01b1cf307fb25b377e9767..d5283e2036cf4feeddb6fb6858ae6d56e2605cfc 100644 (file)
@@ -2952,6 +2952,7 @@ void CDir::scrub_initialize(const ScrubHeaderRefConst& header)
 {
   dout(20) << __func__ << dendl;
   assert(is_complete());
+  assert(header != nullptr);
 
   // FIXME: weird implicit construction, is someone else meant
   // to be calling scrub_info_create first?
@@ -3039,7 +3040,7 @@ int CDir::_next_dentry_on_set(set<dentry_key_t>& dns, bool missing_okay,
     dns.erase(dnkey);
 
     if (dn->get_projected_version() < scrub_infop->last_recursive.version &&
-       !(scrub_infop->header && scrub_infop->header->force)) {
+       !(scrub_infop->header->force)) {
       dout(15) << " skip dentry " << dnkey.name
               << ", no change since last scrub" << dendl;
       continue;
@@ -3145,8 +3146,7 @@ bool CDir::scrub_local()
     scrub_infop->last_scrub_dirty = true;
   } else {
     scrub_infop->pending_scrub_error = true;
-    if (scrub_infop->header &&
-       scrub_infop->header->repair)
+    if (scrub_infop->header->repair)
       cache->repair_dirfrag_stats(this);
   }
   return rval;
index 811f463354cda2f4f5ca27713cdeeb9be1c2cc13..41dbfaf69bfcbc91629d6755e8d1fc5d73a7b260 100644 (file)
@@ -3762,7 +3762,7 @@ void CInode::validate_disk_state(CInode::validated_data *results,
 
       // Whether we have a tag to apply depends on ScrubHeader (if one is
       // present)
-      if (in->scrub_infop && in->scrub_infop->header) {
+      if (in->scrub_infop) {
         // I'm a non-orphan, so look up my ScrubHeader via my linkage
         const std::string &tag = in->scrub_infop->header->tag;
         // Rather than using the usual CInode::fetch_backtrace,
@@ -3888,7 +3888,7 @@ next:
           ++p) {
         CDir *dir = in->get_or_open_dirfrag(in->mdcache, *p);
        dir->scrub_info();
-       if (!dir->scrub_infop->header && in->scrub_infop)
+       if (!dir->scrub_infop->header)
          dir->scrub_infop->header = in->scrub_infop->header;
         if (dir->is_complete()) {
          dir->scrub_local();
@@ -3933,8 +3933,7 @@ next:
        if (dir->scrub_infop &&
            dir->scrub_infop->pending_scrub_error) {
          dir->scrub_infop->pending_scrub_error = false;
-         if (dir->scrub_infop->header &&
-             dir->scrub_infop->header->repair) {
+         if (dir->scrub_infop->header->repair) {
            results->raw_stats.error_str
              << "dirfrag(" << p->first << ") has bad stats (will be fixed); ";
          } else {
@@ -3949,7 +3948,6 @@ next:
       if (!dir_info.same_sums(in->inode.dirstat) ||
          !nest_info.same_sums(in->inode.rstat)) {
        if (in->scrub_infop &&
-           in->scrub_infop->header &&
            in->scrub_infop->header->repair) {
          results->raw_stats.error_str
            << "freshly-calculated rstats don't match existing ones (will be fixed)";
@@ -4290,7 +4288,7 @@ void CInode::scrub_finished(MDSInternalContextBase **c) {
   *c = scrub_infop->on_finish;
   scrub_infop->on_finish = NULL;
 
-  if (scrub_infop->header && scrub_infop->header->origin == this) {
+  if (scrub_infop->header->origin == this) {
     // We are at the point that a tagging scrub was initiated
     LogChannelRef clog = mdcache->mds->clog;
     clog->info() << "scrub complete with tag '" << scrub_infop->header->tag << "'";
index d3e9336c36800f916405be9ed1ac0ef840ae2a39..4f81c587f45a4327e86ef1f856a2ab708f65a2e1 100644 (file)
@@ -11916,9 +11916,11 @@ void MDCache::enqueue_scrub_work(MDRequestRef& mdr)
   ScrubHeaderRef &header = cs->header;
 
   // Cannot scrub same dentry twice at same time
-  if (in->scrub_info()->scrub_in_progress) {
+  if (in->scrub_infop && in->scrub_infop->scrub_in_progress) {
     mds->server->respond_to_request(mdr, -EBUSY);
     return;
+  } else {
+    in->scrub_info();
   }
 
   header->origin = in;
index 72231b5888c78e89b2941903a87fc433e72db062..c5939304d4fd8db045348b14c11b0ec285af40dd 100644 (file)
@@ -7,9 +7,6 @@ class CInode;
 /**
  * Externally input parameters for a scrub, associated with the root
  * of where we are doing a recursive scrub
- *
- * TODO: swallow up 'recurse' and 'children' settings here instead of
- * passing them down into every scrub_info structure
  */
 class ScrubHeader {
 public: