naota / linux

Linux kernel source tree
Other
3 stars 1 forks source link

Mount takes long time loading zone info #57

Closed naota closed 2 years ago

naota commented 3 years ago

Mounting a fully filled large (14TB) disk takes a long time to load zone info for block groups.

https://lore.kernel.org/linux-btrfs/20210831164744.GM3379@twin.jikos.cz/T/#m62e5aa31b1a86107216ef0b89c88da3cb346e88b

We could speed up the mount process by caching the device's REPORT ZONES response, as we're doing a REPORT ZONES once to get all zones and then again per block group load. On a 14TB SMR drive this results in (14 1024 1024) / 256 + 1 = 57345 REPORT ZONES calls. OTOH struct blk_zone is 64 bytes per zone resulting in 64 * 57344 = 3584kB data to be cached.

naota commented 2 years ago

Fixed in https://github.com/kdave/btrfs-devel/commit/e1e53a2f0021d1da3a77f9b714b28bf8625c9847

An improvement to reduce memory footprint will follow.