diff options
author | David Sterba <dsterba@suse.com> | 2015-11-10 12:54:03 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-01-07 09:20:55 -0500 |
commit | 8546b570511f428838129c00e701eda481cd7c13 (patch) | |
tree | bf8087d889e778e484afb12af3ee82edd5220e28 /fs/btrfs/transaction.c | |
parent | b0c0ea6338d5018e02d27c5315084fb1a5d099f6 (diff) |
btrfs: preallocate path for snapshot creation at ioctl time
We can also preallocate btrfs_path that's used during pending snapshot
creation and avoid another late ENOMEM failure.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 2074106122d9..be463b7f1f30 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1319,11 +1319,8 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
1319 | u64 root_flags; | 1319 | u64 root_flags; |
1320 | uuid_le new_uuid; | 1320 | uuid_le new_uuid; |
1321 | 1321 | ||
1322 | path = btrfs_alloc_path(); | 1322 | ASSERT(pending->path); |
1323 | if (!path) { | 1323 | path = pending->path; |
1324 | pending->error = -ENOMEM; | ||
1325 | return 0; | ||
1326 | } | ||
1327 | 1324 | ||
1328 | ASSERT(pending->root_item); | 1325 | ASSERT(pending->root_item); |
1329 | new_root_item = pending->root_item; | 1326 | new_root_item = pending->root_item; |
@@ -1561,6 +1558,8 @@ no_free_objectid: | |||
1561 | kfree(new_root_item); | 1558 | kfree(new_root_item); |
1562 | pending->root_item = NULL; | 1559 | pending->root_item = NULL; |
1563 | btrfs_free_path(path); | 1560 | btrfs_free_path(path); |
1561 | pending->path = NULL; | ||
1562 | |||
1564 | return ret; | 1563 | return ret; |
1565 | } | 1564 | } |
1566 | 1565 | ||