2

So If block size can be found in ext2 like

 block_size = 1024 << super_block.s_log_block_size;

so I like to know what is s_log_block_size field. it looks like value can be 0 and should always be 0 in ext2 formatted device as in ext2 block size is 1024 so and hardcoding it in code like 1024 block_size=1024<<super_block->s_log_block_size

so I like to know what is super_block.s_log_block_size can it always be case. In one image formatted with ext2 that I have on my system its super_block.s_log_block_size value is 0 and its normally zero. So I like to know what is the point of this le32 bit field?

user786
  • 3,902
  • 4
  • 40
  • 72
  • 1
    If the filesystem have a block-size of `1024` bytes, then `s_log_block_size` will be zero. But filesystems can have other block-sizes. For example if the block-size is `4096` then `s_log_block_size` will be `2`. – Some programmer dude Dec 14 '21 at 07:19
  • @Someprogrammerdude please do tell `For example if the block-size is 4096 ` is block size is 40i96 then its not ext2 file system in ext2 file system s_log_block_size should be zero if doing `block_size=(1024< – user786 Dec 14 '21 at 07:30
  • Ext2 can have almost any block-size. There's no rule that says you must use `1024`. The main limitation is that the Linux kernel doesn't allow a block-size larger than the VM page size (4096 on x86 systems). You really need to find some more documentation to read. – Some programmer dude Dec 14 '21 at 07:35

0 Answers0