I'm looking for some advice on block allocation.
For example, assuming blocksize is 1024, file is 0 bytes in length.
If do a 1k write starting at offset 0. I allocate a new block and stuff it in i_block[0], write the physical block to disk and update the inode. Job done.....
Then I write 1k starting at offset 4096 (4th block in inode obviously). Same procedure as above, but am I supposed to allocate the 2nd and 3rd blocks and zero fill??
It feels "wrong" not to, although it just seems wasteful.
Ext2 block allocation
Ext2 block allocation
All your base are belong to us.
-
- Member
- Posts: 391
- Joined: Wed Jul 25, 2007 8:45 am
- Libera.chat IRC: aejsmith
- Location: London, UK
- Contact:
Re: Ext2 block allocation
No, you don't need to fill them in. If a block is set to 0, things reading should see that and act as though the block was filled with zeros.