提交 172ddd60 编写于 作者: D David Sterba

btrfs: drop gfp parameter from alloc_extent_map

pass GFP_NOFS directly to kmem_cache_alloc
Signed-off-by: NDavid Sterba <dsterba@suse.cz>
上级 a8067e02
...@@ -154,7 +154,7 @@ static struct extent_map *btree_get_extent(struct inode *inode, ...@@ -154,7 +154,7 @@ static struct extent_map *btree_get_extent(struct inode *inode,
} }
read_unlock(&em_tree->lock); read_unlock(&em_tree->lock);
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
if (!em) { if (!em) {
em = ERR_PTR(-ENOMEM); em = ERR_PTR(-ENOMEM);
goto out; goto out;
......
...@@ -6694,7 +6694,7 @@ static noinline int relocate_data_extent(struct inode *reloc_inode, ...@@ -6694,7 +6694,7 @@ static noinline int relocate_data_extent(struct inode *reloc_inode,
u64 start = extent_key->objectid - offset; u64 start = extent_key->objectid - offset;
u64 end = start + extent_key->offset - 1; u64 end = start + extent_key->offset - 1;
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
BUG_ON(!em); BUG_ON(!em);
em->start = start; em->start = start;
......
...@@ -40,16 +40,15 @@ void extent_map_tree_init(struct extent_map_tree *tree) ...@@ -40,16 +40,15 @@ void extent_map_tree_init(struct extent_map_tree *tree)
/** /**
* alloc_extent_map - allocate new extent map structure * alloc_extent_map - allocate new extent map structure
* @mask: memory allocation flags
* *
* Allocate a new extent_map structure. The new structure is * Allocate a new extent_map structure. The new structure is
* returned with a reference count of one and needs to be * returned with a reference count of one and needs to be
* freed using free_extent_map() * freed using free_extent_map()
*/ */
struct extent_map *alloc_extent_map(gfp_t mask) struct extent_map *alloc_extent_map(void)
{ {
struct extent_map *em; struct extent_map *em;
em = kmem_cache_alloc(extent_map_cache, mask); em = kmem_cache_alloc(extent_map_cache, GFP_NOFS);
if (!em) if (!em)
return NULL; return NULL;
em->in_tree = 0; em->in_tree = 0;
......
...@@ -56,7 +56,7 @@ int add_extent_mapping(struct extent_map_tree *tree, ...@@ -56,7 +56,7 @@ int add_extent_mapping(struct extent_map_tree *tree,
struct extent_map *em); struct extent_map *em);
int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em); int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em);
struct extent_map *alloc_extent_map(gfp_t mask); struct extent_map *alloc_extent_map(void);
void free_extent_map(struct extent_map *em); void free_extent_map(struct extent_map *em);
int __init extent_map_init(void); int __init extent_map_init(void);
void extent_map_exit(void); void extent_map_exit(void);
......
...@@ -191,9 +191,9 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, ...@@ -191,9 +191,9 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
} }
while (1) { while (1) {
if (!split) if (!split)
split = alloc_extent_map(GFP_NOFS); split = alloc_extent_map();
if (!split2) if (!split2)
split2 = alloc_extent_map(GFP_NOFS); split2 = alloc_extent_map();
BUG_ON(!split || !split2); BUG_ON(!split || !split2);
write_lock(&em_tree->lock); write_lock(&em_tree->lock);
......
...@@ -649,7 +649,7 @@ static noinline int submit_compressed_extents(struct inode *inode, ...@@ -649,7 +649,7 @@ static noinline int submit_compressed_extents(struct inode *inode,
async_extent->start + async_extent->start +
async_extent->ram_size - 1, 0); async_extent->ram_size - 1, 0);
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
BUG_ON(!em); BUG_ON(!em);
em->start = async_extent->start; em->start = async_extent->start;
em->len = async_extent->ram_size; em->len = async_extent->ram_size;
...@@ -826,7 +826,7 @@ static noinline int cow_file_range(struct inode *inode, ...@@ -826,7 +826,7 @@ static noinline int cow_file_range(struct inode *inode,
(u64)-1, &ins, 1); (u64)-1, &ins, 1);
BUG_ON(ret); BUG_ON(ret);
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
BUG_ON(!em); BUG_ON(!em);
em->start = start; em->start = start;
em->orig_start = em->start; em->orig_start = em->start;
...@@ -1177,7 +1177,7 @@ static noinline int run_delalloc_nocow(struct inode *inode, ...@@ -1177,7 +1177,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
struct extent_map *em; struct extent_map *em;
struct extent_map_tree *em_tree; struct extent_map_tree *em_tree;
em_tree = &BTRFS_I(inode)->extent_tree; em_tree = &BTRFS_I(inode)->extent_tree;
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
BUG_ON(!em); BUG_ON(!em);
em->start = cur_offset; em->start = cur_offset;
em->orig_start = em->start; em->orig_start = em->start;
...@@ -5069,7 +5069,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, ...@@ -5069,7 +5069,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
else else
goto out; goto out;
} }
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
if (!em) { if (!em) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -5382,7 +5382,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag ...@@ -5382,7 +5382,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag
u64 hole_start = start; u64 hole_start = start;
u64 hole_len = len; u64 hole_len = len;
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
if (!em) { if (!em) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -5483,7 +5483,7 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, ...@@ -5483,7 +5483,7 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode,
} }
if (!em) { if (!em) {
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
if (!em) { if (!em) {
em = ERR_PTR(-ENOMEM); em = ERR_PTR(-ENOMEM);
goto out; goto out;
......
...@@ -2870,7 +2870,7 @@ int setup_extent_mapping(struct inode *inode, u64 start, u64 end, ...@@ -2870,7 +2870,7 @@ int setup_extent_mapping(struct inode *inode, u64 start, u64 end,
struct extent_map *em; struct extent_map *em;
int ret = 0; int ret = 0;
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
if (!em) if (!em)
return -ENOMEM; return -ENOMEM;
......
...@@ -2609,7 +2609,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, ...@@ -2609,7 +2609,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
trace_btrfs_chunk_alloc(info->chunk_root, map, start, *num_bytes); trace_btrfs_chunk_alloc(info->chunk_root, map, start, *num_bytes);
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
if (!em) { if (!em) {
ret = -ENOMEM; ret = -ENOMEM;
goto error; goto error;
...@@ -3499,7 +3499,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, ...@@ -3499,7 +3499,7 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
free_extent_map(em); free_extent_map(em);
} }
em = alloc_extent_map(GFP_NOFS); em = alloc_extent_map();
if (!em) if (!em)
return -ENOMEM; return -ENOMEM;
num_stripes = btrfs_chunk_num_stripes(leaf, chunk); num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册