-/* -*- MODE: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
+/*
+ * GPL HEADER START
*
- * lustre/fld/fld_handler.c
- * FLD (Fids Location Database)
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright (C) 2006 Cluster File Systems, Inc.
- * Author: Yury Umanets <umka@clusterfs.com>
- * WangDi <wangdi@clusterfs.com>
+ * 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.
*
- * 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 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).
*
- * 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.
+ * 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
*
- * 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.
+ * 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.
*
- * 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.
+ * GPL HEADER END
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2013, Intel Corporation.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lustre/fld/fld_handler.c
+ *
+ * FLD (Fids Location Database)
+ *
+ * Author: Yury Umanets <umka@clusterfs.com>
+ * Author: WangDi <wangdi@clusterfs.com>
+ * Author: Pravin Shelar <pravin.shelar@sun.com>
+ */
+
#define DEBUG_SUBSYSTEM S_FLD
-#ifdef __KERNEL__
-# include <libcfs/libcfs.h>
-# include <linux/module.h>
-# include <linux/jbd.h>
-# include <asm/div64.h>
-#else /* __KERNEL__ */
-# include <liblustre.h>
-# include <libcfs/list.h>
-#endif
+#include <libcfs/libcfs.h>
+#include <linux/module.h>
#include <obd.h>
-#include <obd_class.h>
-#include <lustre_ver.h>
#include <obd_support.h>
-#include <lprocfs_status.h>
-
+#include <lustre_fid.h>
+#include <lustre_fld.h>
#include <md_object.h>
#include <lustre_req_layout.h>
+#include <lprocfs_status.h>
#include "fld_internal.h"
-#ifdef __KERNEL__
-
+/* context key constructor/destructor: fld_key_init, fld_key_fini */
LU_KEY_INIT_FINI(fld, struct fld_thread_info);
-LU_CONTEXT_KEY_DEFINE(fld, LCT_MD_THREAD|LCT_DT_THREAD);
+/* context key: fld_thread_key */
+/* MGS thread may create llog file causing FLD lookup */
+LU_CONTEXT_KEY_DEFINE(fld, LCT_MD_THREAD | LCT_DT_THREAD | LCT_MG_THREAD);
-cfs_proc_dir_entry_t *fld_type_proc_dir = NULL;
-
-static int __init fld_mod_init(void)
+int fld_server_mod_init(void)
{
- fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME,
- proc_lustre_root,
- NULL, NULL);
- if (IS_ERR(fld_type_proc_dir))
- return PTR_ERR(fld_type_proc_dir);
-
- LU_CONTEXT_KEY_INIT(&fld_thread_key);
- lu_context_key_register(&fld_thread_key);
- return 0;
+ LU_CONTEXT_KEY_INIT(&fld_thread_key);
+ return lu_context_key_register(&fld_thread_key);
}
-static void __exit fld_mod_exit(void)
+void fld_server_mod_exit(void)
{
- lu_context_key_degister(&fld_thread_key);
- if (fld_type_proc_dir != NULL && !IS_ERR(fld_type_proc_dir)) {
- lprocfs_remove(&fld_type_proc_dir);
- fld_type_proc_dir = NULL;
- }
+ lu_context_key_degister(&fld_thread_key);
}
-/* Insert index entry and update cache. */
-int fld_server_create(struct lu_server_fld *fld,
- const struct lu_env *env,
- seqno_t seq, mdsno_t mds)
+int fld_declare_server_create(const struct lu_env *env,
+ struct lu_server_fld *fld,
+ const struct lu_seq_range *range,
+ struct thandle *th)
{
- int rc;
- ENTRY;
-
- rc = fld_index_create(fld, env, seq, mds);
-
- if (rc == 0) {
- /*
- * Do not return result of calling fld_cache_insert()
- * here. First of all because it may return -EEXISTS. Another
- * reason is that, we do not want to stop proceeding even after
- * cache errors.
- */
- fld_cache_insert(fld->lsf_cache, seq, mds);
- }
+ int rc;
- RETURN(rc);
+ rc = fld_declare_index_create(env, fld, range, th);
+ RETURN(rc);
}
-EXPORT_SYMBOL(fld_server_create);
+EXPORT_SYMBOL(fld_declare_server_create);
-/* Delete index entry. */
-int fld_server_delete(struct lu_server_fld *fld,
- const struct lu_env *env,
- seqno_t seq)
+/**
+ * Insert FLD index entry and update FLD cache.
+ *
+ * This function is called from the sequence allocator when a super-sequence
+ * is granted to a server.
+ */
+int fld_server_create(const struct lu_env *env, struct lu_server_fld *fld,
+ const struct lu_seq_range *range, struct thandle *th)
{
- int rc;
- ENTRY;
+ int rc;
- fld_cache_delete(fld->lsf_cache, seq);
- rc = fld_index_delete(fld, env, seq);
-
- RETURN(rc);
+ mutex_lock(&fld->lsf_lock);
+ rc = fld_index_create(env, fld, range, th);
+ mutex_unlock(&fld->lsf_lock);
+
+ RETURN(rc);
}
-EXPORT_SYMBOL(fld_server_delete);
+EXPORT_SYMBOL(fld_server_create);
-/* Lookup mds by seq. */
-int fld_server_lookup(struct lu_server_fld *fld,
- const struct lu_env *env,
- seqno_t seq, mdsno_t *mds)
+/**
+ * Extract index information from fld name like srv-fsname-MDT0000
+ **/
+int fld_name_to_index(const char *name, __u32 *index)
{
- int rc;
- ENTRY;
-
- /* Lookup it in the cache. */
- rc = fld_cache_lookup(fld->lsf_cache, seq, mds);
- if (rc == 0)
- RETURN(0);
-
- rc = fld_index_lookup(fld, env, seq, mds);
- if (rc == 0) {
- /*
- * Do not return error here as well. See previous comment in
- * same situation in function fld_server_create().
- */
- fld_cache_insert(fld->lsf_cache, seq, *mds);
- }
- RETURN(rc);
+ char *dash;
+ int rc;
+ ENTRY;
+
+ CDEBUG(D_INFO, "get index from %s\n", name);
+ dash = strrchr(name, '-');
+ if (dash == NULL)
+ RETURN(-EINVAL);
+ dash++;
+ rc = target_name2index(dash, index, NULL);
+ RETURN(rc);
}
-EXPORT_SYMBOL(fld_server_lookup);
-static int fld_server_handle(struct lu_server_fld *fld,
- const struct lu_env *env,
- __u32 opc, struct md_fld *mf,
- struct fld_thread_info *info)
+/**
+ * Retrieve fldb entry from MDT0 and add to local FLDB and cache.
+ **/
+int fld_update_from_controller(const struct lu_env *env,
+ struct lu_server_fld *fld)
{
- int rc;
- ENTRY;
-
- switch (opc) {
- case FLD_CREATE:
- rc = fld_server_create(fld, env,
- mf->mf_seq, mf->mf_mds);
-
- /* Do not return -EEXIST error for resent case */
- if ((info->fti_flags & MSG_RESENT) && rc == -EEXIST)
- rc = 0;
- break;
- case FLD_DELETE:
- rc = fld_server_delete(fld, env, mf->mf_seq);
-
- /* Do not return -ENOENT error for resent case */
- if ((info->fti_flags & MSG_RESENT) && rc == -ENOENT)
- rc = 0;
- break;
- case FLD_LOOKUP:
- rc = fld_server_lookup(fld, env,
- mf->mf_seq, &mf->mf_mds);
- break;
- default:
- rc = -EINVAL;
- break;
- }
-
- CDEBUG(D_INFO, "%s: FLD req handle: error %d (opc: %d, seq: "
- LPX64", mds: "LPU64")\n", fld->lsf_name, rc, opc,
- mf->mf_seq, mf->mf_mds);
-
- RETURN(rc);
+ struct fld_thread_info *info;
+ struct lu_seq_range *range;
+ struct lu_seq_range_array *lsra;
+ __u32 index;
+ struct ptlrpc_request *req;
+ int rc;
+ int i;
+ ENTRY;
+
+ /* Update only happens during initalization, i.e. local FLDB
+ * does not exist yet */
+ if (!fld->lsf_new)
+ RETURN(0);
+
+ rc = fld_name_to_index(fld->lsf_name, &index);
+ if (rc < 0)
+ RETURN(rc);
+
+ /* No need update fldb for MDT0 */
+ if (index == 0)
+ RETURN(0);
+
+ info = lu_context_key_get(&env->le_ctx, &fld_thread_key);
+ LASSERT(info != NULL);
+ range = &info->fti_lrange;
+ memset(range, 0, sizeof(*range));
+ range->lsr_index = index;
+ fld_range_set_mdt(range);
+
+ do {
+ rc = fld_client_rpc(fld->lsf_control_exp, range, FLD_READ,
+ &req);
+ if (rc != 0 && rc != -EAGAIN)
+ GOTO(out, rc);
+
+ LASSERT(req != NULL);
+ lsra = (struct lu_seq_range_array *)req_capsule_server_get(
+ &req->rq_pill, &RMF_GENERIC_DATA);
+ if (lsra == NULL)
+ GOTO(out, rc = -EPROTO);
+
+ range_array_le_to_cpu(lsra, lsra);
+ for (i = 0; i < lsra->lsra_count; i++) {
+ int rc1;
+
+ if (lsra->lsra_lsr[i].lsr_flags != LU_SEQ_RANGE_MDT)
+ GOTO(out, rc = -EINVAL);
+
+ if (lsra->lsra_lsr[i].lsr_index != index)
+ GOTO(out, rc = -EINVAL);
+
+ rc1 = fld_insert_entry(env, fld, &lsra->lsra_lsr[i]);
+ if (rc1 != 0)
+ GOTO(out, rc = rc1);
+ }
+ if (rc == -EAGAIN)
+ *range = lsra->lsra_lsr[lsra->lsra_count - 1];
+ } while (rc == -EAGAIN);
+
+ fld->lsf_new = 1;
+out:
+ if (req != NULL)
+ ptlrpc_req_finished(req);
+ RETURN(rc);
}
+EXPORT_SYMBOL(fld_update_from_controller);
-static int fld_req_handle(struct ptlrpc_request *req,
- struct fld_thread_info *info)
+/**
+ * Lookup sequece in local cache/fldb.
+ **/
+int fld_local_lookup(const struct lu_env *env, struct lu_server_fld *fld,
+ seqno_t seq, struct lu_seq_range *range)
{
- struct lu_site *site;
- struct md_fld *in;
- struct md_fld *out;
- int rc;
- __u32 *opc;
- ENTRY;
+ struct lu_seq_range *erange;
+ struct fld_thread_info *info;
+ int rc;
+ ENTRY;
+
+ info = lu_context_key_get(&env->le_ctx, &fld_thread_key);
+ LASSERT(info != NULL);
+ erange = &info->fti_lrange;
+
+ /* Lookup it in the cache. */
+ rc = fld_cache_lookup(fld->lsf_cache, seq, erange);
+ if (rc == 0) {
+ if (unlikely(fld_range_type(erange) != fld_range_type(range) &&
+ !fld_range_is_any(range))) {
+ CERROR("%s: FLD cache range "DRANGE" does not match"
+ "requested flag %x: rc = %d\n", fld->lsf_name,
+ PRANGE(erange), range->lsr_flags, -EIO);
+ RETURN(-EIO);
+ }
+ *range = *erange;
+ RETURN(0);
+ }
+ RETURN(rc);
+}
+EXPORT_SYMBOL(fld_local_lookup);
- site = req->rq_export->exp_obd->obd_lu_dev->ld_site;
-
- rc = req_capsule_pack(&info->fti_pill);
- if (rc)
- RETURN(err_serious(rc));
-
- opc = req_capsule_client_get(&info->fti_pill, &RMF_FLD_OPC);
- if (opc != NULL) {
- in = req_capsule_client_get(&info->fti_pill, &RMF_FLD_MDFLD);
- if (in == NULL)
- RETURN(err_serious(-EPROTO));
- out = req_capsule_server_get(&info->fti_pill, &RMF_FLD_MDFLD);
- if (out == NULL)
- RETURN(err_serious(-EPROTO));
- *out = *in;
-
- rc = fld_server_handle(site->ls_server_fld,
- req->rq_svc_thread->t_env,
- *opc, out, info);
- } else
- rc = err_serious(-EPROTO);
-
- RETURN(rc);
+/**
+ * Lookup MDT/OST by seq, returns a range for given seq.
+ *
+ * If that entry is not cached in fld cache, request is sent to super
+ * sequence controller node (MDT0). All other MDT[1...N] and client
+ * cache fld entries, but this cache is not persistent.
+ */
+int fld_server_lookup(const struct lu_env *env, struct lu_server_fld *fld,
+ seqno_t seq, struct lu_seq_range *range)
+{
+ __u32 index;
+ int rc;
+ ENTRY;
+
+ rc = fld_local_lookup(env, fld, seq, range);
+ if (likely(rc == 0))
+ RETURN(rc);
+
+ rc = fld_name_to_index(fld->lsf_name, &index);
+ if (rc < 0)
+ RETURN(rc);
+ else
+ rc = 0;
+
+ if (index == 0) {
+ /* On server side, all entries should be in cache.
+ * If we can not find it in cache, just return error */
+ CERROR("%s: Cannot find sequence "LPX64": rc = %d\n",
+ fld->lsf_name, seq, -EIO);
+ RETURN(-EIO);
+ } else {
+ if (fld->lsf_control_exp == NULL) {
+ CERROR("%s: lookup "LPX64", but not connects to MDT0"
+ "yet: rc = %d.\n", fld->lsf_name, seq, -EIO);
+ RETURN(-EIO);
+ }
+ /* send request to mdt0 i.e. super seq. controller.
+ * This is temporary solution, long term solution is fld
+ * replication on all mdt servers.
+ */
+ range->lsr_start = seq;
+ rc = fld_client_rpc(fld->lsf_control_exp,
+ range, FLD_QUERY, NULL);
+ if (rc == 0)
+ fld_cache_insert(fld->lsf_cache, range);
+ }
+ RETURN(rc);
}
+EXPORT_SYMBOL(fld_server_lookup);
-static void fld_thread_info_init(struct ptlrpc_request *req,
- struct fld_thread_info *info)
+/**
+ * All MDT server handle fld lookup operation. But only MDT0 has fld index.
+ * if entry is not found in cache we need to forward lookup request to MDT0
+ */
+static int fld_handle_lookup(struct tgt_session_info *tsi)
{
- int i;
+ struct obd_export *exp = tsi->tsi_exp;
+ struct lu_site *site = exp->exp_obd->obd_lu_dev->ld_site;
+ struct lu_server_fld *fld;
+ struct lu_seq_range *in;
+ struct lu_seq_range *out;
+ int rc;
- info->fti_flags = lustre_msg_get_flags(req->rq_reqmsg);
+ ENTRY;
- /* Mark rep buffer as req-layout stuff expects. */
- for (i = 0; i < ARRAY_SIZE(info->fti_rep_buf_size); i++)
- info->fti_rep_buf_size[i] = -1;
+ in = req_capsule_client_get(tsi->tsi_pill, &RMF_FLD_MDFLD);
+ if (in == NULL)
+ RETURN(err_serious(-EPROTO));
- /* Init request capsule. */
- req_capsule_init(&info->fti_pill, req, RCL_SERVER,
- info->fti_rep_buf_size);
+ rc = req_capsule_server_pack(tsi->tsi_pill);
+ if (unlikely(rc != 0))
+ RETURN(err_serious(rc));
- req_capsule_set(&info->fti_pill, &RQF_FLD_QUERY);
-}
+ out = req_capsule_server_get(tsi->tsi_pill, &RMF_FLD_MDFLD);
+ if (out == NULL)
+ RETURN(err_serious(-EPROTO));
+ *out = *in;
-static void fld_thread_info_fini(struct fld_thread_info *info)
-{
- req_capsule_fini(&info->fti_pill);
+ fld = lu_site2seq(site)->ss_server_fld;
+
+ rc = fld_server_lookup(tsi->tsi_env, fld, in->lsr_start, out);
+
+ CDEBUG(D_INFO, "%s: FLD req handle: error %d (range: "DRANGE")\n",
+ fld->lsf_name, rc, PRANGE(out));
+
+ RETURN(rc);
}
-static int fld_handle(struct ptlrpc_request *req)
+static int fld_handle_read(struct tgt_session_info *tsi)
{
- struct fld_thread_info *info;
- const struct lu_env *env;
- int rc;
+ struct obd_export *exp = tsi->tsi_exp;
+ struct lu_site *site = exp->exp_obd->obd_lu_dev->ld_site;
+ struct lu_seq_range *in;
+ void *data;
+ int rc;
+
+ ENTRY;
+
+ req_capsule_set(tsi->tsi_pill, &RQF_FLD_READ);
+
+ in = req_capsule_client_get(tsi->tsi_pill, &RMF_FLD_MDFLD);
+ if (in == NULL)
+ RETURN(err_serious(-EPROTO));
- env = req->rq_svc_thread->t_env;
- LASSERT(env != NULL);
+ req_capsule_set_size(tsi->tsi_pill, &RMF_GENERIC_DATA, RCL_SERVER,
+ PAGE_CACHE_SIZE);
- info = lu_context_key_get(&env->le_ctx, &fld_thread_key);
- LASSERT(info != NULL);
+ rc = req_capsule_server_pack(tsi->tsi_pill);
+ if (unlikely(rc != 0))
+ RETURN(err_serious(rc));
- fld_thread_info_init(req, info);
- rc = fld_req_handle(req, info);
- fld_thread_info_fini(info);
+ data = req_capsule_server_get(tsi->tsi_pill, &RMF_GENERIC_DATA);
- return rc;
+ rc = fld_server_read(tsi->tsi_env, lu_site2seq(site)->ss_server_fld,
+ in, data, PAGE_CACHE_SIZE);
+ RETURN(rc);
}
-/*
- * Entry point for handling FLD RPCs called from MDT.
- */
-int fld_query(struct com_thread_info *info)
+static int fld_handle_query(struct tgt_session_info *tsi)
{
- return fld_handle(info->cti_pill.rc_req);
+ int rc;
+
+ ENTRY;
+
+ req_capsule_set(tsi->tsi_pill, &RQF_FLD_QUERY);
+
+ rc = fld_handle_lookup(tsi);
+
+ RETURN(rc);
}
-EXPORT_SYMBOL(fld_query);
/*
* Returns true, if fid is local to this server node.
*
* fid_is_local() is supposed to be used in assertion checks only.
*/
-int fid_is_local(struct lu_site *site, const struct lu_fid *fid)
+int fid_is_local(const struct lu_env *env,
+ struct lu_site *site, const struct lu_fid *fid)
{
- int result;
-
- result = 1; /* conservatively assume fid is local */
- if (site->ls_client_fld != NULL) {
- mdsno_t mds;
- int rc;
-
- rc = fld_cache_lookup(site->ls_client_fld->lcf_cache,
- fid_seq(fid), &mds);
- if (rc == 0)
- result = (mds == site->ls_node_id);
- }
- return result;
+ int result;
+ struct seq_server_site *ss_site;
+ struct lu_seq_range *range;
+ struct fld_thread_info *info;
+ ENTRY;
+
+ info = lu_context_key_get(&env->le_ctx, &fld_thread_key);
+ range = &info->fti_lrange;
+
+ result = 1; /* conservatively assume fid is local */
+ ss_site = lu_site2seq(site);
+ if (ss_site->ss_client_fld != NULL) {
+ int rc;
+
+ rc = fld_cache_lookup(ss_site->ss_client_fld->lcf_cache,
+ fid_seq(fid), range);
+ if (rc == 0)
+ result = (range->lsr_index == ss_site->ss_node_id);
+ }
+ return result;
}
EXPORT_SYMBOL(fid_is_local);
int rc = 0;
ENTRY;
- fld->lsf_proc_dir = lprocfs_register(fld->lsf_name,
- fld_type_proc_dir,
- fld_server_proc_list, fld);
- if (IS_ERR(fld->lsf_proc_dir)) {
- rc = PTR_ERR(fld->lsf_proc_dir);
- RETURN(rc);
- }
-
- RETURN(rc);
+ fld->lsf_proc_dir = lprocfs_seq_register(fld->lsf_name,
+ fld_type_proc_dir,
+ fld_server_proc_list, fld);
+ if (IS_ERR(fld->lsf_proc_dir)) {
+ rc = PTR_ERR(fld->lsf_proc_dir);
+ RETURN(rc);
+ }
+
+ rc = lprocfs_seq_create(fld->lsf_proc_dir, "fldb", 0444,
+ &fld_proc_seq_fops, fld);
+ if (rc) {
+ lprocfs_remove(&fld->lsf_proc_dir);
+ fld->lsf_proc_dir = NULL;
+ }
+
+ RETURN(rc);
}
static void fld_server_proc_fini(struct lu_server_fld *fld)
}
#endif
-int fld_server_init(struct lu_server_fld *fld, struct dt_device *dt,
- const char *prefix, const struct lu_env *env)
+int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld,
+ struct dt_device *dt, const char *prefix, int type)
{
- int cache_size, cache_threshold;
- int rc;
- ENTRY;
+ int cache_size, cache_threshold;
+ int rc;
- snprintf(fld->lsf_name, sizeof(fld->lsf_name),
- "srv-%s", prefix);
+ ENTRY;
- cache_size = FLD_SERVER_CACHE_SIZE /
- sizeof(struct fld_cache_entry);
+ snprintf(fld->lsf_name, sizeof(fld->lsf_name), "srv-%s", prefix);
- cache_threshold = cache_size *
- FLD_SERVER_CACHE_THRESHOLD / 100;
+ cache_size = FLD_SERVER_CACHE_SIZE / sizeof(struct fld_cache_entry);
- fld->lsf_cache = fld_cache_init(fld->lsf_name,
- FLD_SERVER_HTABLE_SIZE,
- cache_size, cache_threshold);
- if (IS_ERR(fld->lsf_cache)) {
- rc = PTR_ERR(fld->lsf_cache);
- fld->lsf_cache = NULL;
- GOTO(out, rc);
- }
+ cache_threshold = cache_size * FLD_SERVER_CACHE_THRESHOLD / 100;
- rc = fld_index_init(fld, env, dt);
- if (rc)
- GOTO(out, rc);
+ mutex_init(&fld->lsf_lock);
+ fld->lsf_cache = fld_cache_init(fld->lsf_name, cache_size,
+ cache_threshold);
+ if (IS_ERR(fld->lsf_cache)) {
+ rc = PTR_ERR(fld->lsf_cache);
+ fld->lsf_cache = NULL;
+ RETURN(rc);
+ }
- rc = fld_server_proc_init(fld);
- if (rc)
- GOTO(out, rc);
+ rc = fld_index_init(env, fld, dt);
+ if (rc)
+ GOTO(out_cache, rc);
- EXIT;
-out:
- if (rc)
- fld_server_fini(fld, env);
- return rc;
+ rc = fld_server_proc_init(fld);
+ if (rc)
+ GOTO(out_index, rc);
+
+ fld->lsf_control_exp = NULL;
+
+ RETURN(0);
+out_index:
+ fld_index_fini(env, fld);
+out_cache:
+ fld_cache_fini(fld->lsf_cache);
+ return rc;
}
EXPORT_SYMBOL(fld_server_init);
-void fld_server_fini(struct lu_server_fld *fld,
- const struct lu_env *env)
+void fld_server_fini(const struct lu_env *env, struct lu_server_fld *fld)
{
- ENTRY;
+ ENTRY;
- fld_server_proc_fini(fld);
- fld_index_fini(fld, env);
+ fld_server_proc_fini(fld);
+ fld_index_fini(env, fld);
- if (fld->lsf_cache != NULL) {
- if (!IS_ERR(fld->lsf_cache))
- fld_cache_fini(fld->lsf_cache);
- fld->lsf_cache = NULL;
- }
+ if (fld->lsf_cache != NULL) {
+ if (!IS_ERR(fld->lsf_cache))
+ fld_cache_fini(fld->lsf_cache);
+ fld->lsf_cache = NULL;
+ }
- EXIT;
+ EXIT;
}
EXPORT_SYMBOL(fld_server_fini);
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre FLD");
-MODULE_LICENSE("GPL");
-
-cfs_module(mdd, "0.1.0", fld_mod_init, fld_mod_exit);
-#endif
+struct tgt_handler fld_handlers[] = {
+TGT_FLD_HDL_VAR(0, FLD_QUERY, fld_handle_query),
+TGT_FLD_HDL_VAR(0, FLD_READ, fld_handle_read),
+};
+EXPORT_SYMBOL(fld_handlers);