]> Gentwo Git Trees - linux/.git/commit
btrfs: remove redundant zero/NULL initializations in btrfs_alloc_root()
authorFilipe Manana <fdmanana@suse.com>
Fri, 21 Nov 2025 15:56:14 +0000 (15:56 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Nov 2025 00:53:33 +0000 (01:53 +0100)
commit1c3e03b34042c2dff15d7f262b768908e4b02537
treeea7054e1d85e39e370dbdde6da1788e9b1a93b73
parent10934c131f9bcfb616dd8be9456f11efd6b240ec
btrfs: remove redundant zero/NULL initializations in btrfs_alloc_root()

We have allocated the root with kzalloc() so all the memory is already
zero initialized, therefore it's redundant to assign 0 and NULL to several
of the root members. Remove all of them except the atomic initializations
since atomic_t is an opaque type and it's not a good practice to assume
its internals.

This slightly reduces the binary size.
With gcc 14.2.0-19 from Debian on x86_64, before this change:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1939404  162963   15592 2117959  205147 fs/btrfs/btrfs.ko

After this change:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1939212  162963   15592 2117767  205087 fs/btrfs/btrfs.ko

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c