Skip to contentSkip to conversation

erofs-utils: dump: print filesystem blocksize

PATCH Superseded Sandeep Dhavale via Linux-erofs 1 participant 2 messages Apr 15, 2024 – Apr 16, 2024

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 erofs-utils: dump: print filesystem blocksize

mkfs.erofs supports creating filesystem images with different blocksizes. Add filesystem blocksize in super block dump so its easier to inspect the filesystem.

The field is added after FS magic, so the output now looks like:

Filesystem magic number:                      0xE0F5E1E2
Filesystem blocksize:                         65536
Filesystem blocks:                            21
Filesystem inode metadata start block:        0
Filesystem shared xattr metadata start block: 0
Filesystem root nid:                          36
Filesystem lz4_max_distance:                  65535
Filesystem sb_extslots:                       0
Filesystem inode count:                       10
Filesystem created:                           Fri Apr 12 15:43:40 2024
Filesystem features:                          sb_csum mtime 0padding
Filesystem UUID:                              a84a2acc-08d8-4b72-8b8c-b811a815fa07

---
Changes since v2:
- Moved the field after FS magic as suggested by Gao

 dump/main.c | 2 ++
 1 file changed, 2 insertions(+)
dump/main.c +2 -0
index a89fc6b..928909d 100644
@@ -633,6 +633,8 @@ static void erofsdump_show_superblock(void)
 
 	fprintf(stdout, "Filesystem magic number:                      0x%04X\n",
 			EROFS_SUPER_MAGIC_V1);
+	fprintf(stdout, "Filesystem blocksize:                         %llu\n",
+			erofs_blksiz(&sbi) | 0ULL);
 	fprintf(stdout, "Filesystem blocks:                            %llu\n",
 			sbi.total_blocks | 0ULL);
 	fprintf(stdout, "Filesystem inode metadata start block:        %u\n",
Signature · 1 line
2.44.0.683.g7961c838ac-goog
#1 lore raw

Hi Sandeep,

Quoted 31 lines · Sandeep Dhavale

mkfs.erofs supports creating filesystem images with different blocksizes. Add filesystem blocksize in super block dump so its easier to inspect the filesystem.

The field is added after FS magic, so the output now looks like:

Filesystem magic number:                      0xE0F5E1E2
Filesystem blocksize:                         65536
Filesystem blocks:                            21
Filesystem inode metadata start block:        0
Filesystem shared xattr metadata start block: 0
Filesystem root nid:                          36
Filesystem lz4_max_distance:                  65535
Filesystem sb_extslots:                       0
Filesystem inode count:                       10
Filesystem created:                           Fri Apr 12 15:43:40 2024
Filesystem features:                          sb_csum mtime 0padding
Filesystem UUID:                              a84a2acc-08d8-4b72-8b8c-b811a815fa07

---
Changes since v2:
- Moved the field after FS magic as suggested by Gao

 dump/main.c | 2 ++
 1 file changed, 2 insertions(+)
dump/main.c +0 -0
index a89fc6b..928909d 100644

dump/main.c static void erofsdump_show_superblock(void) · line 637

Quoted 5 lines
dump/main.c +2 -0
@@ -633,6 +633,8 @@ static void erofsdump_show_superblock(void)
 
 	fprintf(stdout, "Filesystem magic number:                      0x%04X\n",
 			EROFS_SUPER_MAGIC_V1);
+	fprintf(stdout, "Filesystem blocksize:                         %llu\n",
+			erofs_blksiz(&sbi) | 0ULL);

Could we use %u for erofs_blksiz(&sbi)? since currently EROFS block size isn't possible to be larger than PAGE_SIZE.

Even if block size > page size is supported, I think we should not consider too large blocksizes.

Otherwise it looks good to me.

Thanks,
Gao Xiang