* 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.
*/
/*
static const uint quota_magics[] = LUSTRE_INITQMAGICS;
const uint *quota_versions = lustre_initqversions[version];
- if (!f && !inode) {
- CERROR("check_quota_file failed!\n");
- libcfs_debug_dumpstack(NULL);
- return -EINVAL;
- }
-
size = lustre_read_quota(f, inode, type, (char *)&dqhead,
sizeof(struct lustre_disk_dqheader), 0);
-
if (size != sizeof(struct lustre_disk_dqheader))
return -EINVAL;
if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type] ||
void lustre_mark_info_dirty(struct lustre_mem_dqinfo *info)
{
- set_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
+ cfs_set_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
}
/**
"VFS: Can't read quota structure for id %u.\n",
dquot->dq_id);
dquot->dq_off = 0;
- set_bit(DQ_FAKE_B, &dquot->dq_flags);
+ cfs_set_bit(DQ_FAKE_B, &dquot->dq_flags);
memset(&dquot->dq_dqb, 0, sizeof(struct lustre_mem_dqblk));
ret = offset;
} else {
lustre_quota_version_t version = dquot->dq_info->qi_version;
void *handle;
struct inode *inode = dquot->dq_info->qi_files[dquot->dq_type]->f_dentry->d_inode;
+ int delete = 0;
/* always clear the flag so we don't loop on an IO error... */
- clear_bit(DQ_MOD_B, &dquot->dq_flags);
+ cfs_clear_bit(DQ_MOD_B, &dquot->dq_flags);
/* The block/inode usage in admin quotafile isn't the real usage
* over all cluster, so keep the fake dquot entry on disk is
* meaningless, just remove it */
- if (test_bit(DQ_FAKE_B, &dquot->dq_flags)) {
- handle = lustre_quota_journal_start(inode, 1);
+ if (cfs_test_bit(DQ_FAKE_B, &dquot->dq_flags))
+ delete = 1;
+ handle = lustre_quota_journal_start(inode, delete);
+ if (unlikely(IS_ERR(handle))) {
+ rc = PTR_ERR(handle);
+ CERROR("fail to lustre_quota_journal_start: rc = %d\n", rc);
+ return rc;
+ }
+
+ if (delete)
rc = lustre_delete_dquot(dquot, version);
- lustre_quota_journal_stop(handle);
- } else {
- handle = lustre_quota_journal_start(inode, 0);
+ else
rc = lustre_write_dquot(dquot, version);
- lustre_quota_journal_stop(handle);
- }
+ lustre_quota_journal_stop(handle);
if (rc < 0)
return rc;
}
static int walk_block_dqentry(struct file *filp, struct inode *inode, int type,
- uint blk, struct list_head *list)
+ uint blk, cfs_list_t *list)
{
dqbuf_t buf = getdqbuf();
loff_t ret = 0;
(struct lustre_disk_dqdbheader *)buf;
struct dqblk *blk_item;
struct dqblk *pos;
- struct list_head *tmp;
+ cfs_list_t *tmp;
if (!buf)
return -ENOMEM;
if (!le32_to_cpu(dqhead->dqdh_entries))
goto out_buf;
- if (list_empty(list)) {
+ if (cfs_list_empty(list)) {
tmp = list;
goto done;
}
- list_for_each_entry(pos, list, link) {
+ cfs_list_for_each_entry(pos, list, link) {
if (blk == pos->blk) /* we got this blk already */
goto out_buf;
if (blk > pos->blk)
goto out_buf;
}
blk_item->blk = blk;
- INIT_LIST_HEAD(&blk_item->link);
+ CFS_INIT_LIST_HEAD(&blk_item->link);
- list_add_tail(&blk_item->link, tmp);
+ cfs_list_add_tail(&blk_item->link, tmp);
out_buf:
freedqbuf(buf);
}
int walk_tree_dqentry(struct file *filp, struct inode *inode, int type,
- uint blk, int depth, struct list_head *list)
+ uint blk, int depth, cfs_list_t *list)
{
dqbuf_t buf = getdqbuf();
loff_t ret = 0;
* Walk through the quota file (v2 format) to get all ids with quota limit
*/
int lustre_get_qids(struct file *fp, struct inode *inode, int type,
- struct list_head *list)
+ cfs_list_t *list)
{
- struct list_head blk_list;
+ cfs_list_t blk_list;
struct dqblk *blk_item, *tmp;
dqbuf_t buf = NULL;
struct lustre_disk_dqblk_v2 *ddquot;
RETURN(-EINVAL);
}
- if (!list_empty(list)) {
+ if (!cfs_list_empty(list)) {
CDEBUG(D_ERROR, "not empty list\n");
RETURN(-EINVAL);
}
- INIT_LIST_HEAD(&blk_list);
+ CFS_INIT_LIST_HEAD(&blk_list);
rc = walk_tree_dqentry(fp, inode, type, LUSTRE_DQTREEOFF, 0, &blk_list);
if (rc) {
CDEBUG(D_ERROR, "walk through quota file failed!(%d)\n", rc);
GOTO(out_free, rc);
}
- if (list_empty(&blk_list))
+ if (cfs_list_empty(&blk_list))
RETURN(0);
buf = getdqbuf();
RETURN(-ENOMEM);
ddquot = (struct lustre_disk_dqblk_v2 *)GETENTRIES(buf, version);
- list_for_each_entry(blk_item, &blk_list, link) {
+ cfs_list_for_each_entry(blk_item, &blk_list, link) {
loff_t ret = 0;
int i, dqblk_sz = lustre_disk_dqblk_sz[version];
dqid->di_flag |= le64_to_cpu(ddquot[i].dqb_bhardlimit) ?
QB_SET : 0;
- INIT_LIST_HEAD(&dqid->di_link);
- list_add(&dqid->di_link, list);
+ CFS_INIT_LIST_HEAD(&dqid->di_link);
+ cfs_list_add(&dqid->di_link, list);
}
}
out_free:
- list_for_each_entry_safe(blk_item, tmp, &blk_list, link) {
- list_del_init(&blk_item->link);
+ cfs_list_for_each_entry_safe(blk_item, tmp, &blk_list, link) {
+ cfs_list_del_init(&blk_item->link);
kfree(blk_item);
}
if (buf)