/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * lustre/cmm/cmm_device.c
- * Lustre Cluster Metadata Manager (cmm)
+ * GPL HEADER START
*
- * Copyright (c) 2006 Cluster File Systems, Inc.
- * Author: Mike Pershin <tappro@clusterfs.com>
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * This file is part of the Lustre file system, http://www.lustre.org
- * Lustre is a trademark of Cluster File Systems, Inc.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
*
- * You may have signed or agreed to another license before downloading
- * this software. If so, you are bound by the terms and conditions
- * of that agreement, and the following does not apply to you. See the
- * LICENSE file included with this distribution for more information.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
*
- * If you did not agree to a different license, then this copy of Lustre
- * is open source software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
+ * 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
*
- * In either case, Lustre is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * license text for more details.
+ * 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.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lustre/cmm/cmm_device.c
+ *
+ * Lustre Cluster Metadata Manager (cmm)
+ *
+ * Author: Mike Pershin <tappro@clusterfs.com>
*/
#ifndef EXPORT_SYMTAB
spin_lock(&cmm->cmm_tgt_guard);
list_for_each_entry_safe(mc, tmp, &cmm->cmm_targets,
mc_linkage) {
- mdc_init_ea_size(env, mc, max_mdsize, max_cookiesize);
+ cmm_mdc_init_ea_size(env, mc, max_mdsize, max_cookiesize);
}
spin_unlock(&cmm->cmm_tgt_guard);
RETURN(rc);
}
spin_unlock(&cm->cmm_tgt_guard);
ld = ldt->ldt_ops->ldto_device_alloc(env, ldt, cfg);
+ if (IS_ERR(ld))
+ RETURN(PTR_ERR(ld));
+
ld->ld_site = cmm2lu_dev(cm)->ld_site;
rc = ldt->ldt_ops->ldto_device_init(env, ld, NULL, NULL);
if (rc) {
ldt->ldt_ops->ldto_device_free(env, ld);
- RETURN (rc);
+ RETURN(rc);
}
/* pass config to the just created MDC */
rc = ld->ld_ops->ldo_process_config(env, ld, cfg);
- if (rc)
+ if (rc) {
+ ldt->ldt_ops->ldto_device_fini(env, ld);
+ ldt->ldt_ops->ldto_device_free(env, ld);
RETURN(rc);
+ }
spin_lock(&cm->cmm_tgt_guard);
list_for_each_entry_safe(mc, tmp, &cm->cmm_targets,
return l;
}
-static void cmm_device_free(const struct lu_env *env, struct lu_device *d)
+static struct lu_device *cmm_device_free(const struct lu_env *env,
+ struct lu_device *d)
{
struct cmm_device *m = lu2cmm_dev(d);
+ struct lu_device *next = md2lu_dev(m->cmm_child);
+ ENTRY;
LASSERT(m->cmm_tgt_count == 0);
LASSERT(list_empty(&m->cmm_targets));
OBD_FREE_PTR(m->cmm_fld);
m->cmm_fld = NULL;
}
- md_device_fini(&m->cmm_md_dev);
+ md_device_fini(&m->cmm_md_dev);
OBD_FREE_PTR(m);
+ RETURN(next);
}
-/* context key constructor/destructor */
+/* context key constructor/destructor: cmm_key_init, cmm_key_fini */
LU_KEY_INIT_FINI(cmm, struct cmm_thread_info);
+/* context key: cmm_thread_key */
LU_CONTEXT_KEY_DEFINE(cmm, LCT_MD_THREAD);
struct cmm_thread_info *cmm_env_info(const struct lu_env *env)
return info;
}
+/* type constructor/destructor: cmm_type_init/cmm_type_fini */
LU_TYPE_INIT_FINI(cmm, &cmm_thread_key);
static int cmm_device_init(const struct lu_env *env, struct lu_device *d,
ENTRY;
spin_lock_init(&m->cmm_tgt_guard);
- INIT_LIST_HEAD(&m->cmm_targets);
+ CFS_INIT_LIST_HEAD(&m->cmm_targets);
m->cmm_tgt_count = 0;
m->cmm_child = lu2md_dev(next);
{ 0 }
};
-LPROCFS_INIT_VARS(cmm, lprocfs_cmm_module_vars, lprocfs_cmm_obd_vars);
+static void lprocfs_cmm_init_vars(struct lprocfs_static_vars *lvars)
+{
+ lvars->module_vars = lprocfs_cmm_module_vars;
+ lvars->obd_vars = lprocfs_cmm_obd_vars;
+}
static int __init cmm_mod_init(void)
{
struct lprocfs_static_vars lvars;
- lprocfs_init_vars(cmm, &lvars);
+ lprocfs_cmm_init_vars(&lvars);
return class_register_type(&cmm_obd_device_ops, NULL, lvars.module_vars,
LUSTRE_CMM_NAME, &cmm_device_type);
}
class_unregister_type(LUSTRE_CMM_NAME);
}
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
MODULE_DESCRIPTION("Lustre Clustered Metadata Manager ("LUSTRE_CMM_NAME")");
MODULE_LICENSE("GPL");