Whamcloud - gitweb
LU-6042 osc: osc_object_ast_clear() LBUG
[fs/lustre-release.git] / lustre / osc / lproc_osc.c
index 9dec3a5..84c8f80 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/
@@ -55,7 +55,8 @@ static int osc_active_seq_show(struct seq_file *m, void *v)
        return rc;
 }
 
-static ssize_t osc_active_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_active_seq_write(struct file *file,
+                                   const char __user *buffer,
                                    size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
@@ -83,14 +84,14 @@ static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
        struct client_obd *cli = &dev->u.cli;
        int rc;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
        return rc;
 }
 
 static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
-                                               const char *buffer,
+                                               const char __user *buffer,
                                                size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
@@ -109,10 +110,10 @@ static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
         if (pool && val > cli->cl_max_rpcs_in_flight)
                 pool->prp_populate(pool, val-cli->cl_max_rpcs_in_flight);
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        cli->cl_max_rpcs_in_flight = val;
        client_adjust_max_dirty(cli);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        LPROCFS_CLIMP_EXIT(dev);
        return count;
@@ -126,15 +127,16 @@ static int osc_max_dirty_mb_seq_show(struct seq_file *m, void *v)
         long val;
         int mult;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        val = cli->cl_dirty_max_pages;
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        mult = 1 << (20 - PAGE_CACHE_SHIFT);
        return lprocfs_seq_read_frac_helper(m, val, mult);
 }
 
-static ssize_t osc_max_dirty_mb_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_max_dirty_mb_seq_write(struct file *file,
+                                         const char __user *buffer,
                                          size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
@@ -151,10 +153,10 @@ static ssize_t osc_max_dirty_mb_seq_write(struct file *file, const char *buffer,
            pages_number > totalram_pages / 4) /* 1/4 of RAM */
                return -ERANGE;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        cli->cl_dirty_max_pages = pages_number;
        osc_wake_cache_waiters(cli);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        return count;
 }
@@ -234,9 +236,9 @@ static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v)
        struct client_obd *cli = &dev->u.cli;
        int rc;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        rc = seq_printf(m, "%lu\n", cli->cl_dirty_pages << PAGE_CACHE_SHIFT);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
        return rc;
 }
 LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes);
@@ -247,13 +249,14 @@ static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v)
        struct client_obd *cli = &dev->u.cli;
        int rc;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        rc = seq_printf(m, "%lu\n", cli->cl_avail_grant);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
        return rc;
 }
 
-static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_cur_grant_bytes_seq_write(struct file *file,
+                                            const char __user *buffer,
                                             size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -269,12 +272,13 @@ static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, const char *buff
                 return rc;
 
         /* this is only for shrinking grant */
-        client_obd_list_lock(&cli->cl_loi_list_lock);
-        if (val >= cli->cl_avail_grant) {
-                client_obd_list_unlock(&cli->cl_loi_list_lock);
-                return 0;
-        }
-        client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
+       if (val >= cli->cl_avail_grant) {
+               spin_unlock(&cli->cl_loi_list_lock);
+               return 0;
+       }
+
+       spin_unlock(&cli->cl_loi_list_lock);
 
         LPROCFS_CLIMP_CHECK(obd);
         if (cli->cl_import->imp_state == LUSTRE_IMP_FULL)
@@ -292,9 +296,9 @@ static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v)
        struct client_obd *cli = &dev->u.cli;
        int rc;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        rc = seq_printf(m, "%lu\n", cli->cl_lost_grant);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
        return rc;
 }
 LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes);
@@ -310,7 +314,7 @@ static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v)
 }
 
 static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
-                                                  const char *buffer,
+                                                  const char __user *buffer,
                                                   size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -343,7 +347,8 @@ static int osc_checksum_seq_show(struct seq_file *m, void *v)
                          obd->u.cli.cl_checksum ? 1 : 0);
 }
 
-static ssize_t osc_checksum_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_checksum_seq_write(struct file *file,
+                                     const char __user *buffer,
                                      size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -383,7 +388,8 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
        return 0;
 }
 
-static ssize_t osc_checksum_type_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_checksum_type_seq_write(struct file *file,
+                                          const char __user *buffer,
                                           size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -422,7 +428,8 @@ static int osc_resend_count_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
 }
 
-static ssize_t osc_resend_count_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_resend_count_seq_write(struct file *file,
+                                         const char __user *buffer,
                                          size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -449,7 +456,8 @@ static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%u\n", od->od_contention_time);
 }
 
-static ssize_t osc_contention_seconds_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_contention_seconds_seq_write(struct file *file,
+                                               const char __user *buffer,
                                                size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -467,7 +475,8 @@ static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%u\n", od->od_lockless_truncate);
 }
 
-static ssize_t osc_lockless_truncate_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_lockless_truncate_seq_write(struct file *file,
+                                              const char __user *buffer,
                                    size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -492,7 +501,7 @@ static int osc_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *v)
 }
 
 static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
-                                                  const char *buffer,
+                                                  const char __user *buffer,
                                                   size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
@@ -518,10 +527,10 @@ static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
                LPROCFS_CLIMP_EXIT(dev);
                return -ERANGE;
        }
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        cli->cl_max_pages_per_rpc = val;
        client_adjust_max_dirty(cli);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        LPROCFS_CLIMP_EXIT(dev);
        return count;
@@ -641,7 +650,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 
        do_gettimeofday(&now);
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
 
        seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
                   now.tv_sec, now.tv_usec);
@@ -723,13 +732,14 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
                         break;
         }
 
-        client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
         return 0;
 }
 #undef pct
 
-static ssize_t osc_rpc_stats_seq_write(struct file *file, const char *buf,
+static ssize_t osc_rpc_stats_seq_write(struct file *file,
+                                      const char __user *buf,
                                        size_t len, loff_t *off)
 {
         struct seq_file *seq = file->private_data;
@@ -766,7 +776,8 @@ static int osc_stats_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static ssize_t osc_stats_seq_write(struct file *file, const char *buf,
+static ssize_t osc_stats_seq_write(struct file *file,
+                                  const char __user *buf,
                                    size_t len, loff_t *off)
 {
         struct seq_file *seq = file->private_data;