quota: remove unnecessary oom message
v2 cover quota: remove unnecessary oom message
v1 --> v2:
As Jan Kara's suggestion:
get rid of getdqbuf() altogether and instead call kmalloc() directly in all the places.
Zhen Lei (1):
quota: remove unnecessary oom message
fs/quota/quota_tree.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/1 quota: remove unnecessary oom message
Fixes scripts/checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message
Remove it can help us save a bit of memory. After that, the static function getdqbuf() becomes unnecessary, get rid of it and instead call kmalloc() directly.
Signed-off-by Zhen Lei <[email protected]>
--- fs/quota/quota_tree.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
fs/quota/quota_tree.c +12 -21
@@ -47,15 +47,6 @@ static int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info) / info->dqi_entry_size; } -static char *getdqbuf (size_t size) -{ -char *buf =kmalloc (size,GFP_NOFS ); -if (!buf) -printk (KERN_WARNING -"VFS: Not enough memory for quota buffers.\n" ); -return buf; -} -static ssize_t read_blk (struct qtree_mem_dqinfo *info,uint blk,char *buf) {struct super_block *sb = info->dqi_sb;
@@ -83,7 +74,7 @@ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf)/* Remove empty block from list and return it */ static int get_free_dqblk (struct qtree_mem_dqinfo *info) { -char *buf =getdqbuf (info->dqi_usable_bs); +char *buf =kmalloc (info->dqi_usable_bs,GFP_NOFS );struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;int ret, blk;
@@ -132,7 +123,7 @@ static int put_free_dqblk(struct qtree_mem_dqinfo *info, char *buf, uint blk)static int remove_free_dqentry (struct qtree_mem_dqinfo *info,char *buf,uint blk) { -char *tmpbuf =getdqbuf (info->dqi_usable_bs); +char *tmpbuf =kmalloc (info->dqi_usable_bs,GFP_NOFS );struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;uint nextblk =le32_to_cpu (dh->dqdh_next_free);uint prevblk =le32_to_cpu (dh->dqdh_prev_free);
@@ -179,7 +170,7 @@ static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,static int insert_free_dqentry (struct qtree_mem_dqinfo *info,char *buf,uint blk) { -char *tmpbuf =getdqbuf (info->dqi_usable_bs); +char *tmpbuf =kmalloc (info->dqi_usable_bs,GFP_NOFS );struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;int err;
@@ -227,7 +218,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, {uint blk, i;struct qt_disk_dqdbheader *dh; -char *buf =getdqbuf (info->dqi_usable_bs); +char *buf =kmalloc (info->dqi_usable_bs,GFP_NOFS );char *ddquot; *err =0 ;
@@ -298,7 +289,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,static int do_insert_tree (struct qtree_mem_dqinfo *info,struct dquot *dquot,uint *treeblk,int depth) { -char *buf =getdqbuf (info->dqi_usable_bs); +char *buf =kmalloc (info->dqi_usable_bs,GFP_NOFS );int ret =0 , newson =0 , newact =0 ;__le32 *ref;uint newblk;
@@ -375,7 +366,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)int type = dquot->dq_id.type;struct super_block *sb = dquot->dq_sb;ssize_t ret; -char *ddquot =getdqbuf (info->dqi_entry_size); +char *ddquot =kmalloc (info->dqi_entry_size,GFP_NOFS );if (!ddquot)return -ENOMEM ;
@@ -414,7 +405,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, uint blk) {struct qt_disk_dqdbheader *dh; -char *buf =getdqbuf (info->dqi_usable_bs); +char *buf =kmalloc (info->dqi_usable_bs,GFP_NOFS );int ret =0 ;if (!buf)
@@ -474,7 +465,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,static int remove_tree (struct qtree_mem_dqinfo *info,struct dquot *dquot,uint *blk,int depth) { -char *buf =getdqbuf (info->dqi_usable_bs); +char *buf =kmalloc (info->dqi_usable_bs,GFP_NOFS );int ret =0 ;uint newblk;__le32 *ref = (__le32 *)buf;
@@ -533,7 +524,7 @@ EXPORT_SYMBOL(qtree_delete_dquot);static loff_t find_block_dqentry (struct qtree_mem_dqinfo *info,struct dquot *dquot,uint blk) { -char *buf =getdqbuf (info->dqi_usable_bs); +char *buf =kmalloc (info->dqi_usable_bs,GFP_NOFS );loff_t ret =0 ;int i;char *ddquot;
@@ -571,7 +562,7 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,static loff_t find_tree_dqentry (struct qtree_mem_dqinfo *info,struct dquot *dquot,uint blk,int depth) { -char *buf =getdqbuf (info->dqi_usable_bs); +char *buf =kmalloc (info->dqi_usable_bs,GFP_NOFS );loff_t ret =0 ;__le32 *ref = (__le32 *)buf;
@@ -635,7 +626,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) } dquot->dq_off = offset; } - ddquot =getdqbuf (info->dqi_entry_size); + ddquot =kmalloc (info->dqi_entry_size,GFP_NOFS );if (!ddquot)return -ENOMEM ; ret = sb->s_op->quota_read(sb, type, ddquot, info->dqi_entry_size,
@@ -679,7 +670,7 @@ EXPORT_SYMBOL(qtree_release_dquot);static int find_next_id (struct qtree_mem_dqinfo *info,qid_t *id,unsigned int blk,int depth) { -char *buf =getdqbuf (info->dqi_usable_bs); +char *buf =kmalloc (info->dqi_usable_bs,GFP_NOFS );__le32 *ref = (__le32 *)buf;ssize_t ret;unsigned int epb = info->dqi_usable_bs >>2 ;
Signature · 1 line
2.25.1
Quoted 11 lines · Zhen Lei
v1 --> v2:
As Jan Kara's suggestion:
get rid ofgetdqbuf()altogether and instead callkmalloc()directly in all the places.Zhen Lei (1):
quota: remove unnecessary oom messagefs/quota/quota_tree.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
Thanks! I've merged the patch to my tree.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR