enum { STATE_EMPTY, STATE_CLEAN, STATE_DIRTY } cache_state;
};
-static DEFINE_MUTEX(mtdblks_lock);
-
/*
* Cache stuff...
*
pr_debug("mtdblock_open\n");
- mutex_lock(&mtdblks_lock);
if (mtdblk->count) {
mtdblk->count++;
- mutex_unlock(&mtdblks_lock);
return 0;
}
mtdblk->cache_data = NULL;
}
- mutex_unlock(&mtdblks_lock);
-
pr_debug("ok\n");
return 0;
pr_debug("mtdblock_release\n");
- mutex_lock(&mtdblks_lock);
-
mutex_lock(&mtdblk->cache_mutex);
write_cached_data(mtdblk);
mutex_unlock(&mtdblk->cache_mutex);
vfree(mtdblk->cache_data);
}
- mutex_unlock(&mtdblks_lock);
-
pr_debug("ok\n");
}