pub struct Namespace { /* private fields */ }
Expand description
An NVMe namespace.
Implementations§
Source§impl Namespace
impl Namespace
Sourcepub fn block_count(&self) -> u64
pub fn block_count(&self) -> u64
Gets the current block count.
Sourcepub async fn wait_resize(&self, block_count: u64) -> u64
pub async fn wait_resize(&self, block_count: u64) -> u64
Wait for the block count to be different from block_count
.
Sourcepub fn block_size(&self) -> u32
pub fn block_size(&self) -> u32
Gets the block size in bytes.
Sourcepub async fn read(
&self,
target_cpu: u32,
lba: u64,
block_count: u32,
guest_memory: &GuestMemory,
mem: PagedRange<'_>,
) -> Result<(), RequestError>
pub async fn read( &self, target_cpu: u32, lba: u64, block_count: u32, guest_memory: &GuestMemory, mem: PagedRange<'_>, ) -> Result<(), RequestError>
Reads from the namespace.
Sourcepub async fn write(
&self,
target_cpu: u32,
lba: u64,
block_count: u32,
fua: bool,
guest_memory: &GuestMemory,
mem: PagedRange<'_>,
) -> Result<(), RequestError>
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.
Sourcepub async fn flush(&self, target_cpu: u32) -> Result<(), RequestError>
pub async fn flush(&self, target_cpu: u32) -> Result<(), RequestError>
Flushes the namespace to persistent media.
Sourcepub fn max_transfer_block_count(&self) -> u32
pub fn max_transfer_block_count(&self) -> u32
Returns the maximum size for a read or write, in blocks.
Sourcepub fn supports_dataset_management(&self) -> bool
pub fn supports_dataset_management(&self) -> bool
Returns whether the namespace support dataset management, needed to call
Self::deallocate
.
Sourcepub fn preferred_deallocate_granularity(&self) -> u16
pub fn preferred_deallocate_granularity(&self) -> u16
The preferred granularity for unmap requests.
Sourcepub fn dataset_management_range_limit(&self) -> usize
pub fn dataset_management_range_limit(&self) -> usize
Returns the maximum number of ranges to pass to Self::deallocate
.
Sourcepub fn dataset_management_range_size_limit(&self) -> u32
pub fn dataset_management_range_size_limit(&self) -> u32
Returns the maximum size of a single range to pass to
Self::deallocate
.
Sourcepub async fn deallocate(
&self,
target_cpu: u32,
ranges: &[DsmRange],
) -> Result<(), RequestError>
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.
Sourcepub fn reservation_capabilities(&self) -> ReservationCapabilities
pub fn reservation_capabilities(&self) -> ReservationCapabilities
Gets the namespace’s reservation capabilities.
Sourcepub async fn reservation_report_extended(
&self,
target_cpu: u32,
) -> Result<(ReservationReportExtended, Vec<RegisteredControllerExtended>), RequestError>
pub async fn reservation_report_extended( &self, target_cpu: u32, ) -> Result<(ReservationReportExtended, Vec<RegisteredControllerExtended>), RequestError>
Gets the namespace’s reservation report.
Sourcepub async fn reservation_acquire(
&self,
target_cpu: u32,
action: ReservationAcquireAction,
crkey: u64,
prkey: u64,
reservation_type: ReservationType,
) -> Result<(), RequestError>
pub async fn reservation_acquire( &self, target_cpu: u32, action: ReservationAcquireAction, crkey: u64, prkey: u64, reservation_type: ReservationType, ) -> Result<(), RequestError>
Acquires a reservation.
Sourcepub async fn reservation_release(
&self,
target_cpu: u32,
action: ReservationReleaseAction,
crkey: u64,
reservation_type: ReservationType,
) -> Result<(), RequestError>
pub async fn reservation_release( &self, target_cpu: u32, action: ReservationReleaseAction, crkey: u64, reservation_type: ReservationType, ) -> Result<(), RequestError>
Releases a reservation.
Sourcepub async fn reservation_register(
&self,
target_cpu: u32,
action: ReservationRegisterAction,
crkey: Option<u64>,
nrkey: u64,
ptpl: Option<bool>,
) -> Result<(), RequestError>
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.
Sourcepub fn save(&self) -> Result<SavedNamespaceData>
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.