src/kernel/fs/fat32.c
/*!
 * @note write back all of dirty entry in cache to block layer.
 * @warning don`t hold any entry`s lock.
 */
@note write back all of dirty entry in cache to block layer.
@warning don`t hold any entry`s lock.
@note write back all of dirty entry in cache to block layer . @warning don ` t hold any entry ` s lock .
void entry_flush_all(){
    fs_stub_rw_r_lock_acquire(&entry_cache.rw_lock);
    entry_t * probe_entry;
    for(dnode_t * probe = entry_cache.dlink.head;probe!=NULL;probe = probe->next){
        probe_entry = probe->data;
        if(probe_entry->dirty){
            if(probe_entry->parent!=NULL&&probe_entry->parent!=ROOT_PARENT){
                fs_stub_rw_w_lock_acquire(&probe_entry->parent->rw_lock);
                fs_stub_rw_w_lock_acquire(&probe_entry->rw_lock);
                probe_entry->parent->dirty = true;
                _entry_flush(probe_entry);
                fs_stub_rw_w_lock_release(&probe_entry->rw_lock);
                fs_stub_rw_w_lock_release(&probe_entry->parent->rw_lock);
            }
        }
    }
    fs_stub_rw_r_lock_release(&entry_cache.rw_lock);
}
void entry_flush_all ( ) { fs_stub_rw_r_lock_acquire ( & entry_cache . rw_lock ) ; entry_t * probe_entry ; for ( dnode_t * probe = entry_cache . dlink . head ; probe != NULL ; probe = probe -> next ) { probe_entry = probe -> data ; if ( probe_entry -> dirty ) { if ( probe_entry -> parent != NULL && probe_entry -> parent != ROOT_PARENT ) { fs_stub_rw_w_lock_acquire ( & probe_entry -> parent -> rw_lock ) ; fs_stub_rw_w_lock_acquire ( & probe_entry -> rw_lock ) ; probe_entry -> parent -> dirty = true ; _entry_flush ( probe_entry ) ; fs_stub_rw_w_lock_release ( & probe_entry -> rw_lock ) ; fs_stub_rw_w_lock_release ( & probe_entry -> parent -> rw_lock ) ; } } } fs_stub_rw_r_lock_release ( & entry_cache . rw_lock ) ; }
@note write back all of dirty entry in cache to block layer.
@note write back all of dirty entry in cache to block layer .