Skip to content

Commit cc12a6f

Browse files
Ye Bintytso
authored andcommitted
ext4: allocate extended attribute value in vmalloc area
Now, extended attribute value maximum length is 64K. The memory requested here does not need continuous physical addresses, so it is appropriate to use kvmalloc to request memory. At the same time, it can also cope with the situation that the extended attribute will become longer in the future. Signed-off-by: Ye Bin <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
1 parent 8994d11 commit cc12a6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ext4/xattr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,7 +2548,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode,
25482548

25492549
is = kzalloc(sizeof(struct ext4_xattr_ibody_find), GFP_NOFS);
25502550
bs = kzalloc(sizeof(struct ext4_xattr_block_find), GFP_NOFS);
2551-
buffer = kmalloc(value_size, GFP_NOFS);
2551+
buffer = kvmalloc(value_size, GFP_NOFS);
25522552
b_entry_name = kmalloc(entry->e_name_len + 1, GFP_NOFS);
25532553
if (!is || !bs || !buffer || !b_entry_name) {
25542554
error = -ENOMEM;
@@ -2600,7 +2600,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode,
26002600
error = 0;
26012601
out:
26022602
kfree(b_entry_name);
2603-
kfree(buffer);
2603+
kvfree(buffer);
26042604
if (is)
26052605
brelse(is->iloc.bh);
26062606
if (bs)

0 commit comments

Comments
 (0)