[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/22] block: Move initialisation of BlockLimits
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 01/22] block: Move initialisation of BlockLimits to bdrv_refresh_limits() |
Date: |
Thu, 12 Dec 2013 10:32:07 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 12.12.2013 um 08:51 hat Thomas Huth geschrieben:
> On Thu, 12 Dec 2013 10:57:49 +0800
> Wenchao Xia <address@hidden> wrote:
>
> >
> > >> +static int bdrv_refresh_limits(BlockDriverState *bs)
> > >> +{
> > >> + BlockDriver *drv = bs->drv;
> > >> +
> > >> + memset(&bs->bl, 0, sizeof(bs->bl));
> > >> +
> > >> + if (!drv) {
> > >> + return 0;
> > >> + } else if (drv->bdrv_refresh_limits) {
> > >> + return drv->bdrv_refresh_limits(bs);
> > >> + }
> > >> +
> > >> + return 0;
> > > It seems this line can be removed.
> > >
> > I missed the "else if", then the patch is OK.
>
> But it could also be written in a shorter way:
>
> if (drv && drv->bdrv_refresh_limits) {
> return drv->bdrv_refresh_limits(bs);
> }
>
> return 0;
Indeed, with some code changes, this has become a bit more complicated
than necessary. I need to touch the patch anyway for Peter's comments,
so I'll change it, even though it disappears anyway later in the series.
Kevin
[Qemu-devel] [PATCH 03/22] block: Update BlockLimits when they might have changed, Kevin Wolf, 2013/12/11
[Qemu-devel] [PATCH 08/22] raw: Probe required direct I/O alignment, Kevin Wolf, 2013/12/11
[Qemu-devel] [PATCH 09/22] block: Introduce bdrv_aligned_preadv(), Kevin Wolf, 2013/12/11
[Qemu-devel] [PATCH 07/22] block: rename buffer_alignment to guest_block_size, Kevin Wolf, 2013/12/11
[Qemu-devel] [PATCH 10/22] block: Introduce bdrv_co_do_preadv(), Kevin Wolf, 2013/12/11
[Qemu-devel] [PATCH 11/22] block: Introduce bdrv_aligned_pwritev(), Kevin Wolf, 2013/12/11