fn write(&mut self, seq: u32, off: usize, buf: &[u8]) -> Result<usize> {
        // resets reference count
        self.open_page = Page::default();
        if let Some(page) = self.dirty.get_mut(&seq) {
            debug!("{:?}: hit #{} (write)", self.name, seq);
            page.update(off, buf);
        } else if let Some(mut page) = self.ro_cache.pop(&seq) {
            info!("{:?}: dirty #{}", self.name, seq);
            self.writeback()?;
            page.update(off, buf);
            self.dirty.put(seq, page);
        } else {
            self.alloc(seq, off, buf)?;
        }
        Ok(buf.len())
    }
/// Updates data in the dirty cache.
Updates data in the dirty cache.
Updates data in the dirty cache .
fn write(&mut self, seq: u32, off: usize, buf: &[u8]) -> Result<usize> {
        // resets reference count
        self.open_page = Page::default();
        if let Some(page) = self.dirty.get_mut(&seq) {
            debug!("{:?}: hit #{} (write)", self.name, seq);
            page.update(off, buf);
        } else if let Some(mut page) = self.ro_cache.pop(&seq) {
            info!("{:?}: dirty #{}", self.name, seq);
            self.writeback()?;
            page.update(off, buf);
            self.dirty.put(seq, page);
        } else {
            self.alloc(seq, off, buf)?;
        }
        Ok(buf.len())
    }
fn write ( & mut self , seq : u32 , off : usize , buf : & [ u8 ] ) -> Result < usize > { // resets reference count self . open_page = Page :: default ( ) ; if let Some ( page ) = self . dirty . get_mut ( & seq ) { debug ! ( " " self name seq ) ; page . update ( off , buf ) ; } else if let Some ( mut page ) = self . ro_cache . pop ( & seq ) { info ! ( " " self name seq ) ; self . writeback ( ) ? ; page . update ( off , buf ) ; self . dirty . put ( seq , page ) ; } else { self . alloc ( seq , off , buf ) ? ; } Ok ( buf . len ( ) ) }
Updates data in the dirty cache.
Updates data in the dirty cache .
&mut self
seq
u32
off
usize
buf
&[u8]
&mut self
seq
u32
off
usize
buf
&[u8]