mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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>
This commit is contained in:
parent
f50a4c8149
commit
a057d2c011
2 changed files with 11 additions and 5 deletions
|
@ -261,16 +261,12 @@ int load_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
|
||||||
struct nilfs_recovery_info ri;
|
struct nilfs_recovery_info ri;
|
||||||
unsigned int s_flags = sbi->s_super->s_flags;
|
unsigned int s_flags = sbi->s_super->s_flags;
|
||||||
int really_read_only = bdev_read_only(nilfs->ns_bdev);
|
int really_read_only = bdev_read_only(nilfs->ns_bdev);
|
||||||
unsigned valid_fs;
|
int valid_fs = nilfs_valid_fs(nilfs);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (nilfs_loaded(nilfs))
|
if (nilfs_loaded(nilfs))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
down_write(&nilfs->ns_sem);
|
|
||||||
valid_fs = (nilfs->ns_mount_state & NILFS_VALID_FS);
|
|
||||||
up_write(&nilfs->ns_sem);
|
|
||||||
|
|
||||||
if (!valid_fs) {
|
if (!valid_fs) {
|
||||||
printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n");
|
printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n");
|
||||||
if (s_flags & MS_RDONLY) {
|
if (s_flags & MS_RDONLY) {
|
||||||
|
|
|
@ -258,6 +258,16 @@ static inline void nilfs_put_sbinfo(struct nilfs_sb_info *sbi)
|
||||||
kfree(sbi);
|
kfree(sbi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int nilfs_valid_fs(struct the_nilfs *nilfs)
|
||||||
|
{
|
||||||
|
unsigned valid_fs;
|
||||||
|
|
||||||
|
down_read(&nilfs->ns_sem);
|
||||||
|
valid_fs = (nilfs->ns_mount_state & NILFS_VALID_FS);
|
||||||
|
up_read(&nilfs->ns_sem);
|
||||||
|
return valid_fs;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
nilfs_get_segment_range(struct the_nilfs *nilfs, __u64 segnum,
|
nilfs_get_segment_range(struct the_nilfs *nilfs, __u64 segnum,
|
||||||
sector_t *seg_start, sector_t *seg_end)
|
sector_t *seg_start, sector_t *seg_end)
|
||||||
|
|
Loading…
Reference in a new issue