Comment # 11 on bug 1172566 from
items values for calc min_metadata_size:

extent_size: 0x2000 (4MB @ 512B sector size, can be get by vgdisplay)
poolmetadatasize: 0x0 (if without --poolmetadatasize parameter)

min_meta_size should be calac by _cache_min_metadata_size(), formular:

chunk_overhead = DM_BYTES_PER_BLOCK + DM_MAX_HINT_WIDTH +
DM_HINT_OVERHEAD_PER_BLOCK 
               => 16 + (4 + 16) + 8 => 44 => 0x2c (fixed value)

transaction_overhead = 4MB (0x400000, fixed value)

nr_chunks = pool_lv->size / chunk_size  (variable value)
          => 128GB/128k => 0x100000 
         (or 96G/128k => 0xc0000, 96G/256K=>0x60000 , 128G/256K => 0x8000)
so, we can get from above:
the pool_lv size is bigger, the nr_chunks is bigger.
the chunk_size is bigger, the nr_chunks is smaller.


min_meta_size = (transaction_overhead + nr_chunks * chunk_overhead + 
            (SECTOR_SIZE - 1)) >> SECTOR_SHIFT;
    ||
    \/
min_meta_size = (0x400000 + 0xc0000 * 0x2c + (0x200 - 1)) >> 9 => 0x12800 
              => 0x12800 * 0x200 (sector size) => 37 MB

if the chunk size change to 256K, but others values no change. the
min_meta_size will become:
(0x400000 + 0x60000 * 0x2c + (0x200 - 1)) >> 9 => 0x4400 => 20.5MB

when lv_pool change from 96G to 128G, chunk size from 128K to 256K, but others
no change. the min_meta_size become: 
(0x400000 + 0x80000 * 0x2c + (0x200 - 1)) >> 9 => 0xd000 => 26MB

if lv_pool is 128G, chunk size is 512K, others no change, the min_meta_size
become:
(0x400000 + 0x40000 * 0x2c + (0x200 - 1)) >> 9 => 0x7800 => 15MB

----------

for easy calculate, with following formular:
min_metadata_size = {(0x400000 + (pool_lv->size / chunk_size)  * 0x2c +
(sector_size - 1)) >> (sector_size shift bit) } + extent_size

sector_size shift bits:
- 512 Bytes: 9
- 1024: 10
- 2048: 11
- 4096: 12

pool_lv->size:
- the cache lv size. in this bug, it is test/giant-cache size, (96GB or 128GB).

chunk_size:
- default 4MB
- can be set by parameter: "--chunksize XX"
- in this bug, it is 256 or 512. (please note, 128k -> 256 sectors, (512B
sector size))



--------------
at last,
use the calculated min_metadata_size to execute lvconvert:
lvconvert --type cache --cachevol giant-cache --cachemode writeback --chunksize
256 test/giant --poolmetadatasize 30m


You are receiving this mail because: