#include <obd_support.h>
#include <lustre_req_layout.h>
#include <lustre_fid.h>
-#include <lustre_mdt.h> /* err_serious() */
#include "fid_internal.h"
static void seq_server_proc_fini(struct lu_server_seq *seq);
RETURN(rc);
}
-static int seq_req_handle(struct ptlrpc_request *req,
- const struct lu_env *env,
- struct seq_thread_info *info)
+static int seq_handler(struct tgt_session_info *tsi)
{
- struct lu_seq_range *out, *tmp;
- struct lu_site *site;
- int rc = -EPROTO;
- __u32 *opc;
- ENTRY;
+ struct lu_seq_range *out, *tmp;
+ struct lu_site *site;
+ int rc;
+ __u32 *opc;
- LASSERT(!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY));
- site = req->rq_export->exp_obd->obd_lu_dev->ld_site;
- LASSERT(site != NULL);
+ ENTRY;
- rc = req_capsule_server_pack(info->sti_pill);
- if (rc)
- RETURN(err_serious(rc));
+ LASSERT(!(lustre_msg_get_flags(tgt_ses_req(tsi)->rq_reqmsg) & MSG_REPLAY));
+ site = tsi->tsi_exp->exp_obd->obd_lu_dev->ld_site;
+ LASSERT(site != NULL);
- opc = req_capsule_client_get(info->sti_pill, &RMF_SEQ_OPC);
- if (opc != NULL) {
- out = req_capsule_server_get(info->sti_pill, &RMF_SEQ_RANGE);
- if (out == NULL)
- RETURN(err_serious(-EPROTO));
+ opc = req_capsule_client_get(tsi->tsi_pill, &RMF_SEQ_OPC);
+ if (opc != NULL) {
+ out = req_capsule_server_get(tsi->tsi_pill, &RMF_SEQ_RANGE);
+ if (out == NULL)
+ RETURN(err_serious(-EPROTO));
- tmp = req_capsule_client_get(info->sti_pill, &RMF_SEQ_RANGE);
+ tmp = req_capsule_client_get(tsi->tsi_pill, &RMF_SEQ_RANGE);
- /* seq client passed mdt id, we need to pass that using out
- * range parameter */
+ /* seq client passed mdt id, we need to pass that using out
+ * range parameter */
- out->lsr_index = tmp->lsr_index;
- out->lsr_flags = tmp->lsr_flags;
- rc = seq_server_handle(site, env, *opc, out);
- } else
- rc = err_serious(-EPROTO);
+ out->lsr_index = tmp->lsr_index;
+ out->lsr_flags = tmp->lsr_flags;
+ rc = seq_server_handle(site, tsi->tsi_env, *opc, out);
+ } else {
+ rc = err_serious(-EPROTO);
+ }
- RETURN(rc);
+ RETURN(rc);
}
+struct tgt_handler seq_handlers[] = {
+TGT_SEQ_HDL(HABEO_REFERO, SEQ_QUERY, seq_handler),
+};
+EXPORT_SYMBOL(seq_handlers);
+
/* context key constructor/destructor: seq_key_init, seq_key_fini */
LU_KEY_INIT_FINI(seq, struct seq_thread_info);
/* context key: seq_thread_key */
LU_CONTEXT_KEY_DEFINE(seq, LCT_MD_THREAD | LCT_DT_THREAD);
-static void seq_thread_info_init(struct ptlrpc_request *req,
- struct seq_thread_info *info)
-{
- info->sti_pill = &req->rq_pill;
- /* Init request capsule */
- req_capsule_init(info->sti_pill, req, RCL_SERVER);
- req_capsule_set(info->sti_pill, &RQF_SEQ_QUERY);
-}
-
-static void seq_thread_info_fini(struct seq_thread_info *info)
-{
- req_capsule_fini(info->sti_pill);
-}
-
-int seq_handle(struct ptlrpc_request *req)
-{
- const struct lu_env *env;
- struct seq_thread_info *info;
- int rc;
-
- env = req->rq_svc_thread->t_env;
- LASSERT(env != NULL);
-
- info = lu_context_key_get(&env->le_ctx, &seq_thread_key);
- LASSERT(info != NULL);
-
- seq_thread_info_init(req, info);
- rc = seq_req_handle(req, env, info);
- /* XXX: we don't need replay but MDT assign transno in any case,
- * remove it manually before reply*/
- lustre_msg_set_transno(req->rq_repmsg, 0);
- seq_thread_info_fini(info);
-
- return rc;
-}
-EXPORT_SYMBOL(seq_handle);
-
-/*
- * Entry point for handling FLD RPCs called from MDT.
- */
-int seq_query(struct com_thread_info *info)
-{
- return seq_handle(info->cti_pill->rc_req);
-}
-EXPORT_SYMBOL(seq_query);
-
static int seq_server_proc_init(struct lu_server_seq *seq)
{
#ifdef LPROCFS
#include <obd_support.h>
#include <lustre_fid.h>
#include <lustre_fld.h>
-#include <lustre_mdt.h> /* err_serious() */
+#include <md_object.h>
#include <lustre_req_layout.h>
#include <lprocfs_status.h>
#include "fld_internal.h"
lustre_log.h \
lustre_mdc.h \
lustre_mds.h \
- lustre_mdt.h \
lustre_net.h \
lustre_param.h \
lustre_quota.h \
extern struct tgt_handler tgt_llog_handlers[];
extern struct tgt_handler tgt_out_handlers[];
extern struct tgt_handler fld_handlers[];
+extern struct tgt_handler seq_handlers[];
typedef void (*tgt_cb_t)(struct lu_target *lut, __u64 transno,
void *data, int err);
struct seq_server_site *lss_site;
};
-struct com_thread_info;
-int seq_query(struct com_thread_info *info);
-
-struct ptlrpc_request;
-int seq_handle(struct ptlrpc_request *req);
-
/* Server methods */
int seq_server_init(struct lu_server_seq *seq,
+++ /dev/null
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * 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 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 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.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. 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.
- */
-
-#ifndef __LINUX_MDT_H
-#define __LINUX_MDT_H
-
-/** \defgroup mdt mdt
- *
- * @{
- */
-
-#include <lustre/lustre_idl.h>
-#include <lustre_req_layout.h>
-#include <md_object.h>
-#include <libcfs/libcfs.h>
-
-/*
- * Common thread info for mdt, seq and fld
- */
-struct com_thread_info {
- /*
- * for req-layout interface.
- */
- struct req_capsule *cti_pill;
-};
-
-/** @} mdt */
-
-#endif
/* lu2dt_dev() */
#include <dt_object.h>
#include <lustre_mds.h>
-#include <lustre_mdt.h>
#include <lustre_log.h>
#include "mdt_internal.h"
#include <lustre_acl.h>
*/
int mdt_recovery_handle(struct ptlrpc_request *req)
{
- int rc;
- ENTRY;
+ int rc;
- switch (lustre_msg_get_opc(req->rq_reqmsg)) {
- case SEQ_QUERY:
- rc = mdt_handle_common(req, mdt_seq_handlers);
- break;
- default:
- rc = mdt_handle_common(req, mdt_regular_handlers);
- break;
- }
+ ENTRY;
- RETURN(rc);
+ rc = mdt_handle_common(req, mdt_regular_handlers);
+
+ RETURN(rc);
}
enum mdt_it_code {
.tos_hs = fld_handlers
},
{
+ .tos_opc_start = SEQ_FIRST_OPC,
+ .tos_opc_end = SEQ_LAST_OPC,
+ .tos_hs = seq_handlers
+ },
+ {
.tos_hs = NULL
}
};
#if defined(__KERNEL__)
-#include <obd_class.h>
#include <lustre_net.h>
#include <lustre/lustre_idl.h>
#include <obd_class.h>
#include <md_object.h>
#include <lustre_fid.h>
#include <lustre_fld.h>
-#include <lustre_mdt.h>
#include <lustre_req_layout.h>
#include <lustre_sec.h>
#include <lustre_idmap.h>
#include <obd.h>
#include <obd_class.h>
#include <lustre_mds.h>
-#include <lustre_mdt.h>
#include <lprocfs_status.h>
#include "mdt_internal.h"
#include <lnet/lib-lnet.h>
/* lu2dt_dev() */
#include <dt_object.h>
#include <lustre_mds.h>
-#include <lustre_mdt.h>
#include "mdt_internal.h"
#include <lustre_quota.h>
#include <lustre_acl.h>
}
};
-/* Sequence service handlers */
-#define DEF_SEQ_HDL(flags, name, fn) \
- DEFINE_RPC_HANDLER(SEQ_QUERY, flags, name, fn, &RQF_ ## name)
-
-static struct mdt_handler mdt_seq_ops[] = {
-DEF_SEQ_HDL(0, SEQ_QUERY, (void *)seq_query),
-};
-
-struct mdt_opc_slice mdt_seq_handlers[] = {
- {
- .mos_opc_start = SEQ_QUERY,
- .mos_opc_end = SEQ_LAST_OPC,
- .mos_hs = mdt_seq_ops
- },
- {
- .mos_hs = NULL
- }
-};
-
static int mds_regular_handle(struct ptlrpc_request *req)
{
return mdt_handle_common(req, mdt_regular_handlers);
return mdt_handle_common(req, mdt_readpage_handlers);
}
-static int mds_mdsc_handle(struct ptlrpc_request *req)
-{
- return mdt_handle_common(req, mdt_seq_handlers);
-}
-
-static int mds_mdss_handle(struct ptlrpc_request *req)
-{
- return mdt_handle_common(req, mdt_seq_handlers);
-}
-
/* device init/fini methods */
static void mds_stop_ptlrpc_service(struct mds_device *m)
{
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_ops = {
- .so_req_handler = mds_mdsc_handle,
+ .so_req_handler = tgt_request_handle,
.so_req_printer = target_print_req,
.so_hpreq_handler = NULL,
},
.tc_ctx_tags = LCT_MD_THREAD | LCT_DT_THREAD
},
.psc_ops = {
- .so_req_handler = mds_mdss_handle,
+ .so_req_handler = tgt_request_handle,
.so_req_printer = target_print_req,
.so_hpreq_handler = NULL,
},
.tos_hs = tgt_out_handlers
},
{
+ .tos_opc_start = SEQ_FIRST_OPC,
+ .tos_opc_end = SEQ_LAST_OPC,
+ .tos_hs = seq_handlers
+ },
+ {
.tos_hs = NULL
}
};
lustre_msg_get_version(msg),
LUSTRE_OBD_VERSION);
break;
- case SEQ_QUERY:
- /* Note: client always use MDS_VERSION for FID request */
- rc = lustre_msg_check_version(msg, LUSTRE_MDS_VERSION);
- if (rc)
- CERROR("bad opc %u version %08x, expecting %08x\n",
- lustre_msg_get_opc(msg),
- lustre_msg_get_version(msg),
- LUSTRE_MDS_VERSION);
- break;
case OST_CREATE:
case OST_DESTROY:
case OST_GETATTR:
req_capsule_set(&req->rq_pill, &RQF_OST_GET_INFO_GENERIC);
rc = ost_get_info(req->rq_export, req);
break;
- case SEQ_QUERY:
- CDEBUG(D_INODE, "seq\n");
- rc = seq_handle(req);
- break;
case OST_QUOTACHECK:
CDEBUG(D_INODE, "quotacheck\n");
req_capsule_set(&req->rq_pill, &RQF_OST_QUOTACHECK);
.cc_pattern = oss_cpts,
},
.psc_ops = {
- .so_req_handler = ost_handle,
+ .so_req_handler = tgt_request_handle,
.so_req_printer = target_print_req,
.so_hpreq_handler = NULL,
},
#ifndef _QMT_INTERNAL_H
#define _QMT_INTERNAL_H
-#include <lustre_mdt.h> /* err_serious() */
#include "lquota_internal.h"
/*