]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
libext2fs: add a bitmap implementation using rbtree's
authorLukas Czerner <lczerner@redhat.com>
Sun, 18 Dec 2011 05:29:33 +0000 (00:29 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 18 Dec 2011 06:12:40 +0000 (01:12 -0500)
commitc1359d91958cadfbc0987921ee5b4db717852e90
tree68c838d25ae198abe0a80108a1fffbce56bb1520
parent5db745a2836fd480d6be1b7cf388b0aad6b786ad
libext2fs: add a bitmap implementation using rbtree's

For a long time we had a bitarray backend for storing filesystem
metadata bitmaps, however today this approach might hit its limits with
todays huge data storage devices, because of its memory utilization.

Bitarrays stores bitmaps as ..well, as bitmaps. But this is in most
cases highly unefficient because we need to allocate memory even for the
big parts of bitmaps we will never use, resulting in high memory
utilization especially for huge filesystem, when bitmaps might occupy
gigabytes of space.

This commit adds another backend to store bitmaps. It is based on
rbtrees and it stores just used extents of bitmaps. It means that it can
be more memory efficient in most cases.

I have done some limited benchmarking and it shows that rbtree backend
consumes approx 65% less memory that bitarray on 312GB filesystem aged
with Impression (default config). This number may grow significantly
with the filesystem size, but also it may be a lot lower (even negative)
if the inodes are very fragmented (need more benchmarking).

This commit itself does not enable the use of rbtree backend.

[ Simplified the code by avoiding unneeded memory allocation and
  deallocation of del_ext.  In addition, fixed a bug discovered by the
  tst_bitmaps tests: rb_unamrk_bmap() must return true if the bit was
  previously set in bitmap, and zero otherwise -- tytso ]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/Makefile.in
lib/ext2fs/blkmap64_rb.c [new file with mode: 0644]
lib/ext2fs/bmap64.h
lib/ext2fs/ext2fs.h
lib/ext2fs/gen_bitmap64.c