]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: shrink the size of btrfs_device
authorQu Wenruo <wqu@suse.com>
Fri, 9 Jan 2026 23:38:28 +0000 (10:08 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:51:43 +0000 (07:51 +0100)
commit4681dbcfdc33d6627193425222819577a89857cc
treecf07840728a62e07e9056d38a61ecf12bdb17db7
parent8ecf596ed822d481d1ad0bb589a7d5b9a7e82898
btrfs: shrink the size of btrfs_device

There are two main causes of holes inside btrfs_device:

- The single bytes member of last_flush_error
  Not only it's a single byte member, but we never really care about the
  exact error number.

- The @devt member
  Which is placed between two u64 members.

Shrink the size of btrfs_device by:

- Use a single bit flag for flush error
  Use BTRFS_DEV_STATE_FLUSH_FAILED so that we no longer need that
  dedicated member.

- Move @devt to the hole after dev_stat_values[]

This reduces the size of btrfs_device from 528 to exact 512 bytes for
x86_64.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h