[Ocfs2-devel] [PATCH] Refactor ocfs2_insert_extent for not-merging.
Mark Fasheh
mfasheh at suse.com
Wed Aug 13 13:32:40 PDT 2008
On Thu, Aug 14, 2008 at 01:33:12AM +0800, Tao Ma wrote:
> From: taoma <taoma at tma-home.cn.oracle.com>
>
> Hi Mark,
> Here is the patch we discussed this morning.
>
> In xattr bucket, we want to limit the maximum size of a btree leaf,
> otherwise we'll lose the benefits of hashing because we'll have to search
> large leaves.
>
> So add a new flag in ocfs2_extent_tree which will prevent ocfs2_insert_extent
> from merging the leaf record even if they are contiguous.
Ok, this is close... The problem I see here though is that we've gone from
always merging when possible to *never* merging.
What we want is "don't merge if the resulting extent is larger than a given
size".
So, instead of a flags field, how about "unsigned int max_extent_clusters".
If it's zero, we don't limit the extent. Otherwise, we honor the value it is
set to. A (cleaner) alternative would be to set it to the max value a u16 can have by
default so we never have to do an explicit "is this zero" check.
Inside of ocfs2_figure_contig_type():
... ocfs2_figure_contig_type(...) {
...
unsigned int len = le16_to_cpu(ext_rec->e_leaf_clusters) + le16_to_cpu(insert_rec->e_leaf_clusters);
/*
* Caller might want us to limit the size of extents, don't calculate
* contiguousness if we might exceed that limit.
*/
if (et->max_extent_clusters && len > et->max_extent_clusters) {
insert->ins_contig = CONTIG_NONE;
return;
}
...
}
Thanks,
--Mark
--
Mark Fasheh
More information about the Ocfs2-devel
mailing list