On 2018年02月15日 10:15, Duncan wrote: > Qu Wenruo posted on Thu, 15 Feb 2018 09:42:27 +0800 as excerpted: > >> The easiest way to get a basic idea of how large your extent tree is >> using debug tree: >> >> # btrfs-debug-tree -r -t extent <device> >> >> You would get something like: >> btrfs-progs v4.15 extent tree key (EXTENT_TREE ROOT_ITEM 0) 30539776 >> level 0 <<< >> total bytes 10737418240 bytes used 393216 uuid >> 651fcf0c-0ffd-4351-9721-84b1615f02e0 >> >> That level is would give you some basic idea of the size of your extent >> tree. >> >> For level 0, it could contains about 400 items for average. >> For level 1, it could contains up to 197K items. >> ... >> For leven n, it could contains up to 400 * 493 ^ (n - 1) items. >> ( n <= 7 ) > > So for level 2 (which I see on a couple of mine here, ran it out of > curiosity): > > 400 * 493 ^ (2 - 1) = 400 * 493 = 197200 > > 197K for both level 1 and level 2? Doesn't look correct. > > Perhaps you meant a simple power of n, instead of (n-1)?
My fault, off by 1 is really easy to screw things up. So it's 400 * 493 ^ n. And level 0 also fits into the calculation. > That would > yield ~97M for level 2, and would yield the given numbers for levels 0 > and 1 as well, whereby using n-1 for level 0 yields less than a single > entry, and 400 for level 1. > > Or the given numbers were for level 1 and 2, with level 0 not holding > anything, not levels 0 and 1. But that wouldn't jive with your level 0 > example, which I would assume could never happen if it couldn't hold even > a single entry. Here level 0 means it's leaf. And I assume the average item size of each EXTENT_ITEM/METADATA item to be 40. And using 16K nodesize we have 16283, we get 407, I just round it to 400 to make calculation a little easier and more headroom for larger item. So for level 0, we could have around 400 items. For nodes (1 < level <= 7), since node ptr is fixed to 33 bytes, the calculation is pretty simple now. Thanks, Qu >
Description: OpenPGP digital signature