architcture/design of btree

balaji18

Member


Messages: 32

Hello,

I am trying to understand the architecture/design of btree thats available in FreeBSD. 'man btree' gives the man page that explains how to use it. I am already going thru the code. But if there is any documentation,that would be of great help. Pls help me in understanding the architecture/design.

Thanks,
Balaji.
 
OP
OP
B

balaji18

Member


Messages: 32

Hi,

From my initial analysis,

db.h - the parent header file defining the routines.
bt_open.c - here the file is opened and the routines in db.h are assigned with btree specific routines.
mpool.h/.c - seems to be the disk handler, like allocating space, reading and writing data to the file.
bt_conv.c - routines to convert data from one endianess to the other
bt_close.c - flushes the data to the file and the file is closed. Probably the last routine to be called.

Two features that i noticed was
1)a header record, namely meta data is written to the file. This is the first data in the file. A version is stored in this and its checked whenever the same file is used. Page size is also stored in meta data and it overrides anything thats passed.
2)Disk space is managed in terms of page size. Looks like page size plays an important role in the implementation.

My next stage
1)Become familiar with PAGE
2)Handling of duplicates.

Thanks,
Balaji.
 
Top