qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 01/11] block: switch blk_write_compressed() to b


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 01/11] block: switch blk_write_compressed() to byte-based interface
Date: Tue, 28 Jun 2016 12:53:43 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 13.06.2016 um 16:23 hat Eric Blake geschrieben:
> On 05/31/2016 03:15 AM, Denis V. Lunev wrote:
> > From: Pavel Butsykin <address@hidden>
> > 
> > This is a preparatory patch, which continues the general trend of the 
> > transition
> > to the byte-based interfaces.
> > 
> > Signed-off-by: Pavel Butsykin <address@hidden>
> > Signed-off-by: Denis V. Lunev <address@hidden>
> > CC: Jeff Cody <address@hidden>
> > CC: Markus Armbruster <address@hidden>
> > CC: Eric Blake <address@hidden>
> > CC: John Snow <address@hidden>
> > CC: Stefan Hajnoczi <address@hidden>
> > CC: Kevin Wolf <address@hidden>

> > -int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
> > -                          const uint8_t *buf, int nb_sectors)
> > +int bdrv_pwrite_compressed(BlockDriverState *bs, int64_t offset,
> > +                           const void *buf, int count)
> >  {
> >      BlockDriver *drv = bs->drv;
> >      int ret;
> > @@ -1791,14 +1791,15 @@ int bdrv_write_compressed(BlockDriverState *bs, 
> > int64_t sector_num,
> >      if (!drv->bdrv_write_compressed) {
> >          return -ENOTSUP;
> >      }
> > -    ret = bdrv_check_request(bs, sector_num, nb_sectors);
> > +    ret = bdrv_check_byte_request(bs, offset, count);
> >      if (ret < 0) {
> >          return ret;
> >      }
> >  
> >      assert(QLIST_EMPTY(&bs->dirty_bitmaps));
> >  
> > -    return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors);
> > +    return drv->bdrv_write_compressed(bs, offset >> BDRV_SECTOR_BITS, buf,
> > +                                      count >> BDRV_SECTOR_BITS);
> 
> If you are going to shift right, you need to first assert that offset
> and count are aligned (and thus that our call to a sector interface
> isn't going to operate on the wrong data).  See for example commit 166fe960.

Yes, I would like to have these assertions at least.

But I'm wondering what the point of converting the interface is when we
don't intend to actually support sub-sector requests and the sector
alignment is still required at the end of the series.

Kevin

Attachment: pgpdJa6WNdJW1.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]