qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: stefanha@redhat.com, kwolf@redhat.com, qemu-block@nongnu.org,
	hreitz@redhat.com
Subject: [PATCH 3/8] block: refresh bs->total_sectors on reopen
Date: Fri,  7 Apr 2023 17:32:58 +0200	[thread overview]
Message-ID: <20230407153303.391121-4-pbonzini@redhat.com> (raw)
In-Reply-To: <20230407153303.391121-1-pbonzini@redhat.com>

After reopening a BlockDriverState, it's possible that the size of the
underlying file has changed.  This for example is covered by test 171.

Right now, this is handled by the raw driver's has_variable_length = true
setting.  Since this will be removed by the next patch, handle it on
reopen instead, together with the existing bdrv_refresh_limits.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block.c b/block.c
index b1b7c7efe036..9de50ac7c811 100644
--- a/block.c
+++ b/block.c
@@ -4918,6 +4918,7 @@ static void bdrv_reopen_commit(BDRVReopenState *reopen_state)
     qdict_del(bs->options, "backing");
 
     bdrv_refresh_limits(bs, NULL, NULL);
+    bdrv_refresh_total_sectors(bs, bs->total_sectors);
 }
 
 /*
-- 
2.39.2



  parent reply	other threads:[~2023-04-07 15:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 15:32 [PATCH 8.0 regression 0/8] block: remove bdrv_co_get_geometry coroutines from I/O hot path Paolo Bonzini
2023-04-07 15:32 ` [PATCH 1/8] block: move has_variable_length to BlockLimits Paolo Bonzini
2023-04-07 19:38   ` Eric Blake
2023-04-07 15:32 ` [PATCH 2/8] block: remove has_variable_length from filters Paolo Bonzini
2023-04-07 19:40   ` Eric Blake
2023-04-07 15:32 ` Paolo Bonzini [this message]
2023-04-07 19:42   ` [PATCH 3/8] block: refresh bs->total_sectors on reopen Eric Blake
2023-04-07 15:32 ` [PATCH 4/8] block: remove has_variable_length from BlockDriver Paolo Bonzini
2023-04-07 19:48   ` Eric Blake
2023-04-07 15:33 ` [PATCH 5/8] migration/block: replace uses of blk_nb_sectors that do not check result Paolo Bonzini
2023-04-07 19:49   ` Eric Blake
2023-04-07 15:33 ` [PATCH 6/8] block-backend: inline bdrv_co_get_geometry Paolo Bonzini
2023-04-07 19:58   ` Eric Blake
2023-04-07 15:33 ` [PATCH 7/8] block-backend: ignore inserted state in blk_co_nb_sectors Paolo Bonzini
2023-04-07 20:00   ` Eric Blake
2023-04-07 15:33 ` [PATCH 8/8] block, block-backend: write some hot coroutine wrappers by hand Paolo Bonzini
2023-04-07 20:04   ` Eric Blake
2023-04-07 20:32     ` Paolo Bonzini
2023-04-11 15:01 ` [PATCH 8.0 regression 0/8] block: remove bdrv_co_get_geometry coroutines from I/O hot path Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230407153303.391121-4-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).