Whamcloud - gitweb
LU-8526 tests: ensure all OSTs active for allocations
[fs/lustre-release.git] / lustre / mdd / mdd_orphans.c
index e7ce0fd..336f073 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, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -318,13 +314,13 @@ 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)
+                                struct mdd_object *obj,
+                                struct dt_key *key)
 {
-        struct thandle *th = NULL;
-        struct mdd_device *mdd = mdo2mdd(&obj->mod_obj);
-        int rc = 0;
-        ENTRY;
+       struct thandle *th = NULL;
+       struct mdd_device *mdd = mdo2mdd(&obj->mod_obj);
+       int rc = 0;
+       ENTRY;
 
        th = mdd_trans_create(env, mdd);
        if (IS_ERR(th)) {
@@ -332,22 +328,22 @@ static int orphan_object_destroy(const struct lu_env *env,
                RETURN(PTR_ERR(th));
        }
 
-        rc = orph_declare_index_delete(env, obj, th);
-        if (rc)
-                GOTO(stop, rc);
+       rc = orph_declare_index_delete(env, obj, th);
+       if (rc)
+               GOTO(stop, rc);
 
        rc = mdo_declare_destroy(env, obj, th);
-        if (rc)
-                GOTO(stop, rc);
+       if (rc)
+               GOTO(stop, rc);
 
-        rc = mdd_trans_start(env, mdd, th);
-        if (rc)
-                GOTO(stop, rc);
+       rc = mdd_trans_start(env, mdd, th);
+       if (rc)
+               GOTO(stop, rc);
 
-        mdd_write_lock(env, obj, MOR_TGT_CHILD);
-        if (likely(obj->mod_count == 0)) {
-                mdd_orphan_write_lock(env, mdd);
-                rc = mdd_orphan_delete_obj(env, mdd, key, th);
+       mdd_write_lock(env, obj, MOR_TGT_CHILD);
+       if (likely(obj->mod_count == 0)) {
+               mdd_orphan_write_lock(env, mdd);
+               rc = mdd_orphan_delete_obj(env, mdd, key, th);
                if (rc == 0) {
                        mdo_ref_del(env, obj, th);
                        if (S_ISDIR(mdd_object_type(obj))) {
@@ -356,15 +352,15 @@ static int orphan_object_destroy(const struct lu_env *env,
                        }
                        rc = mdo_destroy(env, obj, th);
                } else
-                        CERROR("could not delete object: rc = %d\n",rc);
-                mdd_orphan_write_unlock(env, mdd);
-        }
-        mdd_write_unlock(env, obj);
+                       CERROR("could not delete object: rc = %d\n", rc);
+               mdd_orphan_write_unlock(env, mdd);
+       }
+       mdd_write_unlock(env, obj);
 
 stop:
-        mdd_trans_stop(env, mdd, 0, th);
+       rc = mdd_trans_stop(env, mdd, 0, th);
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 /**