*
* 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
*/
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <obd.h>
#include <obd_class.h>
-#include <lustre_ver.h>
#include <obd_support.h>
#include <lustre_fid.h>
#include "mdd_internal.h"
rec->rec_fid = lf;
rec->rec_type = mdd_object_type(obj);
- return dt_insert(env, dor, (const struct dt_rec *)rec, key, th,
- BYPASS_CAPA, 1);
+ return dt_insert(env, dor, (const struct dt_rec *)rec, key, th, 1);
}
static inline int mdd_orphan_delete_obj(const struct lu_env *env,
{
struct dt_object *dor = mdd->mdd_orphans;
- return dt_delete(env, dor, key, th, BYPASS_CAPA);
+ return dt_delete(env, dor, key, th);
}
static inline int mdd_orphan_ref_add(const struct lu_env *env,
if (!dt_try_as_dir(env, next))
GOTO(out, rc = 0);
- dt_delete(env, next, (const struct dt_key *)dotdot, th, BYPASS_CAPA);
+ dt_delete(env, next, (const struct dt_key *)dotdot, th);
rec->rec_fid = lf_dor;
rec->rec_type = S_IFDIR;
dt_insert(env, next, (const struct dt_rec *)rec,
- (const struct dt_key *)dotdot, th, BYPASS_CAPA, 1);
+ (const struct dt_key *)dotdot, th, 1);
out:
if (rc == 0)
}
-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);
- 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)) {
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))) {
}
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);
}
/**
* \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);
ENTRY;
iops = &dor->do_index_ops->dio_it;
- it = iops->init(env, dor, LUDA_64BITHASH, BYPASS_CAPA);
+ it = iops->init(env, dor, LUDA_64BITHASH);
if (IS_ERR(it)) {
rc = PTR_ERR(it);
CERROR("%s: cannot clean PENDING: rc = %d\n",
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;
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)