Whamcloud - gitweb
LU-1866 osd: ancillary work for initial OI scrub
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_quota.c
index 804f045..4e911e3 100644 (file)
@@ -21,7 +21,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, Intel Corporation.
  * Use is subject to license terms.
  *
  * Author: Johann Lombardi <johann@whamcloud.com>
@@ -511,9 +511,9 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
                        RETURN(-EOVERFLOW);
                }
 
-               OSD_DECLARE_OP(oh, quota,
-                              (allocated || qi->lqi_id.qid_uid == 0) ?
-                              : LDISKFS_QUOTA_INIT_BLOCKS(osd_sb(dev)));
+               osd_trans_declare_op(env, oh, OSD_OT_QUOTA,
+                                    (allocated || qi->lqi_id.qid_uid == 0) ?
+                                    1: LDISKFS_QUOTA_INIT_BLOCKS(osd_sb(dev)));
 
                oh->ot_id_array[i] = qi->lqi_id.qid_uid;
                osd_qid_set_type(oh, i, qi->lqi_type);
@@ -906,7 +906,8 @@ out:
 }
 
 static int set_quota_index_version(const struct lu_env *env,
-                                  struct dt_object *dt)
+                                  struct dt_object *dt,
+                                  dt_obj_version_t version)
 {
        struct osd_device       *osd = osd_obj2dev(osd_dt_obj(dt));
        struct thandle          *th;
@@ -926,16 +927,12 @@ static int set_quota_index_version(const struct lu_env *env,
                GOTO(out, rc);
 
        th->th_sync = 1;
-       dt_version_set(env, dt, 1, th);
+       dt_version_set(env, dt, version, th);
 out:
        dt_trans_stop(env, &osd->od_dt_dev, th);
        RETURN(rc);
 }
 
-#define OBJECTS                "OBJECTS"
-#define ADMIN_USR      "admin_quotafile_v2.usr"
-#define ADMIN_GRP      "admin_quotafile_v2.grp"
-
 int osd_quota_migration(const struct lu_env *env, struct dt_object *dt,
                        const struct dt_index_features *feat)
 {
@@ -1064,10 +1061,10 @@ out:
                               PFID(lu_object_fid(&dt->do_lu)), rc);
        }
 
-       /* bump index version to 1, so the migration will be skipped
-        * next time. */
+       /* bump index version to 1 (or 2 if migration happened), so the
+        * migration will be skipped next time. */
        if (rc == 0) {
-               rc = set_quota_index_version(env , dt);
+               rc = set_quota_index_version(env , dt, converted ? 2 : 1);
                if (rc)
                        CERROR("%s: Failed to set quota index("DFID") "
                               "version, rc:%d\n", osd->od_svname,