aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/alloc.c')
-rw-r--r--fs/nilfs2/alloc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c
index 7e2b3ce57aa9..c56300d8d177 100644
--- a/fs/nilfs2/alloc.c
+++ b/fs/nilfs2/alloc.c
@@ -491,3 +491,30 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
491 } 491 }
492 return 0; 492 return 0;
493} 493}
494
495void nilfs_palloc_setup_cache(struct inode *inode,
496 struct nilfs_palloc_cache *cache)
497{
498 NILFS_MDT(inode)->mi_palloc_cache = cache;
499 spin_lock_init(&cache->lock);
500}
501
502void nilfs_palloc_clear_cache(struct inode *inode)
503{
504 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache;
505
506 spin_lock(&cache->lock);
507 brelse(cache->prev_desc.bh);
508 brelse(cache->prev_bitmap.bh);
509 brelse(cache->prev_entry.bh);
510 cache->prev_desc.bh = NULL;
511 cache->prev_bitmap.bh = NULL;
512 cache->prev_entry.bh = NULL;
513 spin_unlock(&cache->lock);
514}
515
516void nilfs_palloc_destroy_cache(struct inode *inode)
517{
518 nilfs_palloc_clear_cache(inode);
519 NILFS_MDT(inode)->mi_palloc_cache = NULL;
520}