Whamcloud - gitweb
LU-684 tests: replace dev_read_only patch with dm-flakey
[fs/lustre-release.git] / lustre / quota / qmt_pool.c
index b20658b..14ee846 100644 (file)
@@ -21,7 +21,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012, 2016, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  * Use is subject to license terms.
  *
  * Author: Johann Lombardi <johann.lombardi@intel.com>
@@ -163,7 +163,7 @@ static int qpi_state_seq_show(struct seq_file *m, void *data)
                seq_printf(m, "    %s:\n"
                           "        #slv: %d\n"
                           "        #lqe: %d\n",
-                          QTYPE_NAME(type),
+                          qtype_name(type),
                           pool->qpi_slv_nr[type],
                    atomic_read(&pool->qpi_site[type]->lqs_hash->hs_count));
 
@@ -184,9 +184,9 @@ static ssize_t
 qpi_soft_least_qunit_seq_write(struct file *file, const char __user *buffer,
                               size_t count, loff_t *off)
 {
-       struct qmt_pool_info    *pool;
-       int     qunit, rc;
-       s64     least_qunit;
+       struct qmt_pool_info *pool;
+       long long least_qunit;
+       int qunit, rc;
 
        pool = ((struct seq_file *)file->private_data)->private;
        LASSERT(pool != NULL);
@@ -195,7 +195,7 @@ qpi_soft_least_qunit_seq_write(struct file *file, const char __user *buffer,
        if (pool->qpi_key >> 16 != LQUOTA_RES_DT)
                return -EINVAL;
 
-       rc = lprocfs_str_to_s64(buffer, count, &least_qunit);
+       rc = kstrtoll_from_user(buffer, count, 0, &least_qunit);
        if (rc)
                return rc;
 
@@ -542,9 +542,8 @@ int qmt_pool_prepare(const struct lu_env *env, struct qmt_device *qmt,
                                                          &qti->qti_fid, false);
                        if (IS_ERR(obj)) {
                                rc = PTR_ERR(obj);
-                               CERROR("%s: failed to create glb index copy for"
-                                      " %s type (%d)\n", qmt->qmt_svname,
-                                      QTYPE_NAME(qtype), rc);
+                               CERROR("%s: failed to create glb index copy for %s type: rc = %d\n",
+                                      qmt->qmt_svname, qtype_name(qtype), rc);
                                RETURN(rc);
                        }
 
@@ -561,19 +560,15 @@ int qmt_pool_prepare(const struct lu_env *env, struct qmt_device *qmt,
 
                                rc = lquota_disk_write_glb(env, obj, 0, rec);
                                if (rc) {
-                                       CERROR("%s: failed to set default "
-                                              "grace time for %s type (%d)\n",
-                                              qmt->qmt_svname,
-                                              QTYPE_NAME(qtype), rc);
+                                       CERROR("%s: failed to set default grace time for %s type: rc = %d\n",
+                                              qmt->qmt_svname, qtype_name(qtype), rc);
                                        RETURN(rc);
                                }
 
                                rc = lquota_disk_update_ver(env, dev, obj, 1);
                                if (rc) {
-                                       CERROR("%s: failed to set initial "
-                                              "version for %s type (%d)\n",
-                                              qmt->qmt_svname,
-                                              QTYPE_NAME(qtype), rc);
+                                       CERROR("%s: failed to set initial version for %s type: rc = %d\n",
+                                              qmt->qmt_svname, qtype_name(qtype), rc);
                                        RETURN(rc);
                                }
                        }
@@ -584,9 +579,8 @@ int qmt_pool_prepare(const struct lu_env *env, struct qmt_device *qmt,
                                                                  &qmt_lqe_ops);
                        if (IS_ERR(pool->qpi_site[qtype])) {
                                rc = PTR_ERR(pool->qpi_site[qtype]);
-                               CERROR("%s: failed to create site for %s type "
-                                      "(%d)\n", qmt->qmt_svname,
-                                      QTYPE_NAME(qtype), rc);
+                               CERROR("%s: failed to create site for %s type: rc = %d\n",
+                                      qmt->qmt_svname, qtype_name(qtype), rc);
                                RETURN(rc);
                        }
 
@@ -598,9 +592,8 @@ int qmt_pool_prepare(const struct lu_env *env, struct qmt_device *qmt,
                                                      qmt_slv_cnt,
                                                      &pool->qpi_slv_nr[qtype]);
                        if (rc) {
-                               CERROR("%s: failed to scan & count slave "
-                                      "indexes for %s type (%d)\n",
-                                      qmt->qmt_svname, QTYPE_NAME(qtype), rc);
+                               CERROR("%s: failed to scan & count slave indexes for %s type: rc = %d\n",
+                                      qmt->qmt_svname, qtype_name(qtype), rc);
                                RETURN(rc);
                        }
 
@@ -617,7 +610,8 @@ int qmt_pool_prepare(const struct lu_env *env, struct qmt_device *qmt,
 #ifdef CONFIG_PROC_FS
                        /* add procfs file to dump the global index, mostly for
                         * debugging purpose */
-                       sprintf(qti->qti_buf, "glb-%s", QTYPE_NAME(qtype));
+                       snprintf(qti->qti_buf, MTI_NAME_MAXLEN,
+                                "glb-%s", qtype_name(qtype));
                        rc = lprocfs_seq_create(pool->qpi_proc, qti->qti_buf,
                                                0444, &lprocfs_quota_seq_fops,
                                                obj);