Re: [PATCH] bcache: account size of buckets used in uuid write to ca->meta_sectors_written

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OK, LGTM

Reviewd_by: Tang Junhui <tang.junhui.linux@xxxxxxxxx>
shenghui <shhuiw@xxxxxxxxxxx> 于2018年9月8日周六 上午10:33写道:
>
>
>
> On 09/07/2018 08:49 PM, Junhui Tang wrote:
> > It already judged read/write op in uuid_io(),
> > you just need to add the code in the right place,
> > and if in  __uuid_write(), you need to consider
> > about CAs, They are not just one, but maybe
> > somewhat more.
>
> Hi Junhui,
>
> In __uuid_write, there is:
> "
> if (bch_bucket_alloc_set(c, RESERVE_BTREE, &k.key, 1, true))
> "
> So there is only 1 bucket & 1 cache used for UUID write currently.
>
> And I added the changes in __uuid_write following prio style:
> bch_prio_write does the account instead of prio_io, which seems like
> XX_io does io submit, while XX_write does the account.
>
> Regards,
> shenghui
>
> > Shenghui Wang <shhuiw@xxxxxxxxxxx> 于2018年9月7日周五 下午6:41写道:
> >>
> >> UUIDs are considered as metadata. __uuid_write should add the number
> >> of buckets (in sectors) written to disk to ca->meta_sectors_written.
> >> Currently only 1 bucket is used in uuid write.
> >>
> >> Steps to test:
> >> 1) create a fresh backing device and a fresh cache device separately.
> >>    The backing device didn't attach to any cache set.
> >> 2) cd /sys/block/<cache device>/bcache
> >>    cat metadata_written      // record the output value
> >>    cat bucket_size
> >> 3) attach the backing device to cache set
> >> 4) cat metadata_written
> >>    The output value is almost the same as the value in step 2
> >>    before the change.
> >>    After the change, the value is bigger about 1 bucket size.
> >>
> >> Signed-off-by: Shenghui Wang <shhuiw@xxxxxxxxxxx>
> >> ---
> >>  drivers/md/bcache/super.c | 5 +++++
> >>  1 file changed, 5 insertions(+)
> >>
> >> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> >> index 94c756c66bd7..448e531e8c2d 100644
> >> --- a/drivers/md/bcache/super.c
> >> +++ b/drivers/md/bcache/super.c
> >> @@ -417,6 +417,7 @@ static int __uuid_write(struct cache_set *c)
> >>  {
> >>         BKEY_PADDED(key) k;
> >>         struct closure cl;
> >> +       struct cache *ca;
> >>
> >>         closure_init_stack(&cl);
> >>         lockdep_assert_held(&bch_register_lock);
> >> @@ -428,6 +429,10 @@ static int __uuid_write(struct cache_set *c)
> >>         uuid_io(c, REQ_OP_WRITE, 0, &k.key, &cl);
> >>         closure_sync(&cl);
> >>
> >> +       /* Only one bucket used for uuid write */
> >> +       ca = PTR_CACHE(c, &k.key, 0);
> >> +       atomic_long_add(ca->sb.bucket_size, &ca->meta_sectors_written);
> >> +
> >>         bkey_copy(&c->uuid_bucket, &k.key);
> >>         bkey_put(c, &k.key);
> >>         return 0;
> >> --
> >> 2.18.0
> >>
> >
> >




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux