Commit 71b565ce authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: drop ext4_kvmalloc()

As Jan pointed out[1], as of commit 81378da6 ("jbd2: mark the
transaction context with the scope GFP_NOFS context") we use
memalloc_nofs_{save,restore}() while a jbd2 handle is active.  So
ext4_kvmalloc() so we can call allocate using GFP_NOFS is no longer
necessary.

[1] https://lore.kernel.org/r/20200109100007.GC27035@quack2.suse.czSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20200116155031.266620-1-tytso@mit.eduReviewed-by: default avatarJan Kara <jack@suse.cz>
parent a54d8d34
...@@ -2740,7 +2740,6 @@ extern struct buffer_head *ext4_sb_bread(struct super_block *sb, ...@@ -2740,7 +2740,6 @@ extern struct buffer_head *ext4_sb_bread(struct super_block *sb,
extern int ext4_seq_options_show(struct seq_file *seq, void *offset); extern int ext4_seq_options_show(struct seq_file *seq, void *offset);
extern int ext4_calculate_overhead(struct super_block *sb); extern int ext4_calculate_overhead(struct super_block *sb);
extern void ext4_superblock_csum_set(struct super_block *sb); extern void ext4_superblock_csum_set(struct super_block *sb);
extern void *ext4_kvmalloc(size_t size, gfp_t flags);
extern int ext4_alloc_flex_bg_array(struct super_block *sb, extern int ext4_alloc_flex_bg_array(struct super_block *sb,
ext4_group_t ngroup); ext4_group_t ngroup);
extern const char *ext4_decode_error(struct super_block *sb, int errno, extern const char *ext4_decode_error(struct super_block *sb, int errno,
......
...@@ -824,9 +824,8 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, ...@@ -824,9 +824,8 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
if (unlikely(err)) if (unlikely(err))
goto errout; goto errout;
n_group_desc = ext4_kvmalloc((gdb_num + 1) * n_group_desc = kvmalloc((gdb_num + 1) * sizeof(struct buffer_head *),
sizeof(struct buffer_head *), GFP_KERNEL);
GFP_NOFS);
if (!n_group_desc) { if (!n_group_desc) {
err = -ENOMEM; err = -ENOMEM;
ext4_warning(sb, "not enough memory for %lu groups", ext4_warning(sb, "not enough memory for %lu groups",
...@@ -900,9 +899,8 @@ static int add_new_gdb_meta_bg(struct super_block *sb, ...@@ -900,9 +899,8 @@ static int add_new_gdb_meta_bg(struct super_block *sb,
gdb_bh = ext4_sb_bread(sb, gdblock, 0); gdb_bh = ext4_sb_bread(sb, gdblock, 0);
if (IS_ERR(gdb_bh)) if (IS_ERR(gdb_bh))
return PTR_ERR(gdb_bh); return PTR_ERR(gdb_bh);
n_group_desc = ext4_kvmalloc((gdb_num + 1) * n_group_desc = kvmalloc((gdb_num + 1) * sizeof(struct buffer_head *),
sizeof(struct buffer_head *), GFP_KERNEL);
GFP_NOFS);
if (!n_group_desc) { if (!n_group_desc) {
brelse(gdb_bh); brelse(gdb_bh);
err = -ENOMEM; err = -ENOMEM;
......
...@@ -204,16 +204,6 @@ void ext4_superblock_csum_set(struct super_block *sb) ...@@ -204,16 +204,6 @@ void ext4_superblock_csum_set(struct super_block *sb)
es->s_checksum = ext4_superblock_csum(sb, es); es->s_checksum = ext4_superblock_csum(sb, es);
} }
void *ext4_kvmalloc(size_t size, gfp_t flags)
{
void *ret;
ret = kmalloc(size, flags | __GFP_NOWARN);
if (!ret)
ret = __vmalloc(size, flags, PAGE_KERNEL);
return ret;
}
ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
struct ext4_group_desc *bg) struct ext4_group_desc *bg)
{ {
......
...@@ -1456,7 +1456,7 @@ ext4_xattr_inode_cache_find(struct inode *inode, const void *value, ...@@ -1456,7 +1456,7 @@ ext4_xattr_inode_cache_find(struct inode *inode, const void *value,
if (!ce) if (!ce)
return NULL; return NULL;
ea_data = ext4_kvmalloc(value_len, GFP_NOFS); ea_data = kvmalloc(value_len, GFP_KERNEL);
if (!ea_data) { if (!ea_data) {
mb_cache_entry_put(ea_inode_cache, ce); mb_cache_entry_put(ea_inode_cache, ce);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment