diff options
author | David Sterba <dsterba@suse.com> | 2015-11-10 18:54:03 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-01-07 15:20:55 +0100 |
commit | 8546b570511f428838129c00e701eda481cd7c13 (patch) | |
tree | bf8087d889e778e484afb12af3ee82edd5220e28 /fs/btrfs/transaction.c | |
parent | btrfs: allocate root item at snapshot ioctl time (diff) | |
download | linux-8546b570511f428838129c00e701eda481cd7c13.tar.xz linux-8546b570511f428838129c00e701eda481cd7c13.zip |
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, u64 root_flags; uuid_le new_uuid; - path = btrfs_alloc_path(); - if (!path) { - pending->error = -ENOMEM; - return 0; - } + ASSERT(pending->path); + path = pending->path; ASSERT(pending->root_item); new_root_item = pending->root_item; @@ -1561,6 +1558,8 @@ no_free_objectid: kfree(new_root_item); pending->root_item = NULL; btrfs_free_path(path); + pending->path = NULL; + return ret; } |