Skip to content

Commit 71b565c

Browse files
committed
ext4: drop ext4_kvmalloc()
As Jan pointed out[1], as of commit 81378da ("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/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jan Kara <[email protected]>
1 parent a54d8d3 commit 71b565c

File tree

4 files changed

+5
-18
lines changed

4 files changed

+5
-18
lines changed

fs/ext4/ext4.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2740,7 +2740,6 @@ extern struct buffer_head *ext4_sb_bread(struct super_block *sb,
27402740
extern int ext4_seq_options_show(struct seq_file *seq, void *offset);
27412741
extern int ext4_calculate_overhead(struct super_block *sb);
27422742
extern void ext4_superblock_csum_set(struct super_block *sb);
2743-
extern void *ext4_kvmalloc(size_t size, gfp_t flags);
27442743
extern int ext4_alloc_flex_bg_array(struct super_block *sb,
27452744
ext4_group_t ngroup);
27462745
extern const char *ext4_decode_error(struct super_block *sb, int errno,

fs/ext4/resize.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -824,9 +824,8 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
824824
if (unlikely(err))
825825
goto errout;
826826

827-
n_group_desc = ext4_kvmalloc((gdb_num + 1) *
828-
sizeof(struct buffer_head *),
829-
GFP_NOFS);
827+
n_group_desc = kvmalloc((gdb_num + 1) * sizeof(struct buffer_head *),
828+
GFP_KERNEL);
830829
if (!n_group_desc) {
831830
err = -ENOMEM;
832831
ext4_warning(sb, "not enough memory for %lu groups",
@@ -900,9 +899,8 @@ static int add_new_gdb_meta_bg(struct super_block *sb,
900899
gdb_bh = ext4_sb_bread(sb, gdblock, 0);
901900
if (IS_ERR(gdb_bh))
902901
return PTR_ERR(gdb_bh);
903-
n_group_desc = ext4_kvmalloc((gdb_num + 1) *
904-
sizeof(struct buffer_head *),
905-
GFP_NOFS);
902+
n_group_desc = kvmalloc((gdb_num + 1) * sizeof(struct buffer_head *),
903+
GFP_KERNEL);
906904
if (!n_group_desc) {
907905
brelse(gdb_bh);
908906
err = -ENOMEM;

fs/ext4/super.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,6 @@ void ext4_superblock_csum_set(struct super_block *sb)
204204
es->s_checksum = ext4_superblock_csum(sb, es);
205205
}
206206

207-
void *ext4_kvmalloc(size_t size, gfp_t flags)
208-
{
209-
void *ret;
210-
211-
ret = kmalloc(size, flags | __GFP_NOWARN);
212-
if (!ret)
213-
ret = __vmalloc(size, flags, PAGE_KERNEL);
214-
return ret;
215-
}
216-
217207
ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
218208
struct ext4_group_desc *bg)
219209
{

fs/ext4/xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ ext4_xattr_inode_cache_find(struct inode *inode, const void *value,
14561456
if (!ce)
14571457
return NULL;
14581458

1459-
ea_data = ext4_kvmalloc(value_len, GFP_NOFS);
1459+
ea_data = kvmalloc(value_len, GFP_KERNEL);
14601460
if (!ea_data) {
14611461
mb_cache_entry_put(ea_inode_cache, ce);
14621462
return NULL;

0 commit comments

Comments
 (0)