Skip to content

RFC btrfs: new performance-based chunk allocation using device roles

Anand Jain linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest10 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10btrfs: fix thresh scope in should_alloc_chunk()fs/btrfs/block-group.c+4 -40 replies
2/10btrfs: refactor should_alloc_chunk() arg typefs/btrfs/block-group.c+2 -10 replies
3/10btrfs: introduce btrfs_split_sysfs_arg() for argument parsingfs/btrfs/sysfs.c+24 -100 replies
4/10btrfs: introduce device allocation methodfs/btrfs/volumes.c fs/btrfs/volumes.h+19 -30 replies
5/10btrfs: sysfs: show device allocation methodfs/btrfs/sysfs.c+95 -00 replies
6/10btrfs: skip device sorting when only one device is presentfs/btrfs/volumes.c+4 -00 replies
7/10btrfs: refactor chunk allocation device handling to use list_headfs/btrfs/volumes.c fs/btrfs/volumes.h+65 -370 replies
8/10btrfs: introduce explicit device roles for block groupsfs/btrfs/volumes.c fs/btrfs/volumes.h+41 -00 replies
9/10btrfs: introduce ROLE_THEN_SPACE device allocation methodfs/btrfs/sysfs.c fs/btrfs/volumes.c fs/btrfs/volumes.h+85 -80 replies
10/10btrfs: pass device roles through device add ioctlfs/btrfs/ioctl.c fs/btrfs/volumes.c fs/btrfs/volumes.h+29 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 00/10] btrfs: new performance-based chunk allocation using device roles

In host hardware, devices can have different speeds. Generally, faster devices come with lesser capacity while slower devices come with larger capacity. A typical configuration would expect that:

- A filesystem's read/write performance is evenly distributed on average across the entire filesystem. This is not achievable with the current allocation method because chunks are allocated based only on device free space.

- Typically, faster devices are assigned to metadata chunk allocations while slower devices are assigned to data chunk allocations.

Introducing Device Roles:

Here I define 5 device roles in a specific order for metadata and in the reverse order for data: metadata_only, metadata, none, data, data_only. One or more devices may have the same role.

The metadata and data roles indicate preference but not exclusivity for that role, whereas data_only and metadata_only are exclusive roles.

Introducing Role-then-Space allocation method:

Metadata allocation can happen on devices with the roles metadata_only, metadata, none, and data in that order. If multiple devices share a role, they are arranged based on device free space.

Similarly, data allocation can happen on devices with the roles data_only, data, none, and metadata in that order. If multiple devices share a role, they are arranged based on device free space.

Finding device speed automatically:

Measuring device read/write latency for the allocaiton is not good idea, as the historical readings and may be misleading, as they could include iostat data from periods with issues that have since been fixed. Testing to determine relative latency and arranging in ascending order for metadata and descending for data is possible, but is better handled by an external tool that can still set device roles.

On-Disk Format changes:

The following items are defined but are unused on-disk format:

	btrfs_dev_item::
	 __le64 type; // unused
	 __le64 start_offset; // unused
	 __le32 dev_group; // unused
	 __u8 seek_speed; // unused
	 __u8 bandwidth; // unused

The device roles is using the dev_item::type 8-bit field to store each device's role.

Anand Jain (10):
btrfs: fix thresh scope in should_alloc_chunk()
btrfs: refactor should_alloc_chunk() arg type
btrfs: introduce btrfs_split_sysfs_arg() for argument parsing
btrfs: introduce device allocation method
btrfs: sysfs: show device allocation method
btrfs: skip device sorting when only one device is present
btrfs: refactor chunk allocation device handling to use list_head
btrfs: introduce explicit device roles for block groups
btrfs: introduce ROLE_THEN_SPACE device allocation method
btrfs: pass device roles through device add ioctl

 fs/btrfs/block-group.c |  11 +-
 fs/btrfs/ioctl.c       |  12 +-
 fs/btrfs/sysfs.c       | 130 ++++++++++++++++++++--
 fs/btrfs/volumes.c     | 242 +++++++++++++++++++++++++++++++++--------
 fs/btrfs/volumes.h     |  35 +++++-
 5 files changed, 366 insertions(+), 64 deletions(-)
Signature · 1 line
2.49.0