quota: Remove dqbuf_t and other cleanups
Remove bogus typedef which is just a definition of char *. Remove unnecessary type casts. Substitute freedqbuf() with kfree. Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
dd6f3c6d5a
commit
d26ac1a812
|
@ -22,8 +22,6 @@ MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
#define __QUOTA_QT_PARANOIA
|
#define __QUOTA_QT_PARANOIA
|
||||||
|
|
||||||
typedef char *dqbuf_t;
|
|
||||||
|
|
||||||
static int get_index(struct qtree_mem_dqinfo *info, qid_t id, int depth)
|
static int get_index(struct qtree_mem_dqinfo *info, qid_t id, int depth)
|
||||||
{
|
{
|
||||||
unsigned int epb = info->dqi_usable_bs >> 2;
|
unsigned int epb = info->dqi_usable_bs >> 2;
|
||||||
|
@ -41,40 +39,35 @@ static inline int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info)
|
||||||
/ info->dqi_entry_size;
|
/ info->dqi_entry_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static dqbuf_t getdqbuf(size_t size)
|
static char *getdqbuf(size_t size)
|
||||||
{
|
{
|
||||||
dqbuf_t buf = kmalloc(size, GFP_NOFS);
|
char *buf = kmalloc(size, GFP_NOFS);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
printk(KERN_WARNING "VFS: Not enough memory for quota buffers.\n");
|
printk(KERN_WARNING "VFS: Not enough memory for quota buffers.\n");
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void freedqbuf(dqbuf_t buf)
|
static inline ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf)
|
||||||
{
|
|
||||||
kfree(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, dqbuf_t buf)
|
|
||||||
{
|
{
|
||||||
struct super_block *sb = info->dqi_sb;
|
struct super_block *sb = info->dqi_sb;
|
||||||
|
|
||||||
memset(buf, 0, info->dqi_usable_bs);
|
memset(buf, 0, info->dqi_usable_bs);
|
||||||
return sb->s_op->quota_read(sb, info->dqi_type, (char *)buf,
|
return sb->s_op->quota_read(sb, info->dqi_type, buf,
|
||||||
info->dqi_usable_bs, blk << info->dqi_blocksize_bits);
|
info->dqi_usable_bs, blk << info->dqi_blocksize_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, dqbuf_t buf)
|
static inline ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf)
|
||||||
{
|
{
|
||||||
struct super_block *sb = info->dqi_sb;
|
struct super_block *sb = info->dqi_sb;
|
||||||
|
|
||||||
return sb->s_op->quota_write(sb, info->dqi_type, (char *)buf,
|
return sb->s_op->quota_write(sb, info->dqi_type, buf,
|
||||||
info->dqi_usable_bs, blk << info->dqi_blocksize_bits);
|
info->dqi_usable_bs, blk << info->dqi_blocksize_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove empty block from list and return it */
|
/* Remove empty block from list and return it */
|
||||||
static int get_free_dqblk(struct qtree_mem_dqinfo *info)
|
static int get_free_dqblk(struct qtree_mem_dqinfo *info)
|
||||||
{
|
{
|
||||||
dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
|
char *buf = getdqbuf(info->dqi_usable_bs);
|
||||||
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
|
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
|
||||||
int ret, blk;
|
int ret, blk;
|
||||||
|
|
||||||
|
@ -98,12 +91,12 @@ static int get_free_dqblk(struct qtree_mem_dqinfo *info)
|
||||||
mark_info_dirty(info->dqi_sb, info->dqi_type);
|
mark_info_dirty(info->dqi_sb, info->dqi_type);
|
||||||
ret = blk;
|
ret = blk;
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert empty block to the list */
|
/* Insert empty block to the list */
|
||||||
static int put_free_dqblk(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint blk)
|
static int put_free_dqblk(struct qtree_mem_dqinfo *info, char *buf, uint blk)
|
||||||
{
|
{
|
||||||
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
|
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
|
||||||
int err;
|
int err;
|
||||||
|
@ -120,9 +113,9 @@ static int put_free_dqblk(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint blk)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove given block from the list of blocks with free entries */
|
/* Remove given block from the list of blocks with free entries */
|
||||||
static int remove_free_dqentry(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint blk)
|
static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf, uint blk)
|
||||||
{
|
{
|
||||||
dqbuf_t tmpbuf = getdqbuf(info->dqi_usable_bs);
|
char *tmpbuf = getdqbuf(info->dqi_usable_bs);
|
||||||
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
|
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
|
||||||
uint nextblk = le32_to_cpu(dh->dqdh_next_free);
|
uint nextblk = le32_to_cpu(dh->dqdh_next_free);
|
||||||
uint prevblk = le32_to_cpu(dh->dqdh_prev_free);
|
uint prevblk = le32_to_cpu(dh->dqdh_prev_free);
|
||||||
|
@ -153,21 +146,21 @@ static int remove_free_dqentry(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint
|
||||||
info->dqi_free_entry = nextblk;
|
info->dqi_free_entry = nextblk;
|
||||||
mark_info_dirty(info->dqi_sb, info->dqi_type);
|
mark_info_dirty(info->dqi_sb, info->dqi_type);
|
||||||
}
|
}
|
||||||
freedqbuf(tmpbuf);
|
kfree(tmpbuf);
|
||||||
dh->dqdh_next_free = dh->dqdh_prev_free = cpu_to_le32(0);
|
dh->dqdh_next_free = dh->dqdh_prev_free = cpu_to_le32(0);
|
||||||
/* No matter whether write succeeds block is out of list */
|
/* No matter whether write succeeds block is out of list */
|
||||||
if (write_blk(info, blk, buf) < 0)
|
if (write_blk(info, blk, buf) < 0)
|
||||||
printk(KERN_ERR "VFS: Can't write block (%u) with free entries.\n", blk);
|
printk(KERN_ERR "VFS: Can't write block (%u) with free entries.\n", blk);
|
||||||
return 0;
|
return 0;
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(tmpbuf);
|
kfree(tmpbuf);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert given block to the beginning of list with free entries */
|
/* Insert given block to the beginning of list with free entries */
|
||||||
static int insert_free_dqentry(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint blk)
|
static int insert_free_dqentry(struct qtree_mem_dqinfo *info, char *buf, uint blk)
|
||||||
{
|
{
|
||||||
dqbuf_t tmpbuf = getdqbuf(info->dqi_usable_bs);
|
char *tmpbuf = getdqbuf(info->dqi_usable_bs);
|
||||||
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
|
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -188,12 +181,12 @@ static int insert_free_dqentry(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto out_buf;
|
goto out_buf;
|
||||||
}
|
}
|
||||||
freedqbuf(tmpbuf);
|
kfree(tmpbuf);
|
||||||
info->dqi_free_entry = blk;
|
info->dqi_free_entry = blk;
|
||||||
mark_info_dirty(info->dqi_sb, info->dqi_type);
|
mark_info_dirty(info->dqi_sb, info->dqi_type);
|
||||||
return 0;
|
return 0;
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(tmpbuf);
|
kfree(tmpbuf);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +208,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
{
|
{
|
||||||
uint blk, i;
|
uint blk, i;
|
||||||
struct qt_disk_dqdbheader *dh;
|
struct qt_disk_dqdbheader *dh;
|
||||||
dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
|
char *buf = getdqbuf(info->dqi_usable_bs);
|
||||||
char *ddquot;
|
char *ddquot;
|
||||||
|
|
||||||
*err = 0;
|
*err = 0;
|
||||||
|
@ -233,7 +226,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
blk = get_free_dqblk(info);
|
blk = get_free_dqblk(info);
|
||||||
if ((int)blk < 0) {
|
if ((int)blk < 0) {
|
||||||
*err = blk;
|
*err = blk;
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memset(buf, 0, info->dqi_usable_bs);
|
memset(buf, 0, info->dqi_usable_bs);
|
||||||
|
@ -253,9 +246,10 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
}
|
}
|
||||||
le16_add_cpu(&dh->dqdh_entries, 1);
|
le16_add_cpu(&dh->dqdh_entries, 1);
|
||||||
/* Find free structure in block */
|
/* Find free structure in block */
|
||||||
for (i = 0, ddquot = ((char *)buf) + sizeof(struct qt_disk_dqdbheader);
|
for (i = 0, ddquot = buf + sizeof(struct qt_disk_dqdbheader);
|
||||||
i < qtree_dqstr_in_blk(info) && !qtree_entry_unused(info, ddquot);
|
i < qtree_dqstr_in_blk(info) && !qtree_entry_unused(info, ddquot);
|
||||||
i++, ddquot += info->dqi_entry_size);
|
i++, ddquot += info->dqi_entry_size)
|
||||||
|
;
|
||||||
#ifdef __QUOTA_QT_PARANOIA
|
#ifdef __QUOTA_QT_PARANOIA
|
||||||
if (i == qtree_dqstr_in_blk(info)) {
|
if (i == qtree_dqstr_in_blk(info)) {
|
||||||
printk(KERN_ERR "VFS: find_free_dqentry(): Data block full "
|
printk(KERN_ERR "VFS: find_free_dqentry(): Data block full "
|
||||||
|
@ -273,10 +267,10 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
dquot->dq_off = (blk << info->dqi_blocksize_bits) +
|
dquot->dq_off = (blk << info->dqi_blocksize_bits) +
|
||||||
sizeof(struct qt_disk_dqdbheader) +
|
sizeof(struct qt_disk_dqdbheader) +
|
||||||
i * info->dqi_entry_size;
|
i * info->dqi_entry_size;
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return blk;
|
return blk;
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +278,7 @@ out_buf:
|
||||||
static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
||||||
uint *treeblk, int depth)
|
uint *treeblk, int depth)
|
||||||
{
|
{
|
||||||
dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
|
char *buf = getdqbuf(info->dqi_usable_bs);
|
||||||
int ret = 0, newson = 0, newact = 0;
|
int ret = 0, newson = 0, newact = 0;
|
||||||
__le32 *ref;
|
__le32 *ref;
|
||||||
uint newblk;
|
uint newblk;
|
||||||
|
@ -333,7 +327,7 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
||||||
put_free_dqblk(info, buf, *treeblk);
|
put_free_dqblk(info, buf, *treeblk);
|
||||||
}
|
}
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +347,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
|
||||||
int type = dquot->dq_type;
|
int type = dquot->dq_type;
|
||||||
struct super_block *sb = dquot->dq_sb;
|
struct super_block *sb = dquot->dq_sb;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
dqbuf_t ddquot = getdqbuf(info->dqi_entry_size);
|
char *ddquot = getdqbuf(info->dqi_entry_size);
|
||||||
|
|
||||||
if (!ddquot)
|
if (!ddquot)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -364,15 +358,15 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printk(KERN_ERR "VFS: Error %zd occurred while "
|
printk(KERN_ERR "VFS: Error %zd occurred while "
|
||||||
"creating quota.\n", ret);
|
"creating quota.\n", ret);
|
||||||
freedqbuf(ddquot);
|
kfree(ddquot);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spin_lock(&dq_data_lock);
|
spin_lock(&dq_data_lock);
|
||||||
info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
|
info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
|
||||||
spin_unlock(&dq_data_lock);
|
spin_unlock(&dq_data_lock);
|
||||||
ret = sb->s_op->quota_write(sb, type, (char *)ddquot,
|
ret = sb->s_op->quota_write(sb, type, ddquot, info->dqi_entry_size,
|
||||||
info->dqi_entry_size, dquot->dq_off);
|
dquot->dq_off);
|
||||||
if (ret != info->dqi_entry_size) {
|
if (ret != info->dqi_entry_size) {
|
||||||
printk(KERN_WARNING "VFS: dquota write failed on dev %s\n",
|
printk(KERN_WARNING "VFS: dquota write failed on dev %s\n",
|
||||||
sb->s_id);
|
sb->s_id);
|
||||||
|
@ -382,7 +376,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
dqstats.writes++;
|
dqstats.writes++;
|
||||||
freedqbuf(ddquot);
|
kfree(ddquot);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +387,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
||||||
uint blk)
|
uint blk)
|
||||||
{
|
{
|
||||||
struct qt_disk_dqdbheader *dh;
|
struct qt_disk_dqdbheader *dh;
|
||||||
dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
|
char *buf = getdqbuf(info->dqi_usable_bs);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
|
@ -444,7 +438,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
||||||
}
|
}
|
||||||
dquot->dq_off = 0; /* Quota is now unattached */
|
dquot->dq_off = 0; /* Quota is now unattached */
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,7 +446,7 @@ out_buf:
|
||||||
static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
||||||
uint *blk, int depth)
|
uint *blk, int depth)
|
||||||
{
|
{
|
||||||
dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
|
char *buf = getdqbuf(info->dqi_usable_bs);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint newblk;
|
uint newblk;
|
||||||
__le32 *ref = (__le32 *)buf;
|
__le32 *ref = (__le32 *)buf;
|
||||||
|
@ -475,9 +469,8 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
||||||
int i;
|
int i;
|
||||||
ref[get_index(info, dquot->dq_id, depth)] = cpu_to_le32(0);
|
ref[get_index(info, dquot->dq_id, depth)] = cpu_to_le32(0);
|
||||||
/* Block got empty? */
|
/* Block got empty? */
|
||||||
for (i = 0;
|
for (i = 0; i < (info->dqi_usable_bs >> 2) && !ref[i]; i++)
|
||||||
i < (info->dqi_usable_bs >> 2) && !ref[i];
|
;
|
||||||
i++);
|
|
||||||
/* Don't put the root block into the free block list */
|
/* Don't put the root block into the free block list */
|
||||||
if (i == (info->dqi_usable_bs >> 2)
|
if (i == (info->dqi_usable_bs >> 2)
|
||||||
&& *blk != QT_TREEOFF) {
|
&& *blk != QT_TREEOFF) {
|
||||||
|
@ -491,7 +484,7 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +503,7 @@ EXPORT_SYMBOL(qtree_delete_dquot);
|
||||||
static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
|
static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
struct dquot *dquot, uint blk)
|
struct dquot *dquot, uint blk)
|
||||||
{
|
{
|
||||||
dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
|
char *buf = getdqbuf(info->dqi_usable_bs);
|
||||||
loff_t ret = 0;
|
loff_t ret = 0;
|
||||||
int i;
|
int i;
|
||||||
char *ddquot;
|
char *ddquot;
|
||||||
|
@ -522,9 +515,10 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
|
printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
|
||||||
goto out_buf;
|
goto out_buf;
|
||||||
}
|
}
|
||||||
for (i = 0, ddquot = ((char *)buf) + sizeof(struct qt_disk_dqdbheader);
|
for (i = 0, ddquot = buf + sizeof(struct qt_disk_dqdbheader);
|
||||||
i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot);
|
i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot);
|
||||||
i++, ddquot += info->dqi_entry_size);
|
i++, ddquot += info->dqi_entry_size)
|
||||||
|
;
|
||||||
if (i == qtree_dqstr_in_blk(info)) {
|
if (i == qtree_dqstr_in_blk(info)) {
|
||||||
printk(KERN_ERR "VFS: Quota for id %u referenced "
|
printk(KERN_ERR "VFS: Quota for id %u referenced "
|
||||||
"but not present.\n", dquot->dq_id);
|
"but not present.\n", dquot->dq_id);
|
||||||
|
@ -535,7 +529,7 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
qt_disk_dqdbheader) + i * info->dqi_entry_size;
|
qt_disk_dqdbheader) + i * info->dqi_entry_size;
|
||||||
}
|
}
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,7 +537,7 @@ out_buf:
|
||||||
static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
|
static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
struct dquot *dquot, uint blk, int depth)
|
struct dquot *dquot, uint blk, int depth)
|
||||||
{
|
{
|
||||||
dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
|
char *buf = getdqbuf(info->dqi_usable_bs);
|
||||||
loff_t ret = 0;
|
loff_t ret = 0;
|
||||||
__le32 *ref = (__le32 *)buf;
|
__le32 *ref = (__le32 *)buf;
|
||||||
|
|
||||||
|
@ -563,7 +557,7 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
|
||||||
else
|
else
|
||||||
ret = find_block_dqentry(info, dquot, blk);
|
ret = find_block_dqentry(info, dquot, blk);
|
||||||
out_buf:
|
out_buf:
|
||||||
freedqbuf(buf);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +573,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
|
||||||
int type = dquot->dq_type;
|
int type = dquot->dq_type;
|
||||||
struct super_block *sb = dquot->dq_sb;
|
struct super_block *sb = dquot->dq_sb;
|
||||||
loff_t offset;
|
loff_t offset;
|
||||||
dqbuf_t ddquot;
|
char *ddquot;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
#ifdef __QUOTA_QT_PARANOIA
|
#ifdef __QUOTA_QT_PARANOIA
|
||||||
|
@ -607,8 +601,8 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
|
||||||
ddquot = getdqbuf(info->dqi_entry_size);
|
ddquot = getdqbuf(info->dqi_entry_size);
|
||||||
if (!ddquot)
|
if (!ddquot)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
ret = sb->s_op->quota_read(sb, type, (char *)ddquot,
|
ret = sb->s_op->quota_read(sb, type, ddquot, info->dqi_entry_size,
|
||||||
info->dqi_entry_size, dquot->dq_off);
|
dquot->dq_off);
|
||||||
if (ret != info->dqi_entry_size) {
|
if (ret != info->dqi_entry_size) {
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
@ -616,7 +610,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
|
||||||
"structure for id %u.\n", dquot->dq_id);
|
"structure for id %u.\n", dquot->dq_id);
|
||||||
set_bit(DQ_FAKE_B, &dquot->dq_flags);
|
set_bit(DQ_FAKE_B, &dquot->dq_flags);
|
||||||
memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
|
memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
|
||||||
freedqbuf(ddquot);
|
kfree(ddquot);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
spin_lock(&dq_data_lock);
|
spin_lock(&dq_data_lock);
|
||||||
|
@ -627,7 +621,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
|
||||||
!dquot->dq_dqb.dqb_isoftlimit)
|
!dquot->dq_dqb.dqb_isoftlimit)
|
||||||
set_bit(DQ_FAKE_B, &dquot->dq_flags);
|
set_bit(DQ_FAKE_B, &dquot->dq_flags);
|
||||||
spin_unlock(&dq_data_lock);
|
spin_unlock(&dq_data_lock);
|
||||||
freedqbuf(ddquot);
|
kfree(ddquot);
|
||||||
out:
|
out:
|
||||||
dqstats.reads++;
|
dqstats.reads++;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue