pub struct SysfsBtrfs { /* private fields */ }Expand description
Provides typed access to the sysfs files exposed for a single mounted btrfs
filesystem under /sys/fs/btrfs/<uuid>/.
Implementations§
Source§impl SysfsBtrfs
impl SysfsBtrfs
Sourcepub fn new(uuid: &Uuid) -> Self
pub fn new(uuid: &Uuid) -> Self
Create a new SysfsBtrfs for the filesystem with the given UUID.
Sourcepub fn bg_reclaim_threshold(&self) -> Result<u64>
pub fn bg_reclaim_threshold(&self) -> Result<u64>
Background reclaim threshold as a percentage (0–100).
/sys/fs/btrfs/<uuid>/bg_reclaim_threshold
Sourcepub fn checksum(&self) -> Result<String>
pub fn checksum(&self) -> Result<String>
Checksum algorithm in use, e.g. "crc32c (crc32c-lib)".
/sys/fs/btrfs/<uuid>/checksum
Sourcepub fn clone_alignment(&self) -> Result<u64>
pub fn clone_alignment(&self) -> Result<u64>
Minimum clone/reflink alignment in bytes.
/sys/fs/btrfs/<uuid>/clone_alignment
Sourcepub fn commit_stats(&self) -> Result<CommitStats>
pub fn commit_stats(&self) -> Result<CommitStats>
Commit statistics since mount (or last reset).
/sys/fs/btrfs/<uuid>/commit_stats
Sourcepub fn reset_commit_stats(&self) -> Result<()>
pub fn reset_commit_stats(&self) -> Result<()>
Reset the max_commit_ms counter by writing 0 to the commit_stats
file. Requires root.
/sys/fs/btrfs/<uuid>/commit_stats
Sourcepub fn exclusive_operation(&self) -> Result<String>
pub fn exclusive_operation(&self) -> Result<String>
Name of the exclusive operation currently running, e.g. "none",
"balance", "device add".
/sys/fs/btrfs/<uuid>/exclusive_operation
Sourcepub fn features(&self) -> Result<Vec<String>>
pub fn features(&self) -> Result<Vec<String>>
Names of the filesystem features that are enabled. Each feature
corresponds to a file in the features/ subdirectory.
/sys/fs/btrfs/<uuid>/features/
Sourcepub fn generation(&self) -> Result<u64>
pub fn generation(&self) -> Result<u64>
Current filesystem generation number.
/sys/fs/btrfs/<uuid>/generation
Sourcepub fn label(&self) -> Result<String>
pub fn label(&self) -> Result<String>
Filesystem label. Empty string if no label is set.
/sys/fs/btrfs/<uuid>/label
Sourcepub fn metadata_uuid(&self) -> Result<Uuid>
pub fn metadata_uuid(&self) -> Result<Uuid>
Metadata UUID. May differ from the filesystem UUID if the metadata UUID
feature is in use.
/sys/fs/btrfs/<uuid>/metadata_uuid
Sourcepub fn quota_override(&self) -> Result<bool>
pub fn quota_override(&self) -> Result<bool>
Whether the quota override is active.
/sys/fs/btrfs/<uuid>/quota_override
Sourcepub fn read_policy(&self) -> Result<String>
pub fn read_policy(&self) -> Result<String>
Read policy for RAID profiles, e.g. "[pid]" or "[roundrobin]".
/sys/fs/btrfs/<uuid>/read_policy
Sourcepub fn sectorsize(&self) -> Result<u64>
pub fn sectorsize(&self) -> Result<u64>
Sector size in bytes.
/sys/fs/btrfs/<uuid>/sectorsize
Sourcepub fn temp_fsid(&self) -> Result<bool>
pub fn temp_fsid(&self) -> Result<bool>
Whether a temporary fsid is in use (seeding device feature).
/sys/fs/btrfs/<uuid>/temp_fsid
Sourcepub fn scrub_speed_max_get(&self, devid: u64) -> Result<u64>
pub fn scrub_speed_max_get(&self, devid: u64) -> Result<u64>
Read the per-device scrub throughput limit for the given device, in
bytes per second. A value of 0 means no limit is set (unlimited).
/sys/fs/btrfs/<uuid>/devinfo/<devid>/scrub_speed_max
Sourcepub fn scrub_speed_max_set(&self, devid: u64, limit: u64) -> Result<()>
pub fn scrub_speed_max_set(&self, devid: u64, limit: u64) -> Result<()>
Set the per-device scrub throughput limit for the given device, in
bytes per second. Pass 0 to remove the limit (unlimited).
Requires root.
/sys/fs/btrfs/<uuid>/devinfo/<devid>/scrub_speed_max
Sourcepub fn quota_status(&self) -> Result<QuotaStatus>
pub fn quota_status(&self) -> Result<QuotaStatus>
Quota status for this filesystem, read from
/sys/fs/btrfs/<uuid>/qgroups/.
Returns Ok(QuotaStatus { enabled: false, .. }) when quota is not
enabled (the qgroups/ directory does not exist). Returns an
io::Error with kind NotFound if the sysfs entry for this UUID
does not exist (i.e. the filesystem is not currently mounted).