Whamcloud - gitweb
LU-9545 lfsck: report "inconsistent" under dryrun mode
[fs/lustre-release.git] / lustre / quota / qmt_pool.c
index 47f5b12..679ceeb 100644 (file)
@@ -21,7 +21,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
  * Use is subject to license terms.
  *
  * Author: Johann Lombardi <johann.lombardi@intel.com>
@@ -159,11 +159,11 @@ static int qpi_state_seq_show(struct seq_file *m, void *data)
                   atomic_read(&pool->qpi_ref),
                   pool->qpi_least_qunit);
 
-       for (type = 0; type < MAXQUOTAS; type++)
+       for (type = 0; type < LL_MAXQUOTAS; type++)
                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));
 
@@ -176,7 +176,8 @@ static int qpi_soft_least_qunit_seq_show(struct seq_file *m, void *data)
        struct qmt_pool_info    *pool = m->private;
        LASSERT(pool != NULL);
 
-       return seq_printf(m, "%lu\n", pool->qpi_soft_least_qunit);
+       seq_printf(m, "%lu\n", pool->qpi_soft_least_qunit);
+       return 0;
 }
 
 static ssize_t
@@ -314,7 +315,7 @@ static void qmt_pool_free(const struct lu_env *env, struct qmt_pool_info *pool)
 
        /* release per-quota type site used to manage quota entries as well as
         * references to global index files */
-       for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+       for (qtype = 0; qtype < LL_MAXQUOTAS; qtype++) {
                /* release lqe storing grace time */
                if (pool->qpi_grace_lqe[qtype] != NULL)
                        lqe_putref(pool->qpi_grace_lqe[qtype]);
@@ -326,12 +327,12 @@ static void qmt_pool_free(const struct lu_env *env, struct qmt_pool_info *pool)
                /* release reference to global index */
                if (pool->qpi_glb_obj[qtype] != NULL &&
                    !IS_ERR(pool->qpi_glb_obj[qtype]))
-                       lu_object_put(env, &pool->qpi_glb_obj[qtype]->do_lu);
+                       dt_object_put(env, pool->qpi_glb_obj[qtype]);
        }
 
        /* release reference on pool directory */
        if (pool->qpi_root != NULL && !IS_ERR(pool->qpi_root))
-               lu_object_put(env, &pool->qpi_root->do_lu);
+               dt_object_put(env, pool->qpi_root);
 
        /* release reference on the master target */
        if (pool->qpi_qmt != NULL) {
@@ -528,7 +529,7 @@ int qmt_pool_prepare(const struct lu_env *env, struct qmt_device *qmt,
                        RETURN(PTR_ERR(obj));
                pool->qpi_root = obj;
 
-               for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+               for (qtype = 0; qtype < LL_MAXQUOTAS; qtype++) {
                        /* Generating FID of global index in charge of storing
                         * settings for this quota type */
                        lquota_generate_fid(&qti->qti_fid, pool_id, pool_type,
@@ -541,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);
                        }
 
@@ -560,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);
                                }
                        }
@@ -583,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);
                        }
 
@@ -597,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);
                        }
 
@@ -616,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);
@@ -685,7 +680,7 @@ int qmt_pool_new_conn(const struct lu_env *env, struct qmt_device *qmt,
        /* retrieve slave fid & current object version */
        memcpy(slv_fid, lu_object_fid(&slv_obj->do_lu), sizeof(*slv_fid));
        *slv_ver = dt_version_get(env, slv_obj);
-       lu_object_put(env, &slv_obj->do_lu);
+       dt_object_put(env, slv_obj);
        if (created)
                pool->qpi_slv_nr[qtype]++;
 out: