On 2017/2/18 4:17, Jaegeuk Kim wrote: > On 02/17, Hou Pengyang wrote: > > ... > >>>> On 2017/2/17 7:48, Jaegeuk Kim wrote: >>>>> + ovp_count = SM_I(sbi)->ovp_segments << sbi->log_blocks_per_seg; >>>> >>>> About the ovp_count calculation, >>>> >>>> in mkfs.f2fs, we get ovp_segment by >>>> >>>> set_cp(overprov_segment_count, (get_sb(segment_count_main) - >>>> get_cp(rsvd_segment_count)) * >>>> config.overprovision / 100); >>>> >>>> set_cp(overprov_segment_count, get_cp(overprov_segment_count) + >>>> get_cp(rsvd_segment_count)); >>>> >>>> where the overprov calculation is based on the space excluding the >>>> rsvd segment, and the final overprov_segment is sum of the REAL >>>> overprov segments and the rsvd ones. >>>> >>>> So, when to calculate the overprov ratio, the rsvd segments should >>>> be subtracted from the ckpt->overprov_semgents? >>> >>> I just got calculation from fresh mounted image. What I could confirm was >>> that >>> user can see (main_segments - ovp_segments). >> >> I add some log into mkfs.f2fs, and get the config.overprovision, >> rsvd/ovrp segments, user_block_count, and use the mkfs.f2fs to formatting a >> 512M disk, where: >> >> config.overprovision: 10 >> >> ovrp : 50 segments(25600 blocks) >> rsvd : 28 segments(14336 blocks) >> user_block_count: 101376 blocks >> >> Use ovrp/rsvd/user_block_count to get the ovrp ratio info reversely : >> >> 1) user_block_count/(user_block_count + ovrp blocks) >> >> 101376/(101376+25600) = 79% >> >> 2) user_block_count/(user_block_count + ovrp_blocks - rsvd_blocks) >> >> 101376/(101376+25600-14336) = 90% = 1-10% >> >> By 2), 1-90%, we can get the original config.overprovion when mkfs.f2fs >> So I think we should use 2) to calculate ovrp ratio. Anything I miss >> in 2)? > > Yup, indeed 2) is correct, which I found my calcuation was wrong, and tried > to verify with: > > threshold = (main_segments - ovp_segments) / (main_segments - > reserved_segments) > ------------------------------ > --------------------------------- > User-visible space F2FS-writable space > (user_block_count) / (user_block_count + ovp_blocks - > rsvd_blocks) > > For example, > > 1. 8GB > ovp reported by mkfs = 2.22% > main_segments = 4065 > ovp_segments = 186 > reserved_segments = 98 > threshold = 500 (mine) vs. 502 (yours) > > -> Actual ovp = (512-500) / 512 = 2.34% > -> reserved segments = 98 / 2 = 49 can cover 2.34% > > 2. 64GB > ovp reported by mkfs = 0.78% > main_segments = 32581 > ovp_segments = 516 > reserved_segments = 264 > threshold = 508 (mine) vs. 512 (yours) > > -> Actual ovp = (512-508) / 512 = 0.78% > -> reserved segments = 264 / 2 = 132 can cover 0.78%
The last updated patch wasn't been sent out, so I reply in this thread: Reviewed-by: Chao Yu <yuch...@huawei.com> > > Thanks, > > . > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel