[Ocfs2-tools-devel] [patch 11/11] Some minor modification in
other files.
tao.ma
tao.ma at oracle.com
Fri Aug 17 16:07:36 PDT 2007
Mark Fasheh wrote:
> On Thu, Aug 16, 2007 at 01:56:29AM +0800, tao.ma wrote:
>
>> ===================================================================
>> --- test.ocfs2-tools.orig/fswreck/extent.c 2007-08-16 00:27:44.000000000 -0400
>> +++ test.ocfs2-tools/fswreck/extent.c 2007-08-16 00:36:28.000000000 -0400
>> @@ -84,7 +84,7 @@ static void custom_extend_allocation(ocf
>> {
>> errcode_t ret;
>> uint32_t n_clusters;
>> - uint32_t i;
>> + uint32_t i, offset = 0;
>> uint64_t blkno;
>> uint64_t tmpblk;
>>
>> @@ -103,7 +103,8 @@ static void custom_extend_allocation(ocf
>> * we insert each cluster in reverse. */
>> for(i = n_clusters; i; --i) {
>> tmpblk = blkno + ocfs2_clusters_to_blocks(fs, i - 1);
>> - ret = ocfs2_insert_extent(fs, ino, tmpblk, 1);
>> + ret = ocfs2_insert_extent(fs, ino, offset++,
>> + tmpblk, 1);
>>
>
> Hmm... I'm not 100% sure what this function is supposed to do, but it
> _looks_ like it's trying to grow allocation based on the rightmost allocated
> cluster. Shouldn't 'offset' above start at the rightmost rec cpos + clusters
> then? Starting at '0' means you'll just try to allocate over existing
> records...
> --Mark
>
This function is used to speed up the grow of extent record and extent
block.
You know if I allocate 10 clusters from the bitmap, and even if I call
insert_extent 10 times once a cluster, there will be only 1 extent
record since the clusters are contiguous and they will be merged into
one extent record. But considering I insert the last cluster first, say
10,9,8...1, then these clusters will not be merged into one extent
record, so the inode will have 10 extent records.
I use these function in fswreck to quickly build up a inode with many
extent blocks with less disk space. ;)
> --
> Mark Fasheh
> Senior Software Developer, Oracle
> mark.fasheh at oracle.com
>
More information about the Ocfs2-tools-devel
mailing list