diff options
| author | Nikolay Borisov <nborisov@suse.com> | 2018-06-18 07:13:19 -0400 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2018-08-06 07:12:38 -0400 |
| commit | bc877d285ca3dba24c52406946a4a69847cc7422 (patch) | |
| tree | f7d9439fb1887bd693bde80d9e7ffdf170910a14 /fs/btrfs/ioctl.c | |
| parent | 9912bbf6440ba0555e91d3306520da01872c7c1d (diff) | |
btrfs: Deduplicate extent_buffer init code
When a new extent buffer is allocated there are a few mandatory fields
which need to be set in order for the buffer to be sane: level,
generation, bytenr, backref_rev, owner and FSID/UUID. Currently this
is open coded in the callers of btrfs_alloc_tree_block, meaning it's
fairly high in the abstraction hierarchy of operations. This patch
solves this by simply moving this init code in btrfs_init_new_buffer,
since this is the function which initializes a newly allocated
extent buffer. No functional changes.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
| -rw-r--r-- | fs/btrfs/ioctl.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0c4b9f364e84..08b8c0b346b3 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -616,14 +616,6 @@ static noinline int create_subvol(struct inode *dir, | |||
| 616 | goto fail; | 616 | goto fail; |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | memzero_extent_buffer(leaf, 0, sizeof(struct btrfs_header)); | ||
| 620 | btrfs_set_header_bytenr(leaf, leaf->start); | ||
| 621 | btrfs_set_header_generation(leaf, trans->transid); | ||
| 622 | btrfs_set_header_backref_rev(leaf, BTRFS_MIXED_BACKREF_REV); | ||
| 623 | btrfs_set_header_owner(leaf, objectid); | ||
| 624 | |||
| 625 | write_extent_buffer_fsid(leaf, fs_info->fsid); | ||
| 626 | write_extent_buffer_chunk_tree_uuid(leaf, fs_info->chunk_tree_uuid); | ||
| 627 | btrfs_mark_buffer_dirty(leaf); | 619 | btrfs_mark_buffer_dirty(leaf); |
| 628 | 620 | ||
| 629 | inode_item = &root_item->inode; | 621 | inode_item = &root_item->inode; |
