public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Kent Overstreet <kmo-PEzghdH756F8UrSeD/g0lQ@public.gmane.org>
To: sheng qiu <herbert1984106-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: reverse link from bucket to keys
Date: Thu, 11 Jul 2013 19:10:57 -0700	[thread overview]
Message-ID: <20130712021057.GA30223@kmo-pixel> (raw)
In-Reply-To: <CAB7xdinRH6ysM6O1x4jB00acqOvtRwPN00xjm2jkmvML37f3JQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, Jul 11, 2013 at 11:02:01AM -0400, sheng qiu wrote:
> Hi Kent,
> 
> i think i get a little clear about your codes. so initially each newly
> allocated buckets are SET_GC_SECTORS_USED(bucket.size), then during
> the btree gc, you update the bucket by accumulate the still valid key
> data. So if the bucket has more valid data left, it should be
> accumulated more for each round at the btree gc. I think this is fine.
> But at the movinggc code, when you calculate how many sectors to move
> for each bucket, you directly add the current GC_SECTORS_USED(bucket),
> which is actually the accumulated value (relative value), not the
> actual valid size of data within the bucket. Is this correct? I guess
> that's why i ended up with the threshold equal to newly allocated
> bucket size.

That "sectors_to_move" we're calculating isn't for any one bucket, it's
how many _total_ sectors we're going to move this iteration.

The reason is we've got a fixed size reserve of buckets that can be
allocated for moving gc - we may not be able to allocate more than that.

But when we start copying data out of buckets, we always want to copy
out of the buckets that had the least amount of live data in them. So we
take our heap of buckets with the smallest GC_SECTORS_USED(), and pop
buckets off the top until sectors_to_move is under our reserve - that
is, until we've got few enough buckets that we know we'll be able to
move all the data in them.

  parent reply	other threads:[~2013-07-12  2:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-07 14:47 reverse link from bucket to keys sheng qiu
     [not found] ` <CAB7xdi=zBrOfPH9PwCeu=wrguku5utMXJM1pQFiRa1GZU6xGEw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-07 16:24   ` Kent Overstreet
     [not found]     ` <CALJ65zk1kkUgOa4iqAFkA+64eU+6cEa=HRNQxZQ5SOwn4e5jAA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-08 13:44       ` sheng qiu
     [not found]         ` <CAB7xdikiVCeG=fJENSGY2K256CGOZrp=MYE8q6quSGX0h=ph9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-08 21:48           ` Kent Overstreet
2013-07-09 15:24             ` sheng qiu
     [not found]               ` <CAB7xdinkyiE1Wp+K3=WyA7J1==G3t_coXoDn3wf_6ZvyUV+Vkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-10 15:22                 ` sheng qiu
     [not found]                   ` <CAB7xdi=wn1O4+g8cynMpSrD114RVsXf4O6Jzz+cytcb=RZhHAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-10 21:14                     ` sheng qiu
     [not found]                       ` <CAB7xdinPKr6orbY4Oc-CH-e5aeGwghLsiTFmFC4Qs80PwniBcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-10 23:02                         ` Kent Overstreet
2013-07-11  2:16                           ` sheng qiu
     [not found]                             ` <CAB7xdik_nDtJbz-YBaKkQ6XDVQT65ZiSB9E7WWZHon8jXH57SQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-11 13:45                               ` sheng qiu
     [not found]                                 ` <CAB7xdikjXhAyM5dqVXuEUgL4RHM4L0uf0ksXZ_6uU3-ZgAKR4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-11 15:02                                   ` sheng qiu
     [not found]                                     ` <CAB7xdinRH6ysM6O1x4jB00acqOvtRwPN00xjm2jkmvML37f3JQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-12  2:10                                       ` Kent Overstreet [this message]
2013-07-12  2:22                                         ` sheng qiu
     [not found]                                           ` <CAB7xdimtWj728xp9amk=K3-dnCWugFYLSUDuueHQwRYOP13dmw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-12  2:25                                             ` Kent Overstreet
2013-07-12  2:29                                               ` sheng qiu
     [not found]                                                 ` <CAB7xdinz82AstkNTptXa2z3VFsAB4AT3NXf-Y0X7PZ+27k6iAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-12  2:41                                                   ` Kent Overstreet
2013-07-16 15:14                                                     ` sheng qiu
     [not found]                                                       ` <CAB7xdimAMQSovzRkBz47KwrVqDt1C4-d3iL6cBcrTGoqJ0dJNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-16 20:59                                                         ` Kent Overstreet
2013-07-17 22:28                                                           ` sheng qiu
     [not found]                                                             ` <CAB7xdim3d3Q7jM7+q8mwUVh6yCW1JQaM_xzWOnGHrkMxbS8EMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-23 19:46                                                               ` Kent Overstreet
2013-07-12  2:01                                   ` Kent Overstreet
2013-07-10 23:01                     ` Kent Overstreet

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=20130712021057.GA30223@kmo-pixel \
    --to=kmo-pezghdh756f8ursed/g0lq@public.gmane.org \
    --cc=herbert1984106-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox