pub fn new_file_counter<F>(&self, ino: Inode, path_getter: F)
    where
        F: Fn(u64) -> PathBuf,
    {
        if self.files_enabled() {
            let mut counters = self.file_counters.write().unwrap();
            if counters.get(&ino).is_none() {
                counters.insert(ino, Arc::new(InodeIoStats::default()));
            }
        }

        if self.access_pattern_enabled() {
            let mut records = self.access_patterns.write().unwrap();
            if records.get(&ino).is_none() {
                records.insert(
                    ino,
                    Arc::new(AccessPattern {
                        file_path: path_getter(ino),
                        ..Default::default()
                    }),
                );
            }
        }
    }
/// For now, each inode has its iostats counter regardless whether it is
/// enabled per rafs.
For now, each inode has its iostats counter regardless whether it is
enabled per rafs.
For now each inode has its iostats counter regardless whether it is enabled per rafs .
pub fn new_file_counter<F>(&self, ino: Inode, path_getter: F)
    where
        F: Fn(u64) -> PathBuf,
    {
        if self.files_enabled() {
            let mut counters = self.file_counters.write().unwrap();
            if counters.get(&ino).is_none() {
                counters.insert(ino, Arc::new(InodeIoStats::default()));
            }
        }
        if self.access_pattern_enabled() {
            let mut records = self.access_patterns.write().unwrap();
            if records.get(&ino).is_none() {
                records.insert(
                    ino,
                    Arc::new(AccessPattern {
                        file_path: path_getter(ino),
                        ..Default::default()
                    }),
                );
            }
        }
    }
pub fn new_file_counter < F > ( & self , ino : Inode , path_getter : F ) where F : Fn ( u64 ) -> PathBuf , { if self . files_enabled ( ) { let mut counters = self . file_counters . write ( ) . unwrap ( ) ; if counters . get ( & ino ) . is_none ( ) { counters . insert ( ino , Arc :: new ( InodeIoStats :: default ( ) ) ) ; } } if self . access_pattern_enabled ( ) { let mut records = self . access_patterns . write ( ) . unwrap ( ) ; if records . get ( & ino ) . is_none ( ) { records . insert ( ino , Arc :: new ( AccessPattern { file_path : path_getter ( ino ) , .. Default :: default ( ) } ) , ) ; } } }
For now, each inode has its iostats counter regardless whether it is
enabled per rafs.
For now each inode has its iostats counter regardless whether it is enabled per rafs .
&self
ino
Inode
path_getter
F
&self
ino
Inode
path_getter
F