From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2MSU-0002kk-L3 for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:23:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2MST-0007sC-Kn for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:23:58 -0400 Received: from mail-ye0-x236.google.com ([2607:f8b0:4002:c04::236]:60376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2MST-0007rx-Go for qemu-devel@nongnu.org; Thu, 25 Jul 2013 10:23:57 -0400 Received: by mail-ye0-f182.google.com with SMTP id m12so195590yen.41 for ; Thu, 25 Jul 2013 07:23:57 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 25 Jul 2013 16:23:02 +0200 Message-Id: <1374762197-7261-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1374762197-7261-1-git-send-email-pbonzini@redhat.com> References: <1374762197-7261-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v3 04/19] block: update bs->total_sectors on writes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pl@kamp.de, stefanha@redhat.com If a BlockDriverState is growable, after every write we need to check if bs->total_sectors might have changed. Signed-off-by: Paolo Bonzini --- block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block.c b/block.c index 6cd39fa..ebac2fa 100644 --- a/block.c +++ b/block.c @@ -2651,6 +2651,9 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs, if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { bs->wr_highest_sector = sector_num + nb_sectors - 1; } + if (bs->growable && ret >= 0) { + bs->total_sectors = MAX(bs->total_sectors, sector_num + nb_sectors); + } tracked_request_end(&req); -- 1.8.3.1