nvme_driver

Struct Namespace

Source
pub struct Namespace { /* private fields */ }
Expand description

An NVMe namespace.

Implementations§

Source§

impl Namespace

Source

pub fn block_count(&self) -> u64

Gets the current block count.

Source

pub async fn wait_resize(&self, block_count: u64) -> u64

Wait for the block count to be different from block_count.

Source

pub fn block_size(&self) -> u32

Gets the block size in bytes.

Source

pub async fn read( &self, target_cpu: u32, lba: u64, block_count: u32, guest_memory: &GuestMemory, mem: PagedRange<'_>, ) -> Result<(), RequestError>

Reads from the namespace.

Source

pub async fn write( &self, target_cpu: u32, lba: u64, block_count: u32, fua: bool, guest_memory: &GuestMemory, mem: PagedRange<'_>, ) -> Result<(), RequestError>

Writes to the namespace.

Source

pub async fn flush(&self, target_cpu: u32) -> Result<(), RequestError>

Flushes the namespace to persistent media.

Source

pub fn max_transfer_block_count(&self) -> u32

Returns the maximum size for a read or write, in blocks.

Source

pub fn supports_dataset_management(&self) -> bool

Returns whether the namespace support dataset management, needed to call Self::deallocate.

Source

pub fn preferred_deallocate_granularity(&self) -> u16

The preferred granularity for unmap requests.

Source

pub fn dataset_management_range_limit(&self) -> usize

Returns the maximum number of ranges to pass to Self::deallocate.

Source

pub fn dataset_management_range_size_limit(&self) -> u32

Returns the maximum size of a single range to pass to Self::deallocate.

Source

pub async fn deallocate( &self, target_cpu: u32, ranges: &[DsmRange], ) -> Result<(), RequestError>

Issues a dataset management command to deallocate the specified ranges.

The device may ignore ranges or LBA counts beyond a certain point. Use Self::dataset_management_range_limit and Self::dataset_management_range_size_limit to get the controller-reported bounds.

Source

pub fn reservation_capabilities(&self) -> ReservationCapabilities

Gets the namespace’s reservation capabilities.

Source

pub async fn reservation_report_extended( &self, target_cpu: u32, ) -> Result<(ReservationReportExtended, Vec<RegisteredControllerExtended>), RequestError>

Gets the namespace’s reservation report.

Source

pub async fn reservation_acquire( &self, target_cpu: u32, action: ReservationAcquireAction, crkey: u64, prkey: u64, reservation_type: ReservationType, ) -> Result<(), RequestError>

Acquires a reservation.

Source

pub async fn reservation_release( &self, target_cpu: u32, action: ReservationReleaseAction, crkey: u64, reservation_type: ReservationType, ) -> Result<(), RequestError>

Releases a reservation.

Source

pub async fn reservation_register( &self, target_cpu: u32, action: ReservationRegisterAction, crkey: Option<u64>, nrkey: u64, ptpl: Option<bool>, ) -> Result<(), RequestError>

Modifies a reservation registration.

Source

pub fn nsid(&self) -> u32

Return Namespace ID.

Source

pub fn save(&self) -> Result<SavedNamespaceData>

Save namespace object data for servicing. Initially we will re-query namespace state after restore to avoid possible contention if namespace was changed during servicing. TODO: Re-enable namespace save/restore once we confirm that we can process namespace change AEN.

Trait Implementations§

Source§

impl Debug for Namespace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Inspect for Namespace

Source§

fn inspect(&self, req: Request<'_>)

Inspects the object.

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more