From f8a001af4fcbf31f68344b0d40cf5fb0b05bcdc6 Mon Sep 17 00:00:00 2001 From: Ryusuke Konishi Date: Sat, 14 Aug 2010 21:44:51 +0900 Subject: [PATCH] --- yaml --- r: 213747 b: refs/heads/master c: fd52202930b7e8db48bee5a6fc6b1f438e822a23 h: refs/heads/master i: 213745: 42517824d34218119084c82fda4978a0ee592885 213743: c75e1e0b077a311d43ded721ea0d46737e2c13e0 v: v3 --- [refs] | 2 +- trunk/fs/nilfs2/the_nilfs.c | 28 +++++++++++----------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/[refs] b/[refs] index ca6f4ba2e2e3..d3e0637b88e8 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b7c0634204993d7c6678c852e4bd118426599111 +refs/heads/master: fd52202930b7e8db48bee5a6fc6b1f438e822a23 diff --git a/trunk/fs/nilfs2/the_nilfs.c b/trunk/fs/nilfs2/the_nilfs.c index f1d599273d9e..89c78562d0e9 100644 --- a/trunk/fs/nilfs2/the_nilfs.c +++ b/trunk/fs/nilfs2/the_nilfs.c @@ -954,26 +954,20 @@ struct nilfs_sb_info *nilfs_find_sbinfo(struct the_nilfs *nilfs, int nilfs_checkpoint_is_mounted(struct the_nilfs *nilfs, __u64 cno, int snapshot_mount) { - struct nilfs_sb_info *sbi; - int ret = 0; + struct nilfs_root *root; + int ret; - down_read(&nilfs->ns_super_sem); - if (cno == 0 || cno > nilfs->ns_cno) - goto out_unlock; + if (cno < 0 || cno > nilfs->ns_cno) + return false; - list_for_each_entry(sbi, &nilfs->ns_supers, s_list) { - if (sbi->s_snapshot_cno == cno && - (!snapshot_mount || nilfs_test_opt(sbi, SNAPSHOT))) { - /* exclude read-only mounts */ - ret++; - break; - } - } - /* for protecting recent checkpoints */ if (cno >= nilfs_last_cno(nilfs)) - ret++; + return true; /* protect recent checkpoints */ - out_unlock: - up_read(&nilfs->ns_super_sem); + ret = false; + root = nilfs_lookup_root(nilfs, cno); + if (root) { + ret = true; + nilfs_put_root(root); + } return ret; }