aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-01-18 12:42:13 -0500
committerDavid Sterba <dsterba@suse.com>2016-02-11 09:19:39 -0500
commite780b0d1c1523ec8cd489c6910fb8c5ee452bb6c (patch)
tree17ea7efb28155906024692a66b6202afd458e501
parent388f7b1d6e8ca06762e2454d28d6c3c55ad0fe95 (diff)
btrfs: send: use GFP_KERNEL everywhere
The send operation is not on the critical writeback path we don't need to use GFP_NOFS for allocations. All error paths are handled and the whole operation is restartable. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/ctree.c2
-rw-r--r--fs/btrfs/send.c36
2 files changed, 19 insertions, 19 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 769e0ff1b4ce..00741eb94651 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -5361,7 +5361,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
5361 goto out; 5361 goto out;
5362 } 5362 }
5363 5363
5364 tmp_buf = kmalloc(left_root->nodesize, GFP_NOFS); 5364 tmp_buf = kmalloc(left_root->nodesize, GFP_KERNEL);
5365 if (!tmp_buf) { 5365 if (!tmp_buf) {
5366 ret = -ENOMEM; 5366 ret = -ENOMEM;
5367 goto out; 5367 goto out;
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 63a6152be04b..d2e29925f1da 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -304,7 +304,7 @@ static struct fs_path *fs_path_alloc(void)
304{ 304{
305 struct fs_path *p; 305 struct fs_path *p;
306 306
307 p = kmalloc(sizeof(*p), GFP_NOFS); 307 p = kmalloc(sizeof(*p), GFP_KERNEL);
308 if (!p) 308 if (!p)
309 return NULL; 309 return NULL;
310 p->reversed = 0; 310 p->reversed = 0;
@@ -363,11 +363,11 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
363 * First time the inline_buf does not suffice 363 * First time the inline_buf does not suffice
364 */ 364 */
365 if (p->buf == p->inline_buf) { 365 if (p->buf == p->inline_buf) {
366 tmp_buf = kmalloc(len, GFP_NOFS); 366 tmp_buf = kmalloc(len, GFP_KERNEL);
367 if (tmp_buf) 367 if (tmp_buf)
368 memcpy(tmp_buf, p->buf, old_buf_len); 368 memcpy(tmp_buf, p->buf, old_buf_len);
369 } else { 369 } else {
370 tmp_buf = krealloc(p->buf, len, GFP_NOFS); 370 tmp_buf = krealloc(p->buf, len, GFP_KERNEL);
371 } 371 }
372 if (!tmp_buf) 372 if (!tmp_buf)
373 return -ENOMEM; 373 return -ENOMEM;
@@ -995,7 +995,7 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
995 * values are small. 995 * values are small.
996 */ 996 */
997 buf_len = PATH_MAX; 997 buf_len = PATH_MAX;
998 buf = kmalloc(buf_len, GFP_NOFS); 998 buf = kmalloc(buf_len, GFP_KERNEL);
999 if (!buf) { 999 if (!buf) {
1000 ret = -ENOMEM; 1000 ret = -ENOMEM;
1001 goto out; 1001 goto out;
@@ -1042,7 +1042,7 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
1042 buf = NULL; 1042 buf = NULL;
1043 } else { 1043 } else {
1044 char *tmp = krealloc(buf, buf_len, 1044 char *tmp = krealloc(buf, buf_len,
1045 GFP_NOFS | __GFP_NOWARN); 1045 GFP_KERNEL | __GFP_NOWARN);
1046 1046
1047 if (!tmp) 1047 if (!tmp)
1048 kfree(buf); 1048 kfree(buf);
@@ -1303,7 +1303,7 @@ static int find_extent_clone(struct send_ctx *sctx,
1303 /* We only use this path under the commit sem */ 1303 /* We only use this path under the commit sem */
1304 tmp_path->need_commit_sem = 0; 1304 tmp_path->need_commit_sem = 0;
1305 1305
1306 backref_ctx = kmalloc(sizeof(*backref_ctx), GFP_NOFS); 1306 backref_ctx = kmalloc(sizeof(*backref_ctx), GFP_KERNEL);
1307 if (!backref_ctx) { 1307 if (!backref_ctx) {
1308 ret = -ENOMEM; 1308 ret = -ENOMEM;
1309 goto out; 1309 goto out;
@@ -1984,7 +1984,7 @@ static int name_cache_insert(struct send_ctx *sctx,
1984 nce_head = radix_tree_lookup(&sctx->name_cache, 1984 nce_head = radix_tree_lookup(&sctx->name_cache,
1985 (unsigned long)nce->ino); 1985 (unsigned long)nce->ino);
1986 if (!nce_head) { 1986 if (!nce_head) {
1987 nce_head = kmalloc(sizeof(*nce_head), GFP_NOFS); 1987 nce_head = kmalloc(sizeof(*nce_head), GFP_KERNEL);
1988 if (!nce_head) { 1988 if (!nce_head) {
1989 kfree(nce); 1989 kfree(nce);
1990 return -ENOMEM; 1990 return -ENOMEM;
@@ -2179,7 +2179,7 @@ out_cache:
2179 /* 2179 /*
2180 * Store the result of the lookup in the name cache. 2180 * Store the result of the lookup in the name cache.
2181 */ 2181 */
2182 nce = kmalloc(sizeof(*nce) + fs_path_len(dest) + 1, GFP_NOFS); 2182 nce = kmalloc(sizeof(*nce) + fs_path_len(dest) + 1, GFP_KERNEL);
2183 if (!nce) { 2183 if (!nce) {
2184 ret = -ENOMEM; 2184 ret = -ENOMEM;
2185 goto out; 2185 goto out;
@@ -2315,7 +2315,7 @@ static int send_subvol_begin(struct send_ctx *sctx)
2315 if (!path) 2315 if (!path)
2316 return -ENOMEM; 2316 return -ENOMEM;
2317 2317
2318 name = kmalloc(BTRFS_PATH_NAME_MAX, GFP_NOFS); 2318 name = kmalloc(BTRFS_PATH_NAME_MAX, GFP_KERNEL);
2319 if (!name) { 2319 if (!name) {
2320 btrfs_free_path(path); 2320 btrfs_free_path(path);
2321 return -ENOMEM; 2321 return -ENOMEM;
@@ -2730,7 +2730,7 @@ static int __record_ref(struct list_head *head, u64 dir,
2730{ 2730{
2731 struct recorded_ref *ref; 2731 struct recorded_ref *ref;
2732 2732
2733 ref = kmalloc(sizeof(*ref), GFP_NOFS); 2733 ref = kmalloc(sizeof(*ref), GFP_KERNEL);
2734 if (!ref) 2734 if (!ref)
2735 return -ENOMEM; 2735 return -ENOMEM;
2736 2736
@@ -2755,7 +2755,7 @@ static int dup_ref(struct recorded_ref *ref, struct list_head *list)
2755{ 2755{
2756 struct recorded_ref *new; 2756 struct recorded_ref *new;
2757 2757
2758 new = kmalloc(sizeof(*ref), GFP_NOFS); 2758 new = kmalloc(sizeof(*ref), GFP_KERNEL);
2759 if (!new) 2759 if (!new)
2760 return -ENOMEM; 2760 return -ENOMEM;
2761 2761
@@ -2818,7 +2818,7 @@ add_orphan_dir_info(struct send_ctx *sctx, u64 dir_ino)
2818 struct rb_node *parent = NULL; 2818 struct rb_node *parent = NULL;
2819 struct orphan_dir_info *entry, *odi; 2819 struct orphan_dir_info *entry, *odi;
2820 2820
2821 odi = kmalloc(sizeof(*odi), GFP_NOFS); 2821 odi = kmalloc(sizeof(*odi), GFP_KERNEL);
2822 if (!odi) 2822 if (!odi)
2823 return ERR_PTR(-ENOMEM); 2823 return ERR_PTR(-ENOMEM);
2824 odi->ino = dir_ino; 2824 odi->ino = dir_ino;
@@ -2973,7 +2973,7 @@ static int add_waiting_dir_move(struct send_ctx *sctx, u64 ino, bool orphanized)
2973 struct rb_node *parent = NULL; 2973 struct rb_node *parent = NULL;
2974 struct waiting_dir_move *entry, *dm; 2974 struct waiting_dir_move *entry, *dm;
2975 2975
2976 dm = kmalloc(sizeof(*dm), GFP_NOFS); 2976 dm = kmalloc(sizeof(*dm), GFP_KERNEL);
2977 if (!dm) 2977 if (!dm)
2978 return -ENOMEM; 2978 return -ENOMEM;
2979 dm->ino = ino; 2979 dm->ino = ino;
@@ -3040,7 +3040,7 @@ static int add_pending_dir_move(struct send_ctx *sctx,
3040 int exists = 0; 3040 int exists = 0;
3041 int ret; 3041 int ret;
3042 3042
3043 pm = kmalloc(sizeof(*pm), GFP_NOFS); 3043 pm = kmalloc(sizeof(*pm), GFP_KERNEL);
3044 if (!pm) 3044 if (!pm)
3045 return -ENOMEM; 3045 return -ENOMEM;
3046 pm->parent_ino = parent_ino; 3046 pm->parent_ino = parent_ino;
@@ -4280,7 +4280,7 @@ static int __find_xattr(int num, struct btrfs_key *di_key,
4280 strncmp(name, ctx->name, name_len) == 0) { 4280 strncmp(name, ctx->name, name_len) == 0) {
4281 ctx->found_idx = num; 4281 ctx->found_idx = num;
4282 ctx->found_data_len = data_len; 4282 ctx->found_data_len = data_len;
4283 ctx->found_data = kmemdup(data, data_len, GFP_NOFS); 4283 ctx->found_data = kmemdup(data, data_len, GFP_KERNEL);
4284 if (!ctx->found_data) 4284 if (!ctx->found_data)
4285 return -ENOMEM; 4285 return -ENOMEM;
4286 return 1; 4286 return 1;
@@ -4481,7 +4481,7 @@ static ssize_t fill_read_buf(struct send_ctx *sctx, u64 offset, u32 len)
4481 while (index <= last_index) { 4481 while (index <= last_index) {
4482 unsigned cur_len = min_t(unsigned, len, 4482 unsigned cur_len = min_t(unsigned, len,
4483 PAGE_CACHE_SIZE - pg_offset); 4483 PAGE_CACHE_SIZE - pg_offset);
4484 page = find_or_create_page(inode->i_mapping, index, GFP_NOFS); 4484 page = find_or_create_page(inode->i_mapping, index, GFP_KERNEL);
4485 if (!page) { 4485 if (!page) {
4486 ret = -ENOMEM; 4486 ret = -ENOMEM;
4487 break; 4487 break;
@@ -5989,7 +5989,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
5989 goto out; 5989 goto out;
5990 } 5990 }
5991 5991
5992 sctx = kzalloc(sizeof(struct send_ctx), GFP_NOFS); 5992 sctx = kzalloc(sizeof(struct send_ctx), GFP_KERNEL);
5993 if (!sctx) { 5993 if (!sctx) {
5994 ret = -ENOMEM; 5994 ret = -ENOMEM;
5995 goto out; 5995 goto out;
@@ -5997,7 +5997,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
5997 5997
5998 INIT_LIST_HEAD(&sctx->new_refs); 5998 INIT_LIST_HEAD(&sctx->new_refs);
5999 INIT_LIST_HEAD(&sctx->deleted_refs); 5999 INIT_LIST_HEAD(&sctx->deleted_refs);
6000 INIT_RADIX_TREE(&sctx->name_cache, GFP_NOFS); 6000 INIT_RADIX_TREE(&sctx->name_cache, GFP_KERNEL);
6001 INIT_LIST_HEAD(&sctx->name_cache_list); 6001 INIT_LIST_HEAD(&sctx->name_cache_list);
6002 6002
6003 sctx->flags = arg->flags; 6003 sctx->flags = arg->flags;