Proposed API change to tdb.

Jeremy Allison jra at samba.org
Tue Dec 21 12:25:28 MST 2010


Hi Rusty & friends,

I'd like to propose an API addition to tdb.

Currently, when we expand a tdb file on running out
of freelist, we have a heuristic that we follow that
states:

"always make room for at least 100 more records, and at
least 25% more space."

and then rounded up to a multiple of a page size.

I am working with an OEM that is running Samba on
a memory contrained box, and they are storing some
of the tdb's in an in-memory filesystem, to prevent
disk spin-up and consequent power drain.

The problem with the above heuristic is it creates
tdb files that are far too large for their box and
prevents them storing them on the ramfs.

So I added a call tdb_set_filesize_expansion_factor()

void tdb_set_filesize_expansion_factor(struct tdb_context *tdb,
		unsigned int record_number_expansion_factor,
		double min_filesize_expansion_factor)

That allows this heuristic to be controlled by an
application. The first number "record_number_expansion_factor"
is the "at least this number of records" factor, and
the second number "min_filesize_expansion_factor" is the
"at least this amount more space in the file".

By default they are set to :

record_number_expansion_factor = 100
min_filesize_expansion_factor = 1.25

But this call gives an application control over
these values. For this OEM it enabled them to
tune Samba to fit in the ramfs, and was the difference
between using our technology and having to look
for a different solution.

What do you all think ? Comments on the patch and
corrections welcome. I'd like to make this part of
3.6.0 if possible (and the version of tdb that ships
around that time) if everyone agrees.

Happy Holidays !

Jeremy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tdb.patch
Type: text/x-diff
Size: 4291 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20101221/ed8aad9e/attachment.patch>


More information about the samba-technical mailing list