Whamcloud - gitweb
b=19151 use single-level test directory for large-scale test 3a
[fs/lustre-release.git] / lustre / lvfs / quotafmt_test.c
index 2b37387..1f46d9a 100644 (file)
@@ -57,6 +57,8 @@
 
 #include "lustre_quota_fmt.h"
 
+#ifdef HAVE_QUOTA_SUPPORT
+
 char *test_quotafile[2] = { "usrquota_test", "grpquota_test" };
 
 static int quotfmt_initialize(struct lustre_quota_info *lqi,
@@ -65,7 +67,7 @@ static int quotfmt_initialize(struct lustre_quota_info *lqi,
 {
         struct lustre_disk_dqheader dqhead;
         static const uint quota_magics[] = LUSTRE_INITQMAGICS;
-        static const uint quota_versions[] = LUSTRE_INITQVERSIONS;
+        static const uint quota_versions[] = LUSTRE_INITQVERSIONS_V2;
         struct file *fp;
         struct inode *parent_inode = tgt->obd_lvfs_ctxt.pwd->d_inode;
         size_t size;
@@ -84,7 +86,7 @@ static int quotfmt_initialize(struct lustre_quota_info *lqi,
                 LOCK_INODE_MUTEX_PARENT(parent_inode);
                 de = lookup_one_len(name, tgt->obd_lvfs_ctxt.pwd, namelen);
                 if (!IS_ERR(de) && de->d_inode)
-                        ll_vfs_unlink(parent_inode, de, 
+                        ll_vfs_unlink(parent_inode, de,
                                       tgt->obd_lvfs_ctxt.pwdmnt);
                 if (!IS_ERR(de))
                         dput(de);
@@ -107,7 +109,7 @@ static int quotfmt_initialize(struct lustre_quota_info *lqi,
                                        sizeof(struct lustre_disk_dqheader),
                                        &offset);
                 if (size != sizeof(struct lustre_disk_dqheader)) {
-                        CERROR("error writing quoafile header %s (rc = %d)\n",
+                        CERROR("error writing quotafile header %s (rc = %d)\n",
                                name, rc);
                         rc = size;
                         break;
@@ -166,7 +168,7 @@ static int quotfmt_test_1(struct lustre_quota_info *lqi)
         ENTRY;
 
         for (i = 0; i < MAXQUOTAS; i++) {
-                if (!lustre_check_quota_file(lqi, i))
+                if (lustre_check_quota_file(lqi, i))
                         RETURN(-EINVAL);
         }
         RETURN(0);
@@ -228,7 +230,7 @@ static struct lustre_dquot *get_rand_dquot(struct lustre_quota_info *lqi)
         if (dquot == NULL)
                 return NULL;
 
-        get_random_bytes(&rand, sizeof(rand));
+        ll_get_random_bytes(&rand, sizeof(rand));
         if (!rand)
                 rand = 1000;
 
@@ -256,7 +258,7 @@ static void put_rand_dquot(struct lustre_dquot *dquot)
 static int write_check_dquot(struct lustre_quota_info *lqi)
 {
         struct lustre_dquot *dquot;
-        struct mem_dqblk dqblk;
+        struct lustre_mem_dqblk dqblk;
         int rc = 0;
         ENTRY;
 
@@ -271,7 +273,7 @@ static int write_check_dquot(struct lustre_quota_info *lqi)
                 GOTO(out, rc);
         }
 
-        clear_bit(DQ_FAKE_B, &dquot->dq_flags);
+        cfs_clear_bit(DQ_FAKE_B, &dquot->dq_flags);
         /* for already exists entry, we rewrite it */
         rc = lustre_commit_dquot(dquot);
         if (rc) {
@@ -306,7 +308,7 @@ static int quotfmt_test_3(struct lustre_quota_info *lqi)
         if (dquot == NULL)
                 RETURN(-ENOMEM);
       repeat:
-        clear_bit(DQ_FAKE_B, &dquot->dq_flags);
+        cfs_clear_bit(DQ_FAKE_B, &dquot->dq_flags);
         /* write a new dquot */
         rc = lustre_commit_dquot(dquot);
         if (rc) {
@@ -322,13 +324,13 @@ static int quotfmt_test_3(struct lustre_quota_info *lqi)
                 CERROR("read dquot failed! (rc:%d)\n", rc);
                 GOTO(out, rc);
         }
-        if (!dquot->dq_off || test_bit(DQ_FAKE_B, &dquot->dq_flags)) {
+        if (!dquot->dq_off || cfs_test_bit(DQ_FAKE_B, &dquot->dq_flags)) {
                 CERROR("the dquot isn't committed\n");
                 GOTO(out, rc = -EINVAL);
         }
 
         /* remove this dquot */
-        set_bit(DQ_FAKE_B, &dquot->dq_flags);
+        cfs_set_bit(DQ_FAKE_B, &dquot->dq_flags);
         dquot->dq_dqb.dqb_curspace = 0;
         dquot->dq_dqb.dqb_curinodes = 0;
         rc = lustre_commit_dquot(dquot);
@@ -338,14 +340,14 @@ static int quotfmt_test_3(struct lustre_quota_info *lqi)
         }
 
         /* check if the dquot is really removed */
-        clear_bit(DQ_FAKE_B, &dquot->dq_flags);
+        cfs_clear_bit(DQ_FAKE_B, &dquot->dq_flags);
         dquot->dq_off = 0;
         rc = lustre_read_dquot(dquot);
         if (rc) {
                 CERROR("read dquot failed! (rc:%d)\n", rc);
                 GOTO(out, rc);
         }
-        if (!test_bit(DQ_FAKE_B, &dquot->dq_flags) || dquot->dq_off) {
+        if (!cfs_test_bit(DQ_FAKE_B, &dquot->dq_flags) || dquot->dq_off) {
                 CERROR("the dquot isn't removed!\n");
                 GOTO(out, rc = -EINVAL);
         }
@@ -380,22 +382,22 @@ static int quotfmt_test_4(struct lustre_quota_info *lqi)
 
 static int quotfmt_test_5(struct lustre_quota_info *lqi)
 {
-#ifndef KERNEL_SUPPORTS_QUOTA_READ 
+#ifndef KERNEL_SUPPORTS_QUOTA_READ
         int i, rc = 0;
 
         for (i = USRQUOTA; i < MAXQUOTAS && !rc; i++) {
-                struct list_head list;
+                cfs_list_t list;
                 struct dquot_id *dqid, *tmp;
 
-                INIT_LIST_HEAD(&list);
+                CFS_INIT_LIST_HEAD(&list);
                 rc = lustre_get_qids(lqi->qi_files[i], NULL, i, &list);
                 if (rc) {
                         CERROR("%s get all %ss (rc:%d):\n",
                                rc ? "error" : "success",
                                i == USRQUOTA ? "uid" : "gid", rc);
                 }
-                list_for_each_entry_safe(dqid, tmp, &list, di_link) {
-                        list_del_init(&dqid->di_link);
+                cfs_list_for_each_entry_safe(dqid, tmp, &list, di_link) {
+                        cfs_list_del_init(&dqid->di_link);
                         if (rc == 0)
                                 CDEBUG(D_INFO, "%d ", dqid->di_id);
                         kfree(dqid);
@@ -541,3 +543,5 @@ MODULE_LICENSE("GPL");
 
 module_init(quotfmt_test_init);
 module_exit(quotfmt_test_exit);
+
+#endif /* HAVE_QUOTA_SUPPORT */