On 4/2/20 5:56 AM, Wang Yugui wrote:
Hi, Goffredo Baroncelli
'btrfs balance' after 'mkfs.btrfs' seem OK to make sure
not any HDD will be used as metadata.
Yes this is the expected behavior.
test env:
kernel:5.4.29 + patch(btrfs: add ssd_metadata mode)
/dev/sdb hdd
/dev/sdc ssd
test script:
mkfs.btrfs -m single -d single /dev/sdc1 /dev/sdb1 -f
mkdir -p /test &&
mount /dev/sdb1 /test || exit $?
btrfs fi usage /test
btrfs balance start --full-balance /test
btrfs fi usage /test
output of the script
[...]
+ btrfs balance start --full-balance /test
Done, had to relocate 3 out of 3 chunks
+ btrfs fi usage /test
Overall:
Device size: 605.50GiB
Device allocated: 2.03GiB
Device unallocated: 603.46GiB
Device missing: 0.00B
Used: 640.00KiB
Free (estimated): 604.46GiB (min: 604.46GiB)
Data ratio: 1.00
Metadata ratio: 1.00
Global reserve: 3.25MiB (used: 0.00B)
Data,single: Size:1.00GiB, Used:512.00KiB
/dev/sdb1 1.00GiB
Metadata,single: Size:1.00GiB, Used:112.00KiB
/dev/sdc1 1.00GiB
System,single: Size:32.00MiB, Used:16.00KiB
/dev/sdc1 32.00MiB
Unallocated:
/dev/sdb1 418.19GiB
/dev/sdc1 185.28GiB
If the /dev/sdc1 is an SSD, yes my code works as expected :-)
Best Regards
王玉贵
2020/04/02
Hi, Goffredo Baroncelli
Thanks for the nice ideal of 'btrfs: add ssd_metadata mode'.
a comment:
Should we add ssd_metadata mode to mkfs.btrfs too?
If so, we can let the first chunk works as expected too?
Having the first chunk correctly allocated, doesn't really matter. As you can saw a simple "btrfs bal"
rearrange the chunks. Updating mkfs.btrfs is not so urgency [*].
This patch is an experiment to have some feedback. There are a lot of open points:
- it is really useful ? I expect that in few years all disks will be SSD
- there are a lot of open point about what would returns (e.g.) "btrfs fi us": still is it correct to return as free space the sum of the free space of each disks ?
- increasing the speed of reading/writing metadata, how impact to the overall speed of the filesystem ? I expect no too much. If I find some spare time, I would measure the upgrading time of a debian from stable to unstable in the following scenarios:
- ssd
- ssd+hdd
- hdd
Best Regards
王玉贵
2020/04/02
BR
G.Baroncelli
--------------------------------------
北京京垓科技有限公司
王玉贵 wangyugui@xxxxxxxxxxxx
电话:+86-136-71123776
--------------------------------------
北京京垓科技有限公司
王玉贵 wangyugui@xxxxxxxxxxxx
电话:+86-136-71123776
[*] Anyway, I am inclined to think that the mkfs.btrfs should put the drive in a "initial state" only. The building of the files-system should be done only in the kernel the first time that it see a disk in a "initial state". This would avoid to have a lot of user space code which deals with the internal structure of a filesystem. There are a lot of repetition between the btrfs user space code and the btrfs kernel space code.
--
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5