mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-11 03:31:17 +00:00
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>
This commit is contained in:
parent
b423d18229
commit
599f46ade3
@ -37,7 +37,7 @@ static inline struct btrfs_trans_handle *
|
|||||||
btrfs_start_transaction(struct btrfs_root *root, int num_blocks)
|
btrfs_start_transaction(struct btrfs_root *root, int num_blocks)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
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)
|
if (!h)
|
||||||
return ERR_PTR(-ENOMEM);
|
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->running_transaction = h;
|
||||||
fs_info->generation++;
|
fs_info->generation++;
|
||||||
h->transid = 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_reserved = num_blocks;
|
||||||
h->blocks_used = 0;
|
|
||||||
h->block_group = NULL;
|
|
||||||
root->last_trans = h->transid;
|
root->last_trans = h->transid;
|
||||||
root->commit_root = root->node;
|
root->commit_root = root->node;
|
||||||
extent_buffer_get(root->node);
|
extent_buffer_get(root->node);
|
||||||
|
Loading…
Reference in New Issue
Block a user