What file is /dev/btrfs-control?

I can’t find any explanation about this file in the official documentation, I just know from the official documentation in devices.txt that this file is:
"234 = /dev/btrfs-control Btrfs control device".

Asked By: xnl2d

||

It’s defined in fs/btrfs/super.c in kernel source code, and used for various BtrFS-specific ioctl() system calls.

Generally, unless you are developing the libbtrfs library of the btrfs-progs package, you don’t need to care about it.

But if you are curious, seeDocumentation/btrfs-ioctl.rst in btrfs-progs package, read the detailed description of each BtrFS ioctl, and see which ones have the ioctl fd specified as "file descriptor of the control device".

Alternatively, you can look at the btrfs_control_ioctl function in the kernel source code, which implements the ioctls accessible through the control device. At the time of this writing, there are four of them:

  • BTRFS_IOC_SCAN_DEV
  • BTRFS_IOC_FORGET_DEV
  • BTRFS_IOC_DEVICES_READY
  • BTRFS_IOC_GET_SUPPORTED_FEATURES
Answered By: telcoM
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.