Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / fld / fld_handler.c
index 00c9d12..3138a54 100644 (file)
@@ -1,31 +1,46 @@
-/* -*- MODE: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  lustre/fld/fld_handler.c
- *  FLD (Fids Location Database)
+ * GPL HEADER START
  *
- *  Copyright (C) 2006 Cluster File Systems, Inc.
- *   Author: Yury Umanets <umka@clusterfs.com>
- *           WangDi <wangdi@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/fld/fld_handler.c
+ *
+ * FLD (Fids Location Database)
+ *
+ * Author: Yury Umanets <umka@clusterfs.com>
+ * Author: WangDi <wangdi@clusterfs.com>
  */
+
 #ifndef EXPORT_SYMTAB
 # define EXPORT_SYMTAB
 #endif
@@ -200,21 +215,21 @@ static int fld_req_handle(struct ptlrpc_request *req,
 
         site = req->rq_export->exp_obd->obd_lu_dev->ld_site;
 
-        rc = req_capsule_pack(&info->fti_pill);
+        rc = req_capsule_server_pack(info->fti_pill);
         if (rc)
                 RETURN(err_serious(rc));
 
-        opc = req_capsule_client_get(&info->fti_pill, &RMF_FLD_OPC);
+        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);
+                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);
+                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,
+                rc = fld_server_handle(lu_site2md(site)->ms_server_fld,
                                        req->rq_svc_thread->t_env,
                                        *opc, out, info);
         } else
@@ -226,24 +241,17 @@ static int fld_req_handle(struct ptlrpc_request *req,
 static void fld_thread_info_init(struct ptlrpc_request *req,
                                  struct fld_thread_info *info)
 {
-        int i;
-
         info->fti_flags = lustre_msg_get_flags(req->rq_reqmsg);
 
-        /* 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;
-
+        info->fti_pill = &req->rq_pill;
         /* Init request capsule. */
-        req_capsule_init(&info->fti_pill, req, RCL_SERVER,
-                         info->fti_rep_buf_size);
-
-        req_capsule_set(&info->fti_pill, &RQF_FLD_QUERY);
+        req_capsule_init(info->fti_pill, req, RCL_SERVER);
+        req_capsule_set(info->fti_pill, &RQF_FLD_QUERY);
 }
 
 static void fld_thread_info_fini(struct fld_thread_info *info)
 {
-        req_capsule_fini(&info->fti_pill);
+        req_capsule_fini(info->fti_pill);
 }
 
 static int fld_handle(struct ptlrpc_request *req)
@@ -270,7 +278,7 @@ static int fld_handle(struct ptlrpc_request *req)
  */
 int fld_query(struct com_thread_info *info)
 {
-        return fld_handle(info->cti_pill.rc_req);
+        return fld_handle(info->cti_pill->rc_req);
 }
 EXPORT_SYMBOL(fld_query);
 
@@ -285,16 +293,18 @@ EXPORT_SYMBOL(fld_query);
 int fid_is_local(struct lu_site *site, const struct lu_fid *fid)
 {
         int result;
+        struct md_site *msite;
 
         result = 1; /* conservatively assume fid is local */
-        if (site->ls_client_fld != NULL) {
+        msite = lu_site2md(site);
+        if (msite->ms_client_fld != NULL) {
                 mdsno_t mds;
                 int rc;
 
-                rc = fld_cache_lookup(site->ls_client_fld->lcf_cache,
+                rc = fld_cache_lookup(msite->ms_client_fld->lcf_cache,
                                       fid_seq(fid), &mds);
                 if (rc == 0)
-                        result = (mds == site->ls_node_id);
+                        result = (mds == msite->ms_node_id);
         }
         return result;
 }
@@ -400,7 +410,7 @@ void fld_server_fini(struct lu_server_fld *fld,
 }
 EXPORT_SYMBOL(fld_server_fini);
 
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
 MODULE_DESCRIPTION("Lustre FLD");
 MODULE_LICENSE("GPL");