-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
* from the OBD setup function
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
-
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/kernel.h>
-#include <linux/random.h>
#include <lustre_quota.h>
#include <obd_class.h>
if (dquot == NULL)
return NULL;
- get_random_bytes(&rand, sizeof(rand));
+ cfs_get_random_bytes(&rand, sizeof(rand));
if (!rand)
rand = 1000;
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) {
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) {
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);
}
/* 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);
}
RETURN(rc);
}
-static int quotfmt_test_5(struct lustre_quota_info *lqi)
-{
-#ifndef KERNEL_SUPPORTS_QUOTA_READ
- int i, rc = 0;
-
- for (i = USRQUOTA; i < MAXQUOTAS && !rc; i++) {
- struct list_head list;
- struct dquot_id *dqid, *tmp;
-
- 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);
- if (rc == 0)
- CDEBUG(D_INFO, "%d ", dqid->di_id);
- kfree(dqid);
- }
- CDEBUG(D_INFO, "\n");
- }
- return rc;
-#else
- CWARN("kernel supports quota_read OR kernel version >= 2.6.12, test skipped\n");
- return 0;
-#endif
-}
-
static int quotfmt_run_tests(struct obd_device *obd, struct obd_device *tgt)
{
struct lvfs_run_ctxt saved;
GOTO(out, rc);
}
- CWARN("=== test 5: walk through quota file to get all ids\n");
- rc = quotfmt_test_5(lqi);
- if (rc) {
- CERROR("walk through quota file failed\n");
- GOTO(out, rc);
- }
-
- out:
+out:
CWARN("=== Finalize quotafile test\n");
rc = quotfmt_finalize(lqi, tgt, &saved);
OBD_FREE(lqi, sizeof(*lqi));