Skip to content

Commit ce1b06c

Browse files
Zhen Leijankara
authored andcommitted
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. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Zhen Lei <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent e8d46b3 commit ce1b06c

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

fs/quota/quota_tree.c

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ static int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info)
4747
/ info->dqi_entry_size;
4848
}
4949

50-
static char *getdqbuf(size_t size)
51-
{
52-
char *buf = kmalloc(size, GFP_NOFS);
53-
if (!buf)
54-
printk(KERN_WARNING
55-
"VFS: Not enough memory for quota buffers.\n");
56-
return buf;
57-
}
58-
5950
static ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf)
6051
{
6152
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)
8374
/* Remove empty block from list and return it */
8475
static int get_free_dqblk(struct qtree_mem_dqinfo *info)
8576
{
86-
char *buf = getdqbuf(info->dqi_usable_bs);
77+
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
8778
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
8879
int ret, blk;
8980

@@ -132,7 +123,7 @@ static int put_free_dqblk(struct qtree_mem_dqinfo *info, char *buf, uint blk)
132123
static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
133124
uint blk)
134125
{
135-
char *tmpbuf = getdqbuf(info->dqi_usable_bs);
126+
char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
136127
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
137128
uint nextblk = le32_to_cpu(dh->dqdh_next_free);
138129
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,
179170
static int insert_free_dqentry(struct qtree_mem_dqinfo *info, char *buf,
180171
uint blk)
181172
{
182-
char *tmpbuf = getdqbuf(info->dqi_usable_bs);
173+
char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
183174
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
184175
int err;
185176

@@ -227,7 +218,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
227218
{
228219
uint blk, i;
229220
struct qt_disk_dqdbheader *dh;
230-
char *buf = getdqbuf(info->dqi_usable_bs);
221+
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
231222
char *ddquot;
232223

233224
*err = 0;
@@ -298,7 +289,7 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
298289
static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
299290
uint *treeblk, int depth)
300291
{
301-
char *buf = getdqbuf(info->dqi_usable_bs);
292+
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
302293
int ret = 0, newson = 0, newact = 0;
303294
__le32 *ref;
304295
uint newblk;
@@ -375,7 +366,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
375366
int type = dquot->dq_id.type;
376367
struct super_block *sb = dquot->dq_sb;
377368
ssize_t ret;
378-
char *ddquot = getdqbuf(info->dqi_entry_size);
369+
char *ddquot = kmalloc(info->dqi_entry_size, GFP_NOFS);
379370

380371
if (!ddquot)
381372
return -ENOMEM;
@@ -414,7 +405,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
414405
uint blk)
415406
{
416407
struct qt_disk_dqdbheader *dh;
417-
char *buf = getdqbuf(info->dqi_usable_bs);
408+
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
418409
int ret = 0;
419410

420411
if (!buf)
@@ -474,7 +465,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
474465
static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
475466
uint *blk, int depth)
476467
{
477-
char *buf = getdqbuf(info->dqi_usable_bs);
468+
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
478469
int ret = 0;
479470
uint newblk;
480471
__le32 *ref = (__le32 *)buf;
@@ -533,7 +524,7 @@ EXPORT_SYMBOL(qtree_delete_dquot);
533524
static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
534525
struct dquot *dquot, uint blk)
535526
{
536-
char *buf = getdqbuf(info->dqi_usable_bs);
527+
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
537528
loff_t ret = 0;
538529
int i;
539530
char *ddquot;
@@ -571,7 +562,7 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
571562
static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
572563
struct dquot *dquot, uint blk, int depth)
573564
{
574-
char *buf = getdqbuf(info->dqi_usable_bs);
565+
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
575566
loff_t ret = 0;
576567
__le32 *ref = (__le32 *)buf;
577568

@@ -635,7 +626,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
635626
}
636627
dquot->dq_off = offset;
637628
}
638-
ddquot = getdqbuf(info->dqi_entry_size);
629+
ddquot = kmalloc(info->dqi_entry_size, GFP_NOFS);
639630
if (!ddquot)
640631
return -ENOMEM;
641632
ret = sb->s_op->quota_read(sb, type, ddquot, info->dqi_entry_size,
@@ -679,7 +670,7 @@ EXPORT_SYMBOL(qtree_release_dquot);
679670
static int find_next_id(struct qtree_mem_dqinfo *info, qid_t *id,
680671
unsigned int blk, int depth)
681672
{
682-
char *buf = getdqbuf(info->dqi_usable_bs);
673+
char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS);
683674
__le32 *ref = (__le32 *)buf;
684675
ssize_t ret;
685676
unsigned int epb = info->dqi_usable_bs >> 2;

0 commit comments

Comments
 (0)