[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [PATCH v4 1/8] block: Add "base" option to bdrv_get_bl
From: |
Fam Zheng |
Subject: |
Re: [Qemu-stable] [PATCH v4 1/8] block: Add "base" option to bdrv_get_block_status |
Date: |
Tue, 26 May 2015 11:30:14 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, 05/25 16:43, Paolo Bonzini wrote:
>
>
> On 22/05/2015 05:40, Fam Zheng wrote:
> > +{
> > + BlockDriverState *p;
> > + int64_t ret;
> > +
> > + assert(bs != base);
> > + for (p = bs; p != base; p = p->backing_hd) {
> > + ret = bdrv_co_get_block_status(p, sector_num, nb_sectors, pnum);
>
> It's a bit ugly to have different parameters for bdrv_get_block_status
> and bdrv_co_get_block_status.
I'll add bdrv_get_block_status_above and rewrite bdrv_get_block_status body on
top.
>
> > + if (ret < 0 || ret & BDRV_BLOCK_ALLOCATED) {
> > + break;
> > + }
> > + }
> > + return ret;
> > +}
> > +
>
> I think BDRV_BLOCK_ALLOCATED will always be true if passing NULL as the
> base, so patch 3 still needs a tweak.
OK, will use BDRV_BLOCK_DATA there.
>
> But, more important, you need extra logic to correct the output value of
> pnum, as in bdrv_is_allocated_above.
bdrv_co_get_block_status should fix pnum.
Fam
- [Qemu-stable] [PATCH v4 0/8] block: Mirror discarded sectors, Fam Zheng, 2015/05/21
- [Qemu-stable] [PATCH v4 1/8] block: Add "base" option to bdrv_get_block_status, Fam Zheng, 2015/05/21
- [Qemu-stable] [PATCH v4 2/8] qmp: Add optional bool "unmap" to drive-mirror, Fam Zheng, 2015/05/21
- [Qemu-stable] [PATCH v4 3/8] mirror: Do zero write on target if sectors not allocated, Fam Zheng, 2015/05/21
- [Qemu-stable] [PATCH v4 4/8] block: Fix dirty bitmap in bdrv_co_discard, Fam Zheng, 2015/05/21
- [Qemu-stable] [PATCH v4 5/8] block: Remove bdrv_reset_dirty, Fam Zheng, 2015/05/21