* 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.
*/
/*
#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,
{
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;
int namelen = strlen(name);
/* remove the stale test quotafile */
- LOCK_INODE_MUTEX(parent_inode);
+ 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);
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;
filp_close(lqi->qi_files[i], 0);
/* unlink quota file */
- LOCK_INODE_MUTEX(parent_inode);
+ LOCK_INODE_MUTEX_PARENT(parent_inode);
de = lookup_one_len(name, tgt->obd_lvfs_ctxt.pwd, namelen);
if (IS_ERR(de) || de->d_inode == NULL) {
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);
for (i = 0; i < MAXQUOTAS; i++) {
dqinfo = &lqi->qi_info[i];
- printk("%s quota info:\n", i == USRQUOTA ? "user " : "group");
- printk
- ("dqi_bgrace(%u) dqi_igrace(%u) dqi_flags(%lu) dqi_blocks(%u) "
- "dqi_free_blk(%u) dqi_free_entry(%u)\n",
- dqinfo->dqi_bgrace, dqinfo->dqi_igrace, dqinfo->dqi_flags,
- dqinfo->dqi_blocks, dqinfo->dqi_free_blk,
- dqinfo->dqi_free_entry);
+ CDEBUG(D_INFO, "%s quota info:\n", i == USRQUOTA ? "user " : "group");
+ CDEBUG(D_INFO, "dqi_bgrace(%u) dqi_igrace(%u) dqi_flags(%lu) dqi_blocks(%u) "
+ "dqi_free_blk(%u) dqi_free_entry(%u)\n",
+ dqinfo->dqi_bgrace, dqinfo->dqi_igrace, dqinfo->dqi_flags,
+ dqinfo->dqi_blocks, dqinfo->dqi_free_blk,
+ dqinfo->dqi_free_entry);
}
#endif
}
if (dquot == NULL)
return NULL;
- get_random_bytes(&rand, sizeof(rand));
+ ll_get_random_bytes(&rand, sizeof(rand));
if (!rand)
rand = 1000;
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;
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);
}
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)
- printk("%d ", dqid->di_id);
+ CDEBUG(D_INFO, "%d ", dqid->di_id);
kfree(dqid);
}
- printk("\n");
+ CDEBUG(D_INFO, "\n");
}
return rc;
#else
module_init(quotfmt_test_init);
module_exit(quotfmt_test_exit);
+
+#endif /* HAVE_QUOTA_SUPPORT */