aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/super.c')
-rw-r--r--fs/nilfs2/super.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 39e7d7f8eda0..ab96d26bf7e9 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -833,6 +833,38 @@ static int nilfs_try_to_shrink_tree(struct dentry *root_dentry)
833 return nilfs_tree_was_touched(root_dentry); 833 return nilfs_tree_was_touched(root_dentry);
834} 834}
835 835
836int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno)
837{
838 struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs;
839 struct nilfs_root *root;
840 struct inode *inode;
841 struct dentry *dentry;
842 int ret;
843
844 if (cno < 0 || cno > nilfs->ns_cno)
845 return false;
846
847 if (cno >= nilfs_last_cno(nilfs))
848 return true; /* protect recent checkpoints */
849
850 ret = false;
851 root = nilfs_lookup_root(NILFS_SB(sb)->s_nilfs, cno);
852 if (root) {
853 inode = nilfs_ilookup(sb, root, NILFS_ROOT_INO);
854 if (inode) {
855 dentry = d_find_alias(inode);
856 if (dentry) {
857 if (nilfs_tree_was_touched(dentry))
858 ret = nilfs_try_to_shrink_tree(dentry);
859 dput(dentry);
860 }
861 iput(inode);
862 }
863 nilfs_put_root(root);
864 }
865 return ret;
866}
867
836/** 868/**
837 * nilfs_fill_super() - initialize a super block instance 869 * nilfs_fill_super() - initialize a super block instance
838 * @sb: super_block 870 * @sb: super_block