/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * lustre/ptlrpc/layout.c
- * Lustre Metadata Target (mdt) request handler
+ * GPL HEADER START
*
- * Copyright (c) 2006 Cluster File Systems, Inc.
- * Author: Nikita Danilov <nikita@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/ptlrpc/layout.c
+ *
+ * Lustre Metadata Target (mdt) request handler
+ *
+ * Author: Nikita Danilov <nikita@clusterfs.com>
*/
#if !defined(__REQ_LAYOUT_USER__)
#endif
/* struct ptlrpc_request, lustre_msg* */
#include <lustre_req_layout.h>
-#include <linux/lustre_acl.h>
+#include <lustre_acl.h>
/*
* empty set of fields... for suitable definition of emptiness.
&RMF_PTLRPC_BODY,
&RMF_OBD_QUOTACTL
};
+static const struct req_msg_field *quota_adjust_qunit_only[] = {
+ &RMF_PTLRPC_BODY,
+ &RMF_QUOTA_ADJUST_QUNIT
+};
static const struct req_msg_field *qunit_data_only[] = {
&RMF_PTLRPC_BODY,
&RMF_PTLRPC_BODY,
&RMF_MDT_BODY,
&RMF_MDT_MD,
- &RMF_LOGCOOKIES
+ &RMF_LOGCOOKIES,
+ &RMF_CAPA1,
+ &RMF_CAPA2
};
static const struct req_msg_field *mds_reint_setattr_client[] = {
static const struct req_msg_field *ost_destroy_client[] = {
&RMF_PTLRPC_BODY,
&RMF_OST_BODY,
- &RMF_DLM_REQ
+ &RMF_DLM_REQ,
+ &RMF_CAPA1
};
&RMF_OBD_ID
};
+static const struct req_msg_field *ost_get_fiemap_client[] = {
+ &RMF_PTLRPC_BODY,
+ &RMF_FIEMAP_KEY,
+ &RMF_FIEMAP_VAL
+};
+
+static const struct req_msg_field *ost_get_fiemap_server[] = {
+ &RMF_PTLRPC_BODY,
+ &RMF_FIEMAP_VAL
+};
+
static const struct req_format *req_formats[] = {
&RQF_OBD_PING,
&RQF_SEC_CTX,
- &RQF_SEQ_QUERY,
- &RQF_FLD_QUERY,
&RQF_MGS_TARGET_REG,
&RQF_MGS_SET_INFO,
+ &RQF_SEQ_QUERY,
+ &RQF_FLD_QUERY,
&RQF_MDS_CONNECT,
&RQF_MDS_DISCONNECT,
&RQF_MDS_SET_INFO,
&RQF_MDS_QUOTACHECK,
&RQF_MDS_QUOTACTL,
&RQF_MDS_QUOTA_DQACQ,
+ &RQF_QC_CALLBACK,
&RQF_OST_CONNECT,
&RQF_OST_DISCONNECT,
&RQF_OST_QUOTACHECK,
&RQF_OST_QUOTACTL,
+ &RQF_OST_QUOTA_ADJUST_QUNIT,
&RQF_OST_GETATTR,
&RQF_OST_SETATTR,
&RQF_OST_CREATE,
&RQF_OST_BRW,
&RQF_OST_STATFS,
&RQF_OST_SET_INFO,
+ &RQF_OST_SET_GRANT_INFO,
&RQF_OST_GET_INFO_GENERIC,
&RQF_OST_GET_INFO_LAST_ID,
+ &RQF_OST_GET_INFO_FIEMAP,
&RQF_LDLM_ENQUEUE,
&RQF_LDLM_ENQUEUE_LVB,
&RQF_LDLM_CONVERT,
struct req_msg_field {
__u32 rmf_flags;
const char *rmf_name;
- /*
+ /**
* Field length. (-1) means "variable length".
*/
int rmf_size;
const struct req_msg_field RMF_SEQ_RANGE =
DEFINE_MSGF("seq_query_range", 0,
- sizeof(struct lu_range), lustre_swab_lu_range);
+ sizeof(struct lu_seq_range), lustre_swab_lu_seq_range);
EXPORT_SYMBOL(RMF_SEQ_RANGE);
const struct req_msg_field RMF_FLD_OPC =
const struct req_msg_field RMF_FLD_MDFLD =
DEFINE_MSGF("fld_query_mdfld", 0,
- sizeof(struct md_fld), lustre_swab_md_fld);
+ sizeof(struct lu_seq_range), lustre_swab_lu_seq_range);
EXPORT_SYMBOL(RMF_FLD_MDFLD);
const struct req_msg_field RMF_MDT_BODY =
sizeof(struct obd_quotactl), lustre_swab_obd_quotactl);
EXPORT_SYMBOL(RMF_OBD_QUOTACTL);
+const struct req_msg_field RMF_QUOTA_ADJUST_QUNIT =
+ DEFINE_MSGF("quota_adjust_qunit", 0,
+ sizeof(struct quota_adjust_qunit),
+ lustre_swab_quota_adjust_qunit);
+EXPORT_SYMBOL(RMF_QUOTA_ADJUST_QUNIT);
+
const struct req_msg_field RMF_QUNIT_DATA =
DEFINE_MSGF("qunit_data", 0,
sizeof(struct qunit_data), NULL);
const struct req_msg_field RMF_EADATA = DEFINE_MSGF("eadata", 0, -1, NULL);
EXPORT_SYMBOL(RMF_EADATA);
-const struct req_msg_field RMF_ACL =
+const struct req_msg_field RMF_ACL =
DEFINE_MSGF("acl", 0, LUSTRE_POSIX_ACL_MAX_SIZE, NULL);
EXPORT_SYMBOL(RMF_ACL);
lustre_swab_lustre_capa);
EXPORT_SYMBOL(RMF_CAPA2);
-/*
+/*
* OST request field.
*/
const struct req_msg_field RMF_OST_BODY =
sizeof(obd_id), lustre_swab_ost_last_id);
EXPORT_SYMBOL(RMF_OBD_ID);
+const struct req_msg_field RMF_FIEMAP_KEY =
+ DEFINE_MSGF("fiemap", 0, sizeof(struct ll_fiemap_info_key),
+ lustre_swab_fiemap);
+EXPORT_SYMBOL(RMF_FIEMAP_KEY);
+
+const struct req_msg_field RMF_FIEMAP_VAL =
+ DEFINE_MSGF("fiemap", 0, -1, lustre_swab_fiemap);
+EXPORT_SYMBOL(RMF_FIEMAP_VAL);
/*
* Request formats.
const struct req_format RQF_OBD_PING =
DEFINE_REQ_FMT0("OBD_PING", empty, empty);
EXPORT_SYMBOL(RQF_OBD_PING);
-
+
const struct req_format RQF_SEC_CTX =
DEFINE_REQ_FMT0("SEC_CTX", empty, empty);
EXPORT_SYMBOL(RQF_SEC_CTX);
-
+
const struct req_format RQF_MGS_TARGET_REG =
DEFINE_REQ_FMT0("MGS_TARGET_REG", mgs_target_info_only,
mgs_target_info_only);
EXPORT_SYMBOL(RQF_MGS_TARGET_REG);
const struct req_format RQF_MGS_SET_INFO =
- DEFINE_REQ_FMT0("MGS_SET_INTO", mgs_set_info,
+ DEFINE_REQ_FMT0("MGS_SET_INFO", mgs_set_info,
mgs_set_info);
EXPORT_SYMBOL(RQF_MGS_SET_INFO);
+const struct req_format RQF_SEQ_QUERY =
+ DEFINE_REQ_FMT0("SEQ_QUERY", seq_query_client, seq_query_server);
+EXPORT_SYMBOL(RQF_SEQ_QUERY);
+
+const struct req_format RQF_FLD_QUERY =
+ DEFINE_REQ_FMT0("FLD_QUERY", fld_query_client, fld_query_server);
+EXPORT_SYMBOL(RQF_FLD_QUERY);
+
const struct req_format RQF_LOG_CANCEL =
DEFINE_REQ_FMT0("OBD_LOG_CANCEL", log_cancel_client, empty);
EXPORT_SYMBOL(RQF_LOG_CANCEL);
DEFINE_REQ_FMT0("OST_QUOTACTL", quotactl_only, quotactl_only);
EXPORT_SYMBOL(RQF_OST_QUOTACTL);
+const struct req_format RQF_OST_QUOTA_ADJUST_QUNIT =
+ DEFINE_REQ_FMT0("OST_QUOTA_ADJUST_QUNIT", quota_adjust_qunit_only,
+ quota_adjust_qunit_only);
+EXPORT_SYMBOL(RQF_OST_QUOTA_ADJUST_QUNIT);
+
const struct req_format RQF_QC_CALLBACK =
DEFINE_REQ_FMT0("QC_CALLBACK", quotactl_only, empty);
EXPORT_SYMBOL(RQF_QC_CALLBACK);
DEFINE_REQ_FMT0("MDS_QUOTA_DQACQ", qunit_data_only, qunit_data_only);
EXPORT_SYMBOL(RQF_MDS_QUOTA_DQACQ);
-const struct req_format RQF_SEQ_QUERY =
- DEFINE_REQ_FMT0("SEQ_QUERY", seq_query_client, seq_query_server);
-EXPORT_SYMBOL(RQF_SEQ_QUERY);
-
-const struct req_format RQF_FLD_QUERY =
- DEFINE_REQ_FMT0("FLD_QUERY", fld_query_client, fld_query_server);
-EXPORT_SYMBOL(RQF_FLD_QUERY);
-
const struct req_format RQF_MDS_GETSTATUS =
DEFINE_REQ_FMT0("MDS_GETSTATUS", mdt_body_only, mdt_body_capa);
EXPORT_SYMBOL(RQF_MDS_GETSTATUS);
const struct req_format RQF_MDS_DISCONNECT =
DEFINE_REQ_FMT0("MDS_DISCONNECT", empty, empty);
EXPORT_SYMBOL(RQF_MDS_DISCONNECT);
-
+
const struct req_format RQF_MDS_SET_INFO =
DEFINE_REQ_FMT0("MDS_SET_INFO", mds_set_info_client, empty);
EXPORT_SYMBOL(RQF_MDS_SET_INFO);
-
+
const struct req_format RQF_LDLM_ENQUEUE =
DEFINE_REQ_FMT0("LDLM_ENQUEUE",
ldlm_enqueue_client, ldlm_enqueue_lvb_server);
DEFINE_REQ_FMT0("OST_SET_INFO", ost_set_info_client, empty);
EXPORT_SYMBOL(RQF_OST_SET_INFO);
+const struct req_format RQF_OST_SET_GRANT_INFO =
+ DEFINE_REQ_FMT0("OST_SET_GRANT_INFO", ost_set_info_client,
+ ost_body_only);
+EXPORT_SYMBOL(RQF_OST_SET_GRANT_INFO);
+
const struct req_format RQF_OST_GET_INFO_GENERIC =
DEFINE_REQ_FMT0("OST_GET_INFO", ost_get_info_generic_client,
ost_get_info_generic_server);
ost_get_last_id_server);
EXPORT_SYMBOL(RQF_OST_GET_INFO_LAST_ID);
+const struct req_format RQF_OST_GET_INFO_FIEMAP =
+ DEFINE_REQ_FMT0("OST_GET_INFO_FIEMAP", ost_get_fiemap_client,
+ ost_get_fiemap_server);
+EXPORT_SYMBOL(RQF_OST_GET_INFO_FIEMAP);
+
#if !defined(__REQ_LAYOUT_USER__)
for (i = 0; i < fmt->rf_fields[loc].nr; ++i) {
if (pill->rc_area[loc][i] == -1) {
- pill->rc_area[loc][i] =
+ pill->rc_area[loc][i] =
fmt->rf_fields[loc].d[i]->rmf_size;
if (pill->rc_area[loc][i] == -1) {
/* skip the following fields */
[RCL_SERVER] = "server"
};
+ LASSERT(pill != NULL);
+ LASSERT(pill != LP_POISON);
fmt = pill->rc_fmt;
LASSERT(fmt != NULL);
+ LASSERT(fmt != LP_POISON);
LASSERT(__req_format_is_sane(fmt));
offset = __req_capsule_offset(pill, field, loc);
}
EXPORT_SYMBOL(req_capsule_get_size);
-int req_capsule_msg_size(const struct req_capsule *pill, enum req_location loc)
+int req_capsule_msg_size(struct req_capsule *pill, enum req_location loc)
{
return lustre_msg_size(pill->rc_req->rq_import->imp_msg_magic,
pill->rc_fmt->rf_fields[loc].nr,
- (int *)pill->rc_area[loc]);
+ pill->rc_area[loc]);
}
int req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,