aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-19 05:58:46 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-19 20:05:52 -0500
commita057d2c01161444c48b12a60351ae6c7135f6e61 (patch)
tree066316a4e9a9d1d2979873c31e7855eb9c093c49
parentf50a4c8149cc135921a8a0476bff8e622f59aef9 (diff)
nilfs2: add helper to get if volume is in a valid state
This adds a helper function, nilfs_valid_fs() which returns if nilfs is in a valid state or not. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
-rw-r--r--fs/nilfs2/the_nilfs.c6
-rw-r--r--fs/nilfs2/the_nilfs.h10
2 files changed, 11 insertions, 5 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index aea2b58ba03b..890a8d3886cf 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -261,16 +261,12 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
261 struct nilfs_recovery_info ri; 261 struct nilfs_recovery_info ri;
262 unsigned int s_flags = sbi->s_super->s_flags; 262 unsigned int s_flags = sbi->s_super->s_flags;
263 int really_read_only = bdev_read_only(nilfs->ns_bdev); 263 int really_read_only = bdev_read_only(nilfs->ns_bdev);
264 unsigned valid_fs; 264 int valid_fs = nilfs_valid_fs(nilfs);
265 int err; 265 int err;
266 266
267 if (nilfs_loaded(nilfs)) 267 if (nilfs_loaded(nilfs))
268 return 0; 268 return 0;
269 269
270 down_write(&nilfs->ns_sem);
271 valid_fs = (nilfs->ns_mount_state & NILFS_VALID_FS);
272 up_write(&nilfs->ns_sem);
273
274 if (!valid_fs) { 270 if (!valid_fs) {
275 printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n"); 271 printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n");
276 if (s_flags & MS_RDONLY) { 272 if (s_flags & MS_RDONLY) {
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index 20abd55881e0..589786e33464 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -258,6 +258,16 @@ static inline void nilfs_put_sbinfo(struct nilfs_sb_info *sbi)
258 kfree(sbi); 258 kfree(sbi);
259} 259}
260 260
261static inline int nilfs_valid_fs(struct the_nilfs *nilfs)
262{
263 unsigned valid_fs;
264
265 down_read(&nilfs->ns_sem);
266 valid_fs = (nilfs->ns_mount_state & NILFS_VALID_FS);
267 up_read(&nilfs->ns_sem);
268 return valid_fs;
269}
270
261static inline void 271static inline void
262nilfs_get_segment_range(struct the_nilfs *nilfs, __u64 segnum, 272nilfs_get_segment_range(struct the_nilfs *nilfs, __u64 segnum,
263 sector_t *seg_start, sector_t *seg_end) 273 sector_t *seg_start, sector_t *seg_end)