Re: Required help for understanding ext4 block allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/22/12, Jan Kara <jack@xxxxxxx> wrote:
>   Hello,
>
> On Thu 22-03-12 18:54:26, Akshay Nehe wrote:
>> Yes, i got extents as you have suggested, but one thing i found that
>> each time modification occurs on any file from ext4 file system then
>> kernel deallocates all current blocks and allocate new blocks and
>> write modified data on newly allocated blocks.
>   That is not true. Why do you think it is? Maybe you are modifying the
> file with something like a text editor? That certainly truncates the old
> file and writes a new one. But generally ext4 supports overwriting.
>
Yes, i m using vim editor to modify files. Actually due to this inode
number of file is changing each time after modification.
>> So by tracing kernel code i got some useful functions, for
>> deallocation: ext4_free_blocks, for allocation: ext4_map_blocks, but
>> found difficult to analyse each of them. Can anyone suggest correct
>> functions which actually dose allocation and deallocation?
>   Ext4 uses multiblock allocator which is in fs/ext4/mballoc.c. In
> particular function allocating blocks in ext4_mb_new_blocks(), function
> freeing blocks is ext4_free_blocks(). But you will need to understand most
> of mballoc.c to understand how mballoc works. You can read comments in the
> beginning of the file to understand some basics about mballoc. You can
> also read some basics from by presentation about ext4 at Linux Kongress in
> 2009 (http://www.linux-kongress.org/2009/slides/ext4+btrfs_jan_kara.pdf).
>
> 								Honza
> --
> Jan Kara <jack@xxxxxxx>
> SUSE Labs, CR
>
Thanks for help, I will go through both mballoc file and your presentation file.

-- 
Regards,
Akshay Nehe.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux