-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* 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) {
if (tgts->ltd_exp == NULL)
continue;
- obd_set_info_async(tgts->ltd_exp, sizeof(KEY_INTERMDS),
+ obd_set_info_async(NULL, tgts->ltd_exp, sizeof(KEY_INTERMDS),
KEY_INTERMDS, 0, NULL, NULL);
}
}
/*
* 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 *
(int) sizeof(struct obd_uuid))))
RETURN(-EFAULT);
- rc = obd_statfs(mdc_obd, &stat_buf,
+ rc = obd_statfs(NULL, lmv->tgts[index].ltd_exp, &stat_buf,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
0);
if (rc)
* 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) {
RETURN(rc);
}
-static int lmv_statfs(struct obd_device *obd, struct obd_statfs *osfs,
- __u64 max_age, __u32 flags)
+static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
+ struct obd_statfs *osfs, __u64 max_age, __u32 flags)
{
+ struct obd_device *obd = class_exp2obd(exp);
struct lmv_obd *lmv = &obd->u.lmv;
struct obd_statfs *temp;
int rc = 0;
if (lmv->tgts[i].ltd_exp == NULL)
continue;
- rc = obd_statfs(lmv->tgts[i].ltd_exp->exp_obd, temp,
+ rc = obd_statfs(env, lmv->tgts[i].ltd_exp, temp,
max_age, flags);
if (rc) {
CERROR("can't stat MDS #%d (%s), error %d\n", i,
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);
}
-static int lmv_get_info(struct obd_export *exp, __u32 keylen,
- void *key, __u32 *vallen, void *val,
+static int lmv_get_info(const struct lu_env *env, struct obd_export *exp,
+ __u32 keylen, void *key, __u32 *vallen, void *val,
struct lov_stripe_md *lsm)
{
struct obd_device *obd;
continue;
}
- if (!obd_get_info(tgts->ltd_exp, keylen, key,
+ if (!obd_get_info(env, tgts->ltd_exp, keylen, key,
vallen, val, NULL))
RETURN(0);
}
* Forwarding this request to first MDS, it should know LOV
* desc.
*/
- rc = obd_get_info(lmv->tgts[0].ltd_exp, keylen, key,
+ rc = obd_get_info(env, lmv->tgts[0].ltd_exp, keylen, key,
vallen, val, NULL);
if (!rc && KEY_IS(KEY_CONN_DATA)) {
exp->exp_connect_flags =
RETURN(-EINVAL);
}
-int lmv_set_info_async(struct obd_export *exp, obd_count keylen,
- void *key, obd_count vallen, void *val,
- struct ptlrpc_request_set *set)
+int lmv_set_info_async(const struct lu_env *env, struct obd_export *exp,
+ obd_count keylen, void *key, obd_count vallen,
+ void *val, struct ptlrpc_request_set *set)
{
struct lmv_tgt_desc *tgt;
struct obd_device *obd;
if (!tgt->ltd_exp)
continue;
- err = obd_set_info_async(tgt->ltd_exp,
+ err = obd_set_info_async(env, tgt->ltd_exp,
keylen, key, vallen, val, set);
if (err && rc == 0)
rc = err;
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
};