All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Hou Pengyang <houpengyang@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [RFC] add ovp valid_blocks check for bg gc victim to fg_gc
Date: Fri, 17 Feb 2017 12:17:32 -0800	[thread overview]
Message-ID: <20170217201732.GE2951@jaegeuk.local> (raw)
In-Reply-To: <58A685A7.3000601@huawei.com>

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%

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

  reply	other threads:[~2017-02-17 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 12:34 [RFC] add ovp valid_blocks check for bg gc victim to fg_gc Hou Pengyang
2017-02-16 23:48 ` Jaegeuk Kim
2017-02-17  2:33   ` Hou Pengyang
2017-02-17  2:54     ` Jaegeuk Kim
2017-02-17  5:09       ` Hou Pengyang
2017-02-17 20:17         ` Jaegeuk Kim [this message]
2017-02-23 12:35           ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170217201732.GE2951@jaegeuk.local \
    --to=jaegeuk@kernel.org \
    --cc=houpengyang@huawei.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.