Whamcloud - gitweb
LU-6421 osc: fix bug when setting max_pages_per_rpc
[fs/lustre-release.git] / lustre / osc / lproc_osc.c
index 7e0c550..73ec748 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -43,7 +43,7 @@
 #include <linux/seq_file.h>
 #include "osc_internal.h"
 
-#ifdef LPROCFS
+#ifdef CONFIG_PROC_FS
 static int osc_active_seq_show(struct seq_file *m, void *v)
 {
        struct obd_device *dev = m->private;
@@ -523,7 +523,8 @@ static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
        chunk_mask = ~((1 << (cli->cl_chunkbits - PAGE_CACHE_SHIFT)) - 1);
        /* max_pages_per_rpc must be chunk aligned */
        val = (val + ~chunk_mask) & chunk_mask;
-       if (val == 0 || val > ocd->ocd_brw_size >> PAGE_CACHE_SHIFT) {
+       if (val == 0 || (ocd->ocd_brw_size != 0 &&
+                        val > ocd->ocd_brw_size >> PAGE_CACHE_SHIFT)) {
                LPROCFS_CLIMP_EXIT(dev);
                return -ERANGE;
        }
@@ -571,7 +572,7 @@ LPROC_SEQ_FOPS_WO_TYPE(osc, ping);
 LPROC_SEQ_FOPS_RW_TYPE(osc, import);
 LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
 
-struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = {
+struct lprocfs_vars lprocfs_osc_obd_vars[] = {
        { .name =       "uuid",
          .fops =       &osc_uuid_fops                  },
        { .name =       "ping",
@@ -635,7 +636,7 @@ struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = {
          .fops =       &osc_pinger_recov_fops          },
        { .name =       "unstable_stats",
          .fops =       &osc_unstable_stats_fops        },
-       { 0 }
+       { NULL }
 };
 
 #define pct(a,b) (b ? a * 100 / b : 0)
@@ -802,4 +803,4 @@ int lproc_osc_attach_seqstat(struct obd_device *dev)
 
        return rc;
 }
-#endif /* LPROCFS */
+#endif /* CONFIG_PROC_FS */