From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAeC2-0003LO-51 for qemu-devel@nongnu.org; Tue, 04 Feb 2014 06:29:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAeBv-0001x4-JG for qemu-devel@nongnu.org; Tue, 04 Feb 2014 06:29:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAeBv-0001wz-AD for qemu-devel@nongnu.org; Tue, 04 Feb 2014 06:29:23 -0500 Message-ID: <52F0CF0C.2020304@redhat.com> Date: Tue, 04 Feb 2014 12:29:16 +0100 From: Laszlo Ersek MIME-Version: 1.0 References: <1391511710-12723-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1391511710-12723-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] raw: Fix BlockLimits passthrough List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com On 02/04/14 12:01, Kevin Wolf wrote: > raw copies over the BlockLimits of bs->file during bdrv_open(). > However, since commit d34682cd it is immediately overwritten during > bdrv_refresh_limits(). This caused all fields except for > opt_transfer_length and opt_mem_alignment (which happen to be correctly > inherited in generic code) to be zeroed. > > Move the BlockLimit assignment to a .bdrv_refresh_limits() callback to > make it work again for all fields. > > Reported-by: Laszlo Ersek > Signed-off-by: Kevin Wolf > --- > block/raw_bsd.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/block/raw_bsd.c b/block/raw_bsd.c > index 978ae7a..af8706d 100644 > --- a/block/raw_bsd.c > +++ b/block/raw_bsd.c > @@ -90,6 +90,12 @@ static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) > return bdrv_get_info(bs->file, bdi); > } > > +static int raw_refresh_limits(BlockDriverState *bs) > +{ > + bs->bl = bs->file->bl; > + return 0; > +} > + > static int raw_truncate(BlockDriverState *bs, int64_t offset) > { > return bdrv_truncate(bs->file, offset); > @@ -150,7 +156,6 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags, > Error **errp) > { > bs->sg = bs->file->sg; > - bs->bl = bs->file->bl; > return 0; > } > > @@ -182,6 +187,7 @@ static BlockDriver bdrv_raw = { > .bdrv_getlength = &raw_getlength, > .has_variable_length = true, > .bdrv_get_info = &raw_get_info, > + .bdrv_refresh_limits = &raw_refresh_limits, > .bdrv_is_inserted = &raw_is_inserted, > .bdrv_media_changed = &raw_media_changed, > .bdrv_eject = &raw_eject, > Reviewed-by: Laszlo Ersek