Whamcloud - gitweb
LU-8066 llite: move /proc/fs/lustre/llite/checksum_pages to sysfs
[fs/lustre-release.git] / lustre / fld / fld_handler.c
index 062bef9..df64043 100644 (file)
  *
  * 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.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2014, Intel Corporation.
+ * Copyright (c) 2011, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -256,12 +252,12 @@ int fld_server_lookup(const struct lu_env *env, struct lu_server_fld *fld,
        if (index == 0 && rc == LDD_F_SV_TYPE_MDT) {
                /* On server side, all entries should be in cache.
                 * If we can not find it in cache, just return error */
-               CERROR("%s: Cannot find sequence "LPX64": rc = %d\n",
+               CERROR("%s: Cannot find sequence %#llx: rc = %d\n",
                       fld->lsf_name, seq, -ENOENT);
                RETURN(-ENOENT);
        } else {
                if (fld->lsf_control_exp == NULL) {
-                       CERROR("%s: lookup "LPX64", but not connects to MDT0"
+                       CERROR("%s: lookup %#llx, but not connects to MDT0"
                               "yet: rc = %d.\n", fld->lsf_name, seq, -EIO);
                        RETURN(-EIO);
                }
@@ -334,7 +330,7 @@ static int fld_handle_read(struct tgt_session_info *tsi)
                RETURN(err_serious(-EPROTO));
 
        req_capsule_set_size(tsi->tsi_pill, &RMF_GENERIC_DATA, RCL_SERVER,
-                            PAGE_CACHE_SIZE);
+                            PAGE_SIZE);
 
        rc = req_capsule_server_pack(tsi->tsi_pill);
        if (unlikely(rc != 0))
@@ -343,7 +339,7 @@ static int fld_handle_read(struct tgt_session_info *tsi)
        data = req_capsule_server_get(tsi->tsi_pill, &RMF_GENERIC_DATA);
 
        rc = fld_server_read(tsi->tsi_env, lu_site2seq(site)->ss_server_fld,
-                            in, data, PAGE_CACHE_SIZE);
+                            in, data, PAGE_SIZE);
        RETURN(rc);
 }
 
@@ -392,55 +388,36 @@ int fid_is_local(const struct lu_env *env,
        }
        return result;
 }
-EXPORT_SYMBOL(fid_is_local);
 
-static void fld_server_proc_fini(struct lu_server_fld *fld);
+static void fld_server_debugfs_fini(struct lu_server_fld *fld)
+{
+       if (!IS_ERR_OR_NULL(fld->lsf_debugfs_entry))
+               ldebugfs_remove(&fld->lsf_debugfs_entry);
+}
 
-#ifdef CONFIG_PROC_FS
-static int fld_server_proc_init(struct lu_server_fld *fld)
+static int fld_server_debugfs_init(struct lu_server_fld *fld)
 {
-        int rc = 0;
-        ENTRY;
+       int rc = 0;
 
-       fld->lsf_proc_dir = lprocfs_register(fld->lsf_name, fld_type_proc_dir,
-                                            fld_server_proc_list, fld);
-       if (IS_ERR(fld->lsf_proc_dir)) {
-               rc = PTR_ERR(fld->lsf_proc_dir);
+       ENTRY;
+       fld->lsf_debugfs_entry = ldebugfs_register(fld->lsf_name,
+                                                  fld_debugfs_dir,
+                                                  NULL, NULL);
+       if (IS_ERR_OR_NULL(fld->lsf_debugfs_entry)) {
+               rc = fld->lsf_debugfs_entry ? PTR_ERR(fld->lsf_debugfs_entry)
+                                           : -ENOMEM;
+               fld->lsf_debugfs_entry = NULL;
                RETURN(rc);
        }
 
-       rc = lprocfs_seq_create(fld->lsf_proc_dir, "fldb", 0444,
-                               &fld_proc_seq_fops, fld);
-       if (rc) {
-               lprocfs_remove(&fld->lsf_proc_dir);
-               fld->lsf_proc_dir = NULL;
-       }
+       rc = ldebugfs_seq_create(fld->lsf_debugfs_entry, "fldb", 0444,
+                                &fld_debugfs_seq_fops, fld);
+       if (rc)
+               ldebugfs_remove(&fld->lsf_debugfs_entry);
 
        RETURN(rc);
 }
 
-static void fld_server_proc_fini(struct lu_server_fld *fld)
-{
-        ENTRY;
-        if (fld->lsf_proc_dir != NULL) {
-                if (!IS_ERR(fld->lsf_proc_dir))
-                        lprocfs_remove(&fld->lsf_proc_dir);
-                fld->lsf_proc_dir = NULL;
-        }
-        EXIT;
-}
-#else
-static int fld_server_proc_init(struct lu_server_fld *fld)
-{
-        return 0;
-}
-
-static void fld_server_proc_fini(struct lu_server_fld *fld)
-{
-        return;
-}
-#endif
-
 int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld,
                    struct dt_device *dt, const char *prefix, int type)
 {
@@ -468,12 +445,14 @@ int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld,
        if (rc)
                GOTO(out_cache, rc);
 
-       rc = fld_server_proc_init(fld);
+       rc = fld_server_debugfs_init(fld);
        if (rc)
                GOTO(out_index, rc);
 
        fld->lsf_control_exp = NULL;
+       fld->lsf_seq_lookup = fld_server_lookup;
 
+       fld->lsf_seq_lookup = fld_server_lookup;
        RETURN(0);
 out_index:
        fld_index_fini(env, fld);
@@ -487,7 +466,7 @@ void fld_server_fini(const struct lu_env *env, struct lu_server_fld *fld)
 {
        ENTRY;
 
-       fld_server_proc_fini(fld);
+       fld_server_debugfs_fini(fld);
        fld_index_fini(env, fld);
 
        if (fld->lsf_cache != NULL) {