Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
os/bluestore/BlueFS: optimize get_allocated #14121
Only update extents it interator all extents to get allocated,
Signed-off-by: Jianpeng Ma firstname.lastname@example.org
Because every change extents, we also need set recalc_alloc=true. This make code complex. But for every flush_range, we will call get_allocated(). especially for recycling-log-file, it don't change until alloc new extent.
I'm inclined to do something a bit more explicit. Instead of a flag, just add a uint64_t allocated field, and update it whenever we changed extents. Either setting it diretcly (e.g., extents.clear(); allocated = 0;) or by calling a recalc_allocated() helper that address them up, or adding a newly added extent to allocated directly.
It would actually be best to make extents and allocated private and update them safely via an accessor, but check how awkward that will be with the current users?