pub fn prefetch_hint_files(
        &self,
        r: &mut RafsIoReader,
        files: Option<Vec<Inode>>,
    ) -> Result<RafsBioDesc> {
        let hint_entries = self.meta.prefetch_table_entries as usize;

        if hint_entries == 0 && files.is_none() {
            return Err(enoent!("Prefetch table is empty!"));
        }

        let mut prefetch_table = PrefetchTable::new();
        if prefetch_table
            .load_from(r, self.meta.prefetch_table_offset, hint_entries)
            .is_err()
        {
            einval!(format!(
                "Failed in load hint prefetch table at {}",
                self.meta.prefetch_table_offset
            ));
        }

        let mut head_desc = RafsBioDesc {
            bi_size: 0,
            bi_flags: 0,
            bi_vec: Vec::new(),
        };

        // No need to prefetch blob data for each alias as they share the same range,
        // we do it once.
        let mut hardlinks: HashSet<u64> = HashSet::new();

        for inode_idx in prefetch_table.inode_indexes.iter() {
            // index 0 is invalid, it was added because prefetch table has to be aligned.
            if *inode_idx == 0 {
                break;
            }
            debug!("hint prefetch inode {}", inode_idx);
            self.build_prefetch_desc(*inode_idx as u64, &mut head_desc, &mut hardlinks)?;
        }

        if let Some(files) = files {
            for f_ino in files {
                self.build_prefetch_desc(f_ino, &mut head_desc, &mut hardlinks)?;
            }
        }

        Ok(head_desc)
    }
/// This is fs layer prefetch entry point where 2 kinds of prefetch can be started:
/// 1. Static method from prefetch table hint:
///     Base on prefetch table which is persisted to bootstrap when building image.
/// 2. Dynamic method from hint directory list specified when nydusd starts.
///     Specify as a directory list when rafs is being imported. No prefetch table has to be
///     involved.
/// Each inode passed into should correspond to directory. And it already does the file type
/// check inside.
This is fs layer prefetch entry point where 2 kinds of prefetch can be started:
1. Static method from prefetch table hint:
Base on prefetch table which is persisted to bootstrap when building image.
2. Dynamic method from hint directory list specified when nydusd starts.
Specify as a directory list when rafs is being imported. No prefetch table has to be
involved.
Each inode passed into should correspond to directory. And it already does the file type
check inside.
This is fs layer prefetch entry point where 2 kinds of prefetch can be started : 1 . Static method from prefetch table hint : Base on prefetch table which is persisted to bootstrap when building image . 2 . Dynamic method from hint directory list specified when nydusd starts . Specify as a directory list when rafs is being imported . No prefetch table has to be involved . Each inode passed into should correspond to directory . And it already does the file type check inside .
pub fn prefetch_hint_files(
        &self,
        r: &mut RafsIoReader,
        files: Option<Vec<Inode>>,
    ) -> Result<RafsBioDesc> {
        let hint_entries = self.meta.prefetch_table_entries as usize;
        if hint_entries == 0 && files.is_none() {
            return Err(enoent!("Prefetch table is empty!"));
        }
        let mut prefetch_table = PrefetchTable::new();
        if prefetch_table
            .load_from(r, self.meta.prefetch_table_offset, hint_entries)
            .is_err()
        {
            einval!(format!(
                "Failed in load hint prefetch table at {}",
                self.meta.prefetch_table_offset
            ));
        }
        let mut head_desc = RafsBioDesc {
            bi_size: 0,
            bi_flags: 0,
            bi_vec: Vec::new(),
        };
        // No need to prefetch blob data for each alias as they share the same range,
        // we do it once.
        let mut hardlinks: HashSet<u64> = HashSet::new();
        for inode_idx in prefetch_table.inode_indexes.iter() {
            // index 0 is invalid, it was added because prefetch table has to be aligned.
            if *inode_idx == 0 {
                break;
            }
            debug!("hint prefetch inode {}", inode_idx);
            self.build_prefetch_desc(*inode_idx as u64, &mut head_desc, &mut hardlinks)?;
        }
        if let Some(files) = files {
            for f_ino in files {
                self.build_prefetch_desc(f_ino, &mut head_desc, &mut hardlinks)?;
            }
        }
        Ok(head_desc)
    }
pub fn prefetch_hint_files ( & self , r : & mut RafsIoReader , files : Option < Vec < Inode > > , ) -> Result < RafsBioDesc > { let hint_entries = self . meta . prefetch_table_entries as usize ; if hint_entries == 0 && files . is_none ( ) { return Err ( enoent ! ( " " ) ) ; } let mut prefetch_table = PrefetchTable :: new ( ) ; if prefetch_table . load_from ( r , self . meta . prefetch_table_offset , hint_entries ) . is_err ( ) { einval ! ( format ( " " self meta prefetch_table_offset ) ) ; } let mut head_desc = RafsBioDesc { bi_size : 0 , bi_flags : 0 , bi_vec : Vec :: new ( ) , } ; // No need to prefetch blob data for each alias as they share the same range, // we do it once. let mut hardlinks : HashSet < u64 > = HashSet :: new ( ) ; for inode_idx in prefetch_table . inode_indexes . iter ( ) { // index 0 is invalid, it was added because prefetch table has to be aligned. if * inode_idx == 0 { break ; } debug ! ( " " inode_idx ) ; self . build_prefetch_desc ( * inode_idx as u64 , & mut head_desc , & mut hardlinks ) ? ; } if let Some ( files ) = files { for f_ino in files { self . build_prefetch_desc ( f_ino , & mut head_desc , & mut hardlinks ) ? ; } } Ok ( head_desc ) }
This is fs layer prefetch entry point where 2 kinds of prefetch can be started:
1.
This is fs layer prefetch entry point where 2 kinds of prefetch can be started : 1 .
&self
r
&mut RafsIoReader
files
Option<Vec<Inode>>
&self
r
&mut RafsIoReader
files
Option<Vec<Inode>>