Skip to content

Commit bbe1bd0

Browse files
committed
befs: add check for ag_shift in superblock
ag_shift and blocks_per_ag contain the same information in different ways, same as block_shift and block_size do. It is worth checking this two are consistent, but since blocks_per_ag isn't documented as mandatory to use some implementations of befs don't enforce this, so making it non-fatal if they don't match and just having it as a warning. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Salah Triki <salah.triki@gmail.com>
1 parent d1a8c70 commit bbe1bd0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

fs/befs/super.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ befs_check_sb(struct super_block *sb)
103103
return BEFS_ERR;
104104
}
105105

106+
107+
/* ag_shift also encodes the same information as blocks_per_ag in a
108+
* different way, non-fatal consistency check
109+
*/
110+
if ((1 << befs_sb->ag_shift) != befs_sb->blocks_per_ag)
111+
befs_error(sb, "ag_shift disagrees with blocks_per_ag.");
112+
106113
if (befs_sb->log_start != befs_sb->log_end || befs_sb->flags == BEFS_DIRTY) {
107114
befs_error(sb, "Filesystem not clean! There are blocks in the "
108115
"journal. You must boot into BeOS and mount this volume "

0 commit comments

Comments
 (0)