Merge 4.6-rc3 into staging-next
[cascardo/linux.git] / drivers / staging / lustre / lustre / osc / lproc_osc.c
index a3358c3..6e57f53 100644 (file)
@@ -121,9 +121,9 @@ static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,
                atomic_add(added, &osc_pool_req_count);
        }
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        cli->cl_max_rpcs_in_flight = val;
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        return count;
 }
@@ -139,9 +139,9 @@ static ssize_t max_dirty_mb_show(struct kobject *kobj,
        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;
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        mult = 1 << 20;
        return lprocfs_read_frac_helper(buf, PAGE_SIZE, val, mult);
@@ -169,10 +169,10 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj,
            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 = (u32)(pages_number << PAGE_SHIFT);
        osc_wake_cache_waiters(cli);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        return count;
 }
@@ -222,8 +222,16 @@ static ssize_t osc_cached_mb_seq_write(struct file *file,
                return -ERANGE;
 
        rc = atomic_read(&cli->cl_lru_in_list) - pages_number;
-       if (rc > 0)
-               (void)osc_lru_shrink(cli, rc);
+       if (rc > 0) {
+               struct lu_env *env;
+               int refcheck;
+
+               env = cl_env_get(&refcheck);
+               if (!IS_ERR(env)) {
+                       (void)osc_lru_shrink(env, cli, rc, true);
+                       cl_env_put(env, &refcheck);
+               }
+       }
 
        return count;
 }
@@ -239,9 +247,9 @@ static ssize_t cur_dirty_bytes_show(struct kobject *kobj,
        struct client_obd *cli = &dev->u.cli;
        int len;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        len = sprintf(buf, "%lu\n", cli->cl_dirty);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        return len;
 }
@@ -256,9 +264,9 @@ static ssize_t cur_grant_bytes_show(struct kobject *kobj,
        struct client_obd *cli = &dev->u.cli;
        int len;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        len = sprintf(buf, "%lu\n", cli->cl_avail_grant);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        return len;
 }
@@ -279,12 +287,12 @@ static ssize_t cur_grant_bytes_store(struct kobject *kobj,
                return rc;
 
        /* this is only for shrinking grant */
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        if (val >= cli->cl_avail_grant) {
-               client_obd_list_unlock(&cli->cl_loi_list_lock);
+               spin_unlock(&cli->cl_loi_list_lock);
                return -EINVAL;
        }
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        if (cli->cl_import->imp_state == LUSTRE_IMP_FULL)
                rc = osc_shrink_grant_to_target(cli, val);
@@ -303,9 +311,9 @@ static ssize_t cur_lost_grant_bytes_show(struct kobject *kobj,
        struct client_obd *cli = &dev->u.cli;
        int len;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
        len = sprintf(buf, "%lu\n", cli->cl_lost_grant);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        return len;
 }
@@ -577,9 +585,9 @@ static ssize_t max_pages_per_rpc_store(struct kobject *kobj,
        if (val == 0 || val > ocd->ocd_brw_size >> PAGE_SHIFT) {
                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_obd_list_unlock(&cli->cl_loi_list_lock);
+       spin_unlock(&cli->cl_loi_list_lock);
 
        return count;
 }
@@ -623,7 +631,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 
        ktime_get_real_ts64(&now);
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
+       spin_lock(&cli->cl_loi_list_lock);
 
        seq_printf(seq, "snapshot_time:  %llu.%9lu (secs.usecs)\n",
                   (s64)now.tv_sec, (unsigned long)now.tv_nsec);
@@ -707,7 +715,7 @@ 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;
 }