async fn probe_index(
        &self,
        partition_lba: u64,
    ) -> Result<NexusMetaData, MetaDataError> {
        let (bdev, hndl) = self.get_dev().context(NexusChildError {})?;
        let block_size = bdev.block_len() as u64;

        //
        // Header
        let blocks = Aligned::get_blocks(
            MetaDataHeader::METADATA_HEADER_SIZE as u64,
            block_size,
        );
        let mut buf =
            hndl.dma_malloc(blocks * block_size).context(ReadAlloc {
                name: String::from("header"),
            })?;
        hndl.read_at((partition_lba + 1) * block_size, &mut buf)
            .await
            .context(ReadError {
                name: String::from("header"),
            })?;
        let header = NexusMetaData::read_header(&buf)?;

        //
        // Index
        let index = if header.used_entries > 0 {
            let blocks = Aligned::get_blocks(
                (header.used_entries * header.entry_size) as u64,
                block_size,
            );
            let mut buf =
                hndl.dma_malloc(blocks * block_size).context(ReadAlloc {
                    name: String::from("index"),
                })?;
            hndl.read_at(
                (header.self_lba + header.index_start) * block_size,
                &mut buf,
            )
            .await
            .context(ReadError {
                name: String::from("index"),
            })?;
            NexusMetaData::read_index(&buf, &header)?
        } else {
            NexusMetaData::empty_index(&header)?
        };

        Ok(NexusMetaData {
            header,
            index,
        })
    }
/// Read the Metadata header + index from disk
Read the Metadata header + index from disk
Read the Metadata header + index from disk
async fn probe_index(
        &self,
        partition_lba: u64,
    ) -> Result<NexusMetaData, MetaDataError> {
        let (bdev, hndl) = self.get_dev().context(NexusChildError {})?;
        let block_size = bdev.block_len() as u64;
        //
        // Header
        let blocks = Aligned::get_blocks(
            MetaDataHeader::METADATA_HEADER_SIZE as u64,
            block_size,
        );
        let mut buf =
            hndl.dma_malloc(blocks * block_size).context(ReadAlloc {
                name: String::from("header"),
            })?;
        hndl.read_at((partition_lba + 1) * block_size, &mut buf)
            .await
            .context(ReadError {
                name: String::from("header"),
            })?;
        let header = NexusMetaData::read_header(&buf)?;
        //
        // Index
        let index = if header.used_entries > 0 {
            let blocks = Aligned::get_blocks(
                (header.used_entries * header.entry_size) as u64,
                block_size,
            );
            let mut buf =
                hndl.dma_malloc(blocks * block_size).context(ReadAlloc {
                    name: String::from("index"),
                })?;
            hndl.read_at(
                (header.self_lba + header.index_start) * block_size,
                &mut buf,
            )
            .await
            .context(ReadError {
                name: String::from("index"),
            })?;
            NexusMetaData::read_index(&buf, &header)?
        } else {
            NexusMetaData::empty_index(&header)?
        };
        Ok(NexusMetaData {
            header,
            index,
        })
    }
async fn probe_index ( & self , partition_lba : u64 , ) -> Result < NexusMetaData , MetaDataError > { let ( bdev , hndl ) = self . get_dev ( ) . context ( NexusChildError { } ) ? ; let block_size = bdev . block_len ( ) as u64 ; // // Header let blocks = Aligned :: get_blocks ( MetaDataHeader :: METADATA_HEADER_SIZE as u64 , block_size , ) ; let mut buf = hndl . dma_malloc ( blocks * block_size ) . context ( ReadAlloc { name : String :: from ( " " ) , } ) ? ; hndl . read_at ( ( partition_lba + 1 ) * block_size , & mut buf ) . await . context ( ReadError { name : String :: from ( " " ) , } ) ? ; let header = NexusMetaData :: read_header ( & buf ) ? ; // // Index let index = if header . used_entries > 0 { let blocks = Aligned :: get_blocks ( ( header . used_entries * header . entry_size ) as u64 , block_size , ) ; let mut buf = hndl . dma_malloc ( blocks * block_size ) . context ( ReadAlloc { name : String :: from ( " " ) , } ) ? ; hndl . read_at ( ( header . self_lba + header . index_start ) * block_size , & mut buf , ) . await . context ( ReadError { name : String :: from ( " " ) , } ) ? ; NexusMetaData :: read_index ( & buf , & header ) ? } else { NexusMetaData :: empty_index ( & header ) ? } ; Ok ( NexusMetaData { header , index , } ) }
Read the Metadata header + index from disk
Read the Metadata header + index from disk
&self
partition_lba
u64