mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
btrfs: allocate file_ra_state on stack in readahead_cache
Instead of allocating file_ra_state using kmalloc, allocate on stack. sizeof(struct readahead) = 32 bytes. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0ff40a910f
commit
98caf9531e
@ -344,19 +344,13 @@ fail:
|
||||
|
||||
static void readahead_cache(struct inode *inode)
|
||||
{
|
||||
struct file_ra_state *ra;
|
||||
struct file_ra_state ra;
|
||||
unsigned long last_index;
|
||||
|
||||
ra = kzalloc(sizeof(*ra), GFP_NOFS);
|
||||
if (!ra)
|
||||
return;
|
||||
|
||||
file_ra_state_init(ra, inode->i_mapping);
|
||||
file_ra_state_init(&ra, inode->i_mapping);
|
||||
last_index = (i_size_read(inode) - 1) >> PAGE_SHIFT;
|
||||
|
||||
page_cache_sync_readahead(inode->i_mapping, ra, NULL, 0, last_index);
|
||||
|
||||
kfree(ra);
|
||||
page_cache_sync_readahead(inode->i_mapping, &ra, NULL, 0, last_index);
|
||||
}
|
||||
|
||||
static int io_ctl_init(struct btrfs_io_ctl *io_ctl, struct inode *inode,
|
||||
|
Loading…
Reference in New Issue
Block a user