Whamcloud - gitweb
LU-1512 oi: reuse idle OI blocks
With the system running, some OI blocks may become empty because
related files have been removed. Originally, these empty blocks
almost cannot be reused beause it always allocates new block for
new leaf or index node. Such space waste is an important reason
for the OI file size increasing quickly.
Now, when the non-released OI leaf node becomes empty, it will be
recycled into a per-OI based idle blocks pool, which is organized
as a series of tables. For each table, the on-disk format is:
+---------+---------+---------+---------+------+---------+-------+
| magic | count | next | logic | | logic | free |
|(16 bits)|(16 bits)| table | blk # | .... | blk # | space |
| | |(32 bits)|(32 bits)| |(32 bits)| |
+---------+---------+---------+---------+------+---------+-------+
The logic blk# for the first table is stored as "idle_blocks" in
the OI root node. In fact, there is padding field in the OI root
node after the "dx_countlimit". We will append the "idle_blocks"
just after the "dx_countlimit" to reuse part of the padding. So
it will not cause compatibility issues with old OI files.
Adjust the strategy for OI file block allocation: reuse empty block
in its idle blocks pool with priority; if such pool is empty, then
allocate new block from system volume.
Signed-off-by: Fan Yong <yong.fan@whamcloud.com>
Change-Id: I1bccc1cd9a4e1a16e4f51ac18e6b995ec85a0cf8
Reviewed-on: http://review.whamcloud.com/3153
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: wangdi <di.wang@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Liang Zhen <liang@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>