Skip to main content

SysfsBtrfs

Struct SysfsBtrfs 

Source
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

Source

pub fn new(uuid: &Uuid) -> Self

Create a new SysfsBtrfs for the filesystem with the given UUID.

Source

pub fn bg_reclaim_threshold(&self) -> Result<u64>

Background reclaim threshold as a percentage (0–100). /sys/fs/btrfs/<uuid>/bg_reclaim_threshold

Source

pub fn checksum(&self) -> Result<String>

Checksum algorithm in use, e.g. "crc32c (crc32c-lib)". /sys/fs/btrfs/<uuid>/checksum

Source

pub fn clone_alignment(&self) -> Result<u64>

Minimum clone/reflink alignment in bytes. /sys/fs/btrfs/<uuid>/clone_alignment

Source

pub fn commit_stats(&self) -> Result<CommitStats>

Commit statistics since mount (or last reset). /sys/fs/btrfs/<uuid>/commit_stats

Source

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

Source

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

Source

pub fn wait_for_exclusive_operation(&self) -> Result<String>

Wait until no exclusive operation is running on the filesystem.

Polls the exclusive_operation sysfs file at one-second intervals. Returns immediately if no exclusive operation is in progress, or after the running operation completes. Returns the name of the operation that was waited on, or "none" if nothing was running.

Source

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/

Source

pub fn generation(&self) -> Result<u64>

Current filesystem generation number. /sys/fs/btrfs/<uuid>/generation

Source

pub fn label(&self) -> Result<String>

Filesystem label. Empty string if no label is set. /sys/fs/btrfs/<uuid>/label

Source

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

Source

pub fn nodesize(&self) -> Result<u64>

B-tree node size in bytes. /sys/fs/btrfs/<uuid>/nodesize

Source

pub fn quota_override(&self) -> Result<bool>

Whether the quota override is active. /sys/fs/btrfs/<uuid>/quota_override

Source

pub fn read_policy(&self) -> Result<String>

Read policy for RAID profiles, e.g. "[pid]" or "[roundrobin]". /sys/fs/btrfs/<uuid>/read_policy

Source

pub fn sectorsize(&self) -> Result<u64>

Sector size in bytes. /sys/fs/btrfs/<uuid>/sectorsize

Source

pub fn temp_fsid(&self) -> Result<bool>

Whether a temporary fsid is in use (seeding device feature). /sys/fs/btrfs/<uuid>/temp_fsid

Source

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

Source

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

Source

pub fn send_stream_version(&self) -> u32

Maximum send stream protocol version supported by the kernel.

Returns 1 if the sysfs file does not exist (older kernels without versioned send stream support). /sys/fs/btrfs/features/send_stream_version

Source

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).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.