Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / ptlrpc / layout.c
index cc0be2e..562335c 100644 (file)
@@ -1,29 +1,43 @@
 /* -*- 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__)
@@ -52,7 +66,7 @@
 #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.
@@ -490,6 +504,17 @@ static const struct req_msg_field *ost_get_last_id_server[] = {
         &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,
@@ -542,6 +567,7 @@ static const struct req_format *req_formats[] = {
         &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,
@@ -568,7 +594,7 @@ static const struct req_format *req_formats[] = {
 struct req_msg_field {
         __u32       rmf_flags;
         const char *rmf_name;
-        /*
+        /**
          * Field length. (-1) means "variable length".
          */
         int         rmf_size;
@@ -795,6 +821,14 @@ const struct req_msg_field RMF_OBD_ID =
                     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.
@@ -1158,6 +1192,11 @@ const struct req_format RQF_OST_GET_INFO_LAST_ID =
                                                 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__)
 
@@ -1334,8 +1373,11 @@ static void *__req_capsule_get(struct req_capsule *pill,
                 [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);