diff options
author | Salah Triki <salah.triki@gmail.com> | 2016-08-09 09:46:04 -0400 |
---|---|---|
committer | Luis de Bethencourt <luisbg@osg.samsung.com> | 2016-10-08 05:01:27 -0400 |
commit | 6ea4558f9b373b588162e5d3523bc65fcf669b06 (patch) | |
tree | 18fe35d58b8a866a664feda907db2e107bb1ef4c | |
parent | bb75e66627b28816f472183d5dce0784d5edb87f (diff) |
befs: add flags field to validate superblock state
For validating superblock state, add flags field to befs_sb_info, read the state from the disk
and check if it is equal to BEFS_DIRTY.
Signed-off-by: Salah Triki <salah.triki@gmail.com>
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
-rw-r--r-- | fs/befs/befs.h | 3 | ||||
-rw-r--r-- | fs/befs/super.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/fs/befs/befs.h b/fs/befs/befs.h index a8ca7fcf0795..af8ea961e88f 100644 --- a/fs/befs/befs.h +++ b/fs/befs/befs.h | |||
@@ -43,6 +43,9 @@ struct befs_sb_info { | |||
43 | u32 ag_shift; | 43 | u32 ag_shift; |
44 | u32 num_ags; | 44 | u32 num_ags; |
45 | 45 | ||
46 | /* State of the superblock */ | ||
47 | u32 flags; | ||
48 | |||
46 | /* jornal log entry */ | 49 | /* jornal log entry */ |
47 | befs_block_run log_blocks; | 50 | befs_block_run log_blocks; |
48 | befs_off_t log_start; | 51 | befs_off_t log_start; |
diff --git a/fs/befs/super.c b/fs/befs/super.c index 9d1b56cd6f19..dc13df8de3e8 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c | |||
@@ -45,6 +45,8 @@ befs_load_sb(struct super_block *sb, befs_super_block * disk_sb) | |||
45 | befs_sb->ag_shift = fs32_to_cpu(sb, disk_sb->ag_shift); | 45 | befs_sb->ag_shift = fs32_to_cpu(sb, disk_sb->ag_shift); |
46 | befs_sb->num_ags = fs32_to_cpu(sb, disk_sb->num_ags); | 46 | befs_sb->num_ags = fs32_to_cpu(sb, disk_sb->num_ags); |
47 | 47 | ||
48 | befs_sb->flags = fs32_to_cpu(sb, disk_sb->flags); | ||
49 | |||
48 | befs_sb->log_blocks = fsrun_to_cpu(sb, disk_sb->log_blocks); | 50 | befs_sb->log_blocks = fsrun_to_cpu(sb, disk_sb->log_blocks); |
49 | befs_sb->log_start = fs64_to_cpu(sb, disk_sb->log_start); | 51 | befs_sb->log_start = fs64_to_cpu(sb, disk_sb->log_start); |
50 | befs_sb->log_end = fs64_to_cpu(sb, disk_sb->log_end); | 52 | befs_sb->log_end = fs64_to_cpu(sb, disk_sb->log_end); |
@@ -101,7 +103,7 @@ befs_check_sb(struct super_block *sb) | |||
101 | return BEFS_ERR; | 103 | return BEFS_ERR; |
102 | } | 104 | } |
103 | 105 | ||
104 | if (befs_sb->log_start != befs_sb->log_end) { | 106 | if (befs_sb->log_start != befs_sb->log_end || befs_sb->flags == BEFS_DIRTY) { |
105 | befs_error(sb, "Filesystem not clean! There are blocks in the " | 107 | befs_error(sb, "Filesystem not clean! There are blocks in the " |
106 | "journal. You must boot into BeOS and mount this volume " | 108 | "journal. You must boot into BeOS and mount this volume " |
107 | "to make it clean."); | 109 | "to make it clean."); |