Skip to content

sysfs publishing patchset

Jeff Mahoney linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13btrfs: add ioctls to query/change feature bits onlinefs/btrfs/ctree.h fs/btrfs/ioctl.c include/uapi/linux/btrfs.h+166 -00 replies
2/13kobject: export kobj_sysfs_opslib/kobject.c+1 -01 reply
3/13btrfs: publish supported featured in sysfsfs/btrfs/sysfs.c fs/btrfs/sysfs.h+87 -00 replies
4/13btrfs: publish per-super attributes in sysfsfs/btrfs/ctree.h fs/btrfs/disk-io.c fs/btrfs/sysfs.c +1 more+57 -00 replies
5/13btrfs: publish per-super features in sysfsfs/btrfs/sysfs.c+65 -160 replies
6/13btrfs: publish unknown feature bits in sysfsfs/btrfs/sysfs.c+107 -10 replies
7/13btrfs: add ability to change features via sysfsfs/btrfs/sysfs.c fs/btrfs/sysfs.h+117 -40 replies
8/13btrfs: use feature attribute names to print better error messagesfs/btrfs/ioctl.c fs/btrfs/sysfs.c fs/btrfs/sysfs.h+64 -60 replies
9/13btrfs: add ioctl to export size of global metadata reservationfs/btrfs/ioctl.c include/uapi/linux/btrfs.h+17 -00 replies
10/13btrfs: publish allocation data in sysfsfs/btrfs/ctree.h fs/btrfs/extent-tree.c fs/btrfs/sysfs.c +1 more+228 -51 reply
11/13btrfs: publish device membership in sysfsfs/btrfs/ctree.h fs/btrfs/sysfs.c+33 -00 replies
12/13btrfs: publish fs label in sysfsfs/btrfs/sysfs.c+44 -00 replies
13/13btrfs: add tracing for failed reservationsfs/btrfs/extent-tree.c+7 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [patch 00/13] sysfs publishing patchset

This patchset implements the stubbed-out sysfs interface for btrfs. Or at least begins to do so.

We publish:
- Features supported by the file system implementation
- Features enabled on the file system, including features unknown to the implemenation. These attributes can also be used to enable or disable features at runtime, subjecting to a safety mask.
- Uses the attribute names to print feature names when declining to mount a file system.
- The allocation data: global metadata reservation size and reserved, space_infos, and sums of the block groups total and used bytes.
- Device membership via links to the block devices.
- FS label, which is writeable.

- I've also added matching ioctls for some of the functionality here so that btrfsprogs can use the information without jumping through hoops to read/parse the sysfs files. There are ioctls to query the supported features and to query/set features on a particular file system. There's also one to export the size of the global metadata reservation. I have a patch for btrfs-progs that uses this to print useful info in 'btrfs fi df' output.

Ultimately, the tree structure looks like the following, under /sys/fs/btrfs. This is from a test file system, using two devices in raid1. You'll notice the 'single' and 'raid1' directories under the {data,metadata,system} dirs. The raid profiles are created and removed as the first/last block group of a certain profile is added and removed.

<fsid>/devices/sdc1
<fsid>/devices/sdd1
<fsid>/label
<fsid>/allocation/data/flags
<fsid>/allocation/data/raid1/used_bytes
<fsid>/allocation/data/raid1/total_bytes
<fsid>/allocation/data/bytes_pinned
<fsid>/allocation/data/bytes_may_use
<fsid>/allocation/data/total_bytes_pinned
<fsid>/allocation/data/bytes_reserved
<fsid>/allocation/data/bytes_used
<fsid>/allocation/data/single/used_bytes
<fsid>/allocation/data/single/total_bytes
<fsid>/allocation/data/total_bytes
<fsid>/allocation/data/disk_total
<fsid>/allocation/data/disk_used
<fsid>/allocation/metadata/flags
<fsid>/allocation/metadata/raid1/used_bytes
<fsid>/allocation/metadata/raid1/total_bytes
<fsid>/allocation/metadata/bytes_pinned
<fsid>/allocation/metadata/bytes_may_use
<fsid>/allocation/metadata/total_bytes_pinned
<fsid>/allocation/metadata/bytes_reserved
<fsid>/allocation/metadata/bytes_used
<fsid>/allocation/metadata/single/used_bytes
<fsid>/allocation/metadata/single/total_bytes
<fsid>/allocation/metadata/total_bytes
<fsid>/allocation/metadata/disk_total
<fsid>/allocation/metadata/disk_used
<fsid>/allocation/global_rsv_size
<fsid>/allocation/global_rsv_reserved
<fsid>/allocation/system/flags
<fsid>/allocation/system/raid1/used_bytes
<fsid>/allocation/system/raid1/total_bytes
<fsid>/allocation/system/bytes_pinned
<fsid>/allocation/system/bytes_may_use
<fsid>/allocation/system/total_bytes_pinned
<fsid>/allocation/system/bytes_reserved
<fsid>/allocation/system/bytes_used
<fsid>/allocation/system/single/used_bytes
<fsid>/allocation/system/single/total_bytes
<fsid>/allocation/system/total_bytes
<fsid>/allocation/system/disk_total
<fsid>/allocation/system/disk_used
<fsid>/features/mixed_backref
<fsid>/features/extended_iref
features/compress_lzo
features/big_metadata
features/compress_lzov2
features/default_subvol
features/mixed_backref
features/raid56
features/mixed_groups
features/skinny_metadata
features/extended_iref

-Jeff