pub struct BlockDevice { /* private fields */ }
Expand description
A storvsp disk backed by a raw block device.
Implementations§
Source§impl BlockDevice
impl BlockDevice
Sourcepub async fn new(
file: File,
read_only: bool,
uring: Arc<dyn Initiate>,
uevent_listener: Option<&UeventListener>,
bounce_buffer_tracker: Arc<BounceBufferTracker>,
always_bounce: bool,
) -> Result<BlockDevice, NewDeviceError>
pub async fn new( file: File, read_only: bool, uring: Arc<dyn Initiate>, uevent_listener: Option<&UeventListener>, bounce_buffer_tracker: Arc<BounceBufferTracker>, always_bounce: bool, ) -> Result<BlockDevice, NewDeviceError>
Constructs a new BlockDevice
backed by the specified file.
§Arguments
file
- The backing device opened for raw access.read_only
- Indicates whether the device is opened for read-only access.uring
- The IO uring to use for issuing IOs.always_bounce
- Whether to always use bounce buffers for IOs, even for those that are aligned.
Trait Implementations§
Source§impl DiskIo for BlockDevice
impl DiskIo for BlockDevice
Source§fn sector_count(&self) -> u64
fn sector_count(&self) -> u64
Returns the current sector count. Read more
Source§fn sector_size(&self) -> u32
fn sector_size(&self) -> u32
Returns the logical sector size of the backing store. Read more
Source§fn disk_id(&self) -> Option<[u8; 16]>
fn disk_id(&self) -> Option<[u8; 16]>
Optionally returns a 16-byte identifier for the disk, if there is a
natural one for this backing store. Read more
Source§fn physical_sector_size(&self) -> u32
fn physical_sector_size(&self) -> u32
Returns the physical sector size of the backing store. Read more
Source§fn is_fua_respected(&self) -> bool
fn is_fua_respected(&self) -> bool
Returns true if the
fua
parameter to [DiskIo::write_vectored
] is
respected by the backing store by ensuring that the IO is immediately
committed to disk.Source§fn is_read_only(&self) -> bool
fn is_read_only(&self) -> bool
Returns true if the disk is read only.
Source§fn pr(&self) -> Option<&dyn PersistentReservation>
fn pr(&self) -> Option<&dyn PersistentReservation>
Optionally returns a trait object to issue persistent reservation
requests.
Source§async fn eject(&self) -> Result<(), DiskError>
async fn eject(&self) -> Result<(), DiskError>
Issues an asynchronous eject media operation to the disk.
Source§async fn read_vectored(
&self,
buffers: &RequestBuffers<'_>,
sector: u64,
) -> Result<(), DiskError>
async fn read_vectored( &self, buffers: &RequestBuffers<'_>, sector: u64, ) -> Result<(), DiskError>
Issues an asynchronous read-scatter operation to the disk. Read more
Source§async fn write_vectored(
&self,
buffers: &RequestBuffers<'_>,
sector: u64,
fua: bool,
) -> Result<(), DiskError>
async fn write_vectored( &self, buffers: &RequestBuffers<'_>, sector: u64, fua: bool, ) -> Result<(), DiskError>
Issues an asynchronous write-gather operation to the disk. Read more
Source§async fn sync_cache(&self) -> Result<(), DiskError>
async fn sync_cache(&self) -> Result<(), DiskError>
Issues an asynchronous flush operation to the disk.
Source§async fn wait_resize(&self, sector_count: u64) -> u64
async fn wait_resize(&self, sector_count: u64) -> u64
Waits for the disk sector size to be different than the specified value.
Source§async fn unmap(
&self,
sector_offset: u64,
sector_count: u64,
_block_level_only: bool,
) -> Result<(), DiskError>
async fn unmap( &self, sector_offset: u64, sector_count: u64, _block_level_only: bool, ) -> Result<(), DiskError>
Unmap sectors from the layer.
Source§fn unmap_behavior(&self) -> UnmapBehavior
fn unmap_behavior(&self) -> UnmapBehavior
Returns the behavior of the unmap operation.
Source§fn optimal_unmap_sectors(&self) -> u32
fn optimal_unmap_sectors(&self) -> u32
Returns the optimal granularity for unmaps, in sectors.
Source§impl PersistentReservation for BlockDevice
impl PersistentReservation for BlockDevice
Source§fn capabilities(&self) -> ReservationCapabilities
fn capabilities(&self) -> ReservationCapabilities
Returns the disk’s capabilities.
Source§fn report<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ReservationReport, DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn report<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ReservationReport, DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a report of the current registration and reservation state.
Source§fn register<'life0, 'async_trait>(
&'life0 self,
current_key: Option<u64>,
new_key: u64,
ptpl: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register<'life0, 'async_trait>(
&'life0 self,
current_key: Option<u64>,
new_key: u64,
ptpl: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Updates the registration for this client. Read more
Source§fn reserve<'life0, 'async_trait>(
&'life0 self,
key: u64,
reservation_type: ReservationType,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reserve<'life0, 'async_trait>(
&'life0 self,
key: u64,
reservation_type: ReservationType,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a reservation for this client with type
reservation_type
. Read moreSource§fn release<'life0, 'async_trait>(
&'life0 self,
key: u64,
reservation_type: ReservationType,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn release<'life0, 'async_trait>(
&'life0 self,
key: u64,
reservation_type: ReservationType,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Releases the reservation for this client with type
reservation_type
. Read moreSource§fn clear<'life0, 'async_trait>(
&'life0 self,
key: u64,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
key: u64,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clears any reservation and registration for this client. Read more
Source§fn preempt<'life0, 'async_trait>(
&'life0 self,
current_key: u64,
preempt_key: u64,
reservation_type: ReservationType,
abort: bool,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn preempt<'life0, 'async_trait>(
&'life0 self,
current_key: u64,
preempt_key: u64,
reservation_type: ReservationType,
abort: bool,
) -> Pin<Box<dyn Future<Output = Result<(), DiskError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Preempts an existing reservation. See the SCSI spec for the precise
behavior of this.
Auto Trait Implementations§
impl !Freeze for BlockDevice
impl !RefUnwindSafe for BlockDevice
impl Send for BlockDevice
impl Sync for BlockDevice
impl Unpin for BlockDevice
impl !UnwindSafe for BlockDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more