public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] befs: Fix incorrect superblock consistency check
@ 2024-11-18 17:45 Daniel Martín Gómez
  2024-11-19 20:07 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Martín Gómez @ 2024-11-18 17:45 UTC (permalink / raw)
  To: dalmemail; +Cc: Luis de Bethencourt, Salah Triki, linux-kernel

The check assumes that blocks_per_ag records the number
of blocks in an allocation group, but section 4.5 of
Practical File System Design with the Be File System
states that "The blocks_per_ag field of the superblock
refers to the number of bitmap blocks that are in each
allocation group". This causes befs driver to write an
error to the log each time a volume is mounted. Change
the check to correctly compute the number of blocks on
each allocation group using blocks_per_ag.

Signed-off-by: Daniel Martín Gómez <dalmemail@gmail.com>
---
 fs/befs/super.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/befs/super.c b/fs/befs/super.c
index 7c50025c99d8..a900ef8402af 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -101,9 +101,12 @@ befs_check_sb(struct super_block *sb)
 
 
 	/* ag_shift also encodes the same information as blocks_per_ag in a
-	 * different way, non-fatal consistency check
+	 * different way, non-fatal consistency check.
+	 * Beware that blocks_per_ag holds the number of bitmap blocks in
+	 * each allocation group.
 	 */
-	if ((1 << befs_sb->ag_shift) != befs_sb->blocks_per_ag)
+	if ((1 << befs_sb->ag_shift) !=
+	    befs_sb->blocks_per_ag * befs_sb->block_size * 8)
 		befs_error(sb, "ag_shift disagrees with blocks_per_ag.");
 
 	if (befs_sb->log_start != befs_sb->log_end ||
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] befs: Fix incorrect superblock consistency check
  2024-11-18 17:45 [PATCH] befs: Fix incorrect superblock consistency check Daniel Martín Gómez
@ 2024-11-19 20:07 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2024-11-19 20:07 UTC (permalink / raw)
  To: Daniel Martín Gómez, Luis de Bethencourt, Salah Triki; +Cc: LKML

> The check assumes that blocks_per_ag records the number
> of blocks in an allocation group, but section 4.5 of
> Practical File System Design with the Be File System
> states that "The blocks_per_ag field of the superblock
…

You may occasionally put more than 55 characters into text lines
for an improved change description.

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-19 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-18 17:45 [PATCH] befs: Fix incorrect superblock consistency check Daniel Martín Gómez
2024-11-19 20:07 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox