os/bluestore: allow main device expansion when DB needs space to
recover.
This patch provides a fix for an expansion "deadlock" state:
OSD is out of space at main disk and DB needs to recover and
flush some additional data to the disk. To expand the main device one needs
to alter freelist parameters in DB which in turn triggers DB recovery.
The following approach is used to fix that:
1) Major set of Freelist Manager's key parameters
(primarily actual size and block count) is kept at device label from now on.
2)Secondary replica of parameters set is preserved at DB mostly to permit
downgrades if any.
3) At first expansion procedure updates bdev label only. No updates to DB takes
place hence read-only mode for DB is enough to execute it.
4) On regular BlueStore mount (second stage of expantion does this as
well) DB is initially loaded in read-only.
5)Freelist manager is started and initiated with parameters from device label.
Original allocation bits are taken from DB, new ones (appeared after
expansion but not present in DB) are virtually treated by FM as free.
Allocator is initialed with expanded size accordingly.
6) DB is reopened in full access mode. During this process BlueFS is able
to request for additional space from main device. This still doesn't need
DB update as BlueFS tracks owned extents via internal logging, not
persisting this info at DB
Hence DB recovery if any completes successfully. DB is fully operational
at this point.
7) Freelist Manager sync function is called to
commit all the changes: expanded size, location bits adjustment for
old and new boundaries.
Regular allocations that needs DB update are operational at this point.
Store is ready.