Whamcloud - gitweb
LU-10308 misc: update Intel copyright messages for 2017
[fs/lustre-release.git] / lustre / mdd / mdd_orphans.c
index 594b3ae..1f5f819 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2014, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -45,7 +41,6 @@
 
 #include <obd.h>
 #include <obd_class.h>
-#include <lustre_ver.h>
 #include <obd_support.h>
 #include <lustre_fid.h>
 #include "mdd_internal.h"
@@ -317,9 +312,8 @@ static int orph_index_delete(const struct lu_env *env,
 }
 
 
-static int orphan_object_destroy(const struct lu_env *env,
-                                struct mdd_object *obj,
-                                struct dt_key *key)
+static int orphan_destroy(const struct lu_env *env, struct mdd_object *obj,
+                         struct dt_key *key)
 {
        struct thandle *th = NULL;
        struct mdd_device *mdd = mdo2mdd(&obj->mod_obj);
@@ -378,25 +372,24 @@ stop:
  * \retval -ve error
  */
 static int orph_key_test_and_del(const struct lu_env *env,
-                                 struct mdd_device *mdd,
-                                 struct lu_fid *lf,
-                                 struct dt_key *key)
+                                struct mdd_device *mdd, struct lu_fid *lf,
+                                struct dt_key *key)
 {
-        struct mdd_object *mdo;
-        int rc;
+       struct mdd_object *mdo;
+       int rc;
 
-        mdo = mdd_object_find(env, mdd, lf);
+       mdo = mdd_object_find(env, mdd, lf);
 
-        if (IS_ERR(mdo))
-                return PTR_ERR(mdo);
+       if (IS_ERR(mdo))
+               return PTR_ERR(mdo);
 
-        rc = -EBUSY;
-        if (mdo->mod_count == 0) {
-                CDEBUG(D_HA, "Found orphan "DFID", delete it\n", PFID(lf));
-                rc = orphan_object_destroy(env, mdo, key);
-                if (rc) /* so replay-single.sh test_37 works */
-                        CERROR("%s: error unlinking orphan "DFID" from "
-                               "PENDING: rc = %d\n",
+       rc = -EBUSY;
+       if (mdo->mod_count == 0) {
+               CDEBUG(D_HA, "Found orphan "DFID", delete it\n", PFID(lf));
+               rc = orphan_destroy(env, mdo, key);
+               if (rc) /* so replay-single.sh test_37 works */
+                       CERROR("%s: error unlinking orphan "DFID" from "
+                              "PENDING: rc = %d\n",
                               mdd2obd_dev(mdd)->obd_name, PFID(lf), rc);
         } else {
                 mdd_write_lock(env, mdo, MOR_TGT_CHILD);
@@ -543,7 +536,7 @@ int orph_index_init(const struct lu_env *env, struct mdd_device *mdd)
        if (!dt_try_as_dir(env, d)) {
                CERROR("%s: \"%s\" is not an index: rc = %d\n",
                       mdd2obd_dev(mdd)->obd_name, orph_index_name, rc);
-               lu_object_put(env, &d->do_lu);
+               dt_object_put(env, d);
                RETURN(-ENOTDIR);
        }
        mdd->mdd_orphans = d;
@@ -552,12 +545,12 @@ int orph_index_init(const struct lu_env *env, struct mdd_device *mdd)
 
 void orph_index_fini(const struct lu_env *env, struct mdd_device *mdd)
 {
-        ENTRY;
-        if (mdd->mdd_orphans != NULL) {
-                lu_object_put(env, &mdd->mdd_orphans->do_lu);
-                mdd->mdd_orphans = NULL;
-        }
-        EXIT;
+       ENTRY;
+       if (mdd->mdd_orphans != NULL) {
+               dt_object_put(env, mdd->mdd_orphans);
+               mdd->mdd_orphans = NULL;
+       }
+       EXIT;
 }
 
 static int __mdd_orphan_cleanup(void *args)