westerndigitalcorporation / zenfs

ZenFS is a storage backend for RocksDB that enables support for ZNS SSDs and SMR HDDs.
GNU General Public License v2.0
235 stars 86 forks source link

The `lifetime_` of the zone will be lost after remount zenfs #266

Open ywang-wnlo opened 1 year ago

ywang-wnlo commented 1 year ago

https://github.com/westerndigitalcorporation/zenfs/blob/b04ca0cb49c03ecf193367e314e9accf21c937f6/fs/zbd_zenfs.cc#L51-L64

The zone is configured with a lifetime_ of Env::WLTH_NOT_SET during initialization, but if the zone already has data(such as remount), it should be configured as the maximum value of the lifetime_ of the files in it.

https://github.com/westerndigitalcorporation/zenfs/blob/b04ca0cb49c03ecf193367e314e9accf21c937f6/fs/zbd_zenfs.cc#L393-L413

Due to the fact that the lifetime_ of zones is related to the zone allocation algorithm, which will always return LIFETIME_DIFF_NOT_GOOD as the zone_lifetime is Env::WLTH_NOT_SET

ywang-wnlo commented 1 year ago

I tried to fix the problem in this commit

I will submit a pull request if needed

yhr commented 9 months ago

@ywang-wnlo , this looks like a good fix, please submit a PR. Pardon the delay in my response :)