/* -*- 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_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_OST_SET_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_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);
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);
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,
if (size < 0)
return size;
- if (magic == LUSTRE_MSG_MAGIC_V1)
- i++;
-
for (; i < fmt->rf_fields[loc].nr; ++i)
if (fmt->rf_fields[loc].d[i]->rmf_size != -1)
size += size_round(fmt->rf_fields[loc].d[i]->rmf_size);