summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-28 17:21:05 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit599f46ade32c4fab19e2191e85aa28fa57790444 (patch)
tree8a823bacc18dd52c9083cb92c7173a3bcea995b5
parentb423d1822928bcb074e1a0e265c3a1ccbd5a2f94 (diff)
btrfs-progs: use kzalloc to allocate transaction handle
Use the kernel-style allocation helpers and remove redundant zeroing. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--transaction.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/transaction.h b/transaction.h
index 738eebd1..ce638713 100644
--- a/transaction.h
+++ b/transaction.h
@@ -37,7 +37,7 @@ static inline struct btrfs_trans_handle *
btrfs_start_transaction(struct btrfs_root *root, int num_blocks)
{
struct btrfs_fs_info *fs_info = root->fs_info;
- struct btrfs_trans_handle *h = malloc(sizeof(*h));
+ struct btrfs_trans_handle *h = kzalloc(sizeof(*h), GFP_NOFS);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -54,11 +54,7 @@ btrfs_start_transaction(struct btrfs_root *root, int num_blocks)
fs_info->running_transaction = h;
fs_info->generation++;
h->transid = fs_info->generation;
- h->alloc_exclude_start = 0;
- h->alloc_exclude_nr = 0;
h->blocks_reserved = num_blocks;
- h->blocks_used = 0;
- h->block_group = NULL;
root->last_trans = h->transid;
root->commit_root = root->node;
extent_buffer_get(root->node);