* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
#define DEBUG_SUBSYSTEM S_LMV
#ifdef __KERNEL__
#include <linux/slab.h>
#include <liblustre.h>
#endif
-#include <lustre_log.h>
+#include <lustre/lustre_idl.h>
#include <obd_support.h>
#include <lustre_lib.h>
#include <lustre_net.h>
CDEBUG(D_INFO, "Searching in lmv %p for uuid %s (activate=%d)\n",
lmv, uuid->uuid, activate);
- cfs_spin_lock(&lmv->lmv_lock);
+ spin_lock(&lmv->lmv_lock);
for (i = 0, tgt = lmv->tgts; i < lmv->desc.ld_tgt_count; i++, tgt++) {
if (tgt->ltd_exp == NULL)
continue;
EXIT;
out_lmv_lock:
- cfs_spin_unlock(&lmv->lmv_lock);
- return rc;
+ spin_unlock(&lmv->lmv_lock);
+ return rc;
}
static int lmv_set_mdc_data(struct lmv_obd *lmv, struct obd_uuid *uuid,
- struct obd_connect_data *data)
+ struct obd_connect_data *data)
{
- struct lmv_tgt_desc *tgt;
- int i;
- ENTRY;
+ struct lmv_tgt_desc *tgt;
+ int i;
+ ENTRY;
- LASSERT(data != NULL);
+ LASSERT(data != NULL);
- cfs_spin_lock(&lmv->lmv_lock);
- for (i = 0, tgt = lmv->tgts; i < lmv->desc.ld_tgt_count; i++, tgt++) {
- if (tgt->ltd_exp == NULL)
- continue;
+ spin_lock(&lmv->lmv_lock);
+ for (i = 0, tgt = lmv->tgts; i < lmv->desc.ld_tgt_count; i++, tgt++) {
+ if (tgt->ltd_exp == NULL)
+ continue;
- if (obd_uuid_equals(uuid, &tgt->ltd_uuid)) {
- lmv->datas[tgt->ltd_idx] = *data;
- break;
- }
- }
- cfs_spin_unlock(&lmv->lmv_lock);
- RETURN(0);
+ if (obd_uuid_equals(uuid, &tgt->ltd_uuid)) {
+ lmv->datas[tgt->ltd_idx] = *data;
+ break;
+ }
+ }
+ spin_unlock(&lmv->lmv_lock);
+ RETURN(0);
}
struct obd_uuid *lmv_get_uuid(struct obd_export *exp) {
/*
* Init fid sequence client for this mdc and add new fld target.
*/
- rc = obd_fid_init(mdc_exp);
+ rc = obd_fid_init(mdc_exp, LUSTRE_SEQ_METADATA);
if (rc)
RETURN(rc);
CERROR("Target %s not attached\n", tgt_uuid->uuid);
RETURN(-EINVAL);
}
-
- rc = obd_llog_init(obd, &obd->obd_olg, mdc_obd, NULL);
- if (rc) {
- lmv_init_unlock(lmv);
- CERROR("lmv failed to setup llogging subsystems\n");
- }
}
- cfs_spin_lock(&lmv->lmv_lock);
- tgt = lmv->tgts + lmv->desc.ld_tgt_count++;
- tgt->ltd_uuid = *tgt_uuid;
- cfs_spin_unlock(&lmv->lmv_lock);
-
- if (lmv->connected) {
- rc = lmv_connect_mdc(obd, tgt);
- if (rc) {
- cfs_spin_lock(&lmv->lmv_lock);
- lmv->desc.ld_tgt_count--;
- memset(tgt, 0, sizeof(*tgt));
- cfs_spin_unlock(&lmv->lmv_lock);
+ spin_lock(&lmv->lmv_lock);
+ tgt = lmv->tgts + lmv->desc.ld_tgt_count++;
+ tgt->ltd_uuid = *tgt_uuid;
+ spin_unlock(&lmv->lmv_lock);
+
+ if (lmv->connected) {
+ rc = lmv_connect_mdc(obd, tgt);
+ if (rc) {
+ spin_lock(&lmv->lmv_lock);
+ lmv->desc.ld_tgt_count--;
+ memset(tgt, 0, sizeof(*tgt));
+ spin_unlock(&lmv->lmv_lock);
} else {
int easize = sizeof(struct lmv_stripe_md) +
lmv->desc.ld_tgt_count *
* New seq alloc and FLD setup should be atomic. Otherwise we may find
* on server that seq in new allocated fid is not yet known.
*/
- cfs_mutex_lock(&tgt->ltd_fid_mutex);
+ mutex_lock(&tgt->ltd_fid_mutex);
if (!tgt->ltd_active)
GOTO(out, rc = -ENODEV);
EXIT;
out:
- cfs_mutex_unlock(&tgt->ltd_fid_mutex);
+ mutex_unlock(&tgt->ltd_fid_mutex);
return rc;
}
RETURN(rc);
}
-static int lmv_fid_delete(struct obd_export *exp, const struct lu_fid *fid)
-{
- ENTRY;
- LASSERT(exp != NULL && fid != NULL);
- if (lmv_object_delete(exp, fid)) {
- CDEBUG(D_INODE, "Object "DFID" is destroyed.\n",
- PFID(fid));
- }
- RETURN(0);
-}
-
static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
struct lmv_obd *lmv = &obd->u.lmv;
RETURN(-ENOMEM);
for (i = 0; i < LMV_MAX_TGT_COUNT; i++) {
- cfs_mutex_init(&lmv->tgts[i].ltd_fid_mutex);
+ mutex_init(&lmv->tgts[i].ltd_fid_mutex);
lmv->tgts[i].ltd_idx = i;
}
lmv->max_easize = 0;
lmv->lmv_placement = PLACEMENT_CHAR_POLICY;
- cfs_spin_lock_init(&lmv->lmv_lock);
- cfs_mutex_init(&lmv->init_mutex);
+ spin_lock_init(&lmv->lmv_lock);
+ mutex_init(&lmv->init_mutex);
rc = lmv_object_setup(obd);
if (rc) {
if (IS_ERR(tgt))
RETURN(PTR_ERR(tgt));
- if (op_data->op_valid & OBD_MD_MDTIDX) {
- op_data->op_mds = tgt->ltd_idx;
- RETURN(0);
- }
+ if (op_data->op_flags & MF_GET_MDT_IDX) {
+ op_data->op_mds = tgt->ltd_idx;
+ RETURN(0);
+ }
rc = md_getattr(tgt->ltd_exp, op_data, request);
if (rc)
lmv_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
struct lookup_intent *it, struct md_op_data *op_data,
struct lustre_handle *lockh, void *lmm, int lmmsize,
- struct ptlrpc_request **req, int extra_lock_flags)
+ struct ptlrpc_request **req, __u64 extra_lock_flags)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
case OBD_CLEANUP_EXPORTS:
fld_client_proc_fini(&lmv->lmv_fld);
lprocfs_obd_cleanup(obd);
- rc = obd_llog_finish(obd, 0);
- if (rc != 0)
- CERROR("failed to cleanup llogging subsystems\n");
break;
default:
break;
RETURN(rc);
}
-ldlm_mode_t lmv_lock_match(struct obd_export *exp, int flags,
+ldlm_mode_t lmv_lock_match(struct obd_export *exp, __u64 flags,
const struct lu_fid *fid, ldlm_type_t type,
ldlm_policy_data_t *policy, ldlm_mode_t mode,
struct lustre_handle *lockh)
.o_notify = lmv_notify,
.o_get_uuid = lmv_get_uuid,
.o_iocontrol = lmv_iocontrol,
- .o_fid_delete = lmv_fid_delete,
.o_quotacheck = lmv_quotacheck,
.o_quotactl = lmv_quotactl
};