From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v8 21/21] block: Drop unused .bdrv_co_get_block_status()
Date: Tue, 13 Feb 2018 14:27:01 -0600 [thread overview]
Message-ID: <20180213202701.15858-22-eblake@redhat.com> (raw)
In-Reply-To: <20180213202701.15858-1-eblake@redhat.com>
We are gradually moving away from sector-based interfaces, towards
byte-based. Now that all drivers have been updated to provide the
byte-based .bdrv_co_block_status(), we can delete the sector-based
interface.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
---
v7: no change
v6: rebase to changes in patch 1, drop R-b
v5: rebase to master
v4: rebase to interface tweak
v3: no change
v2: rebase to earlier changes
---
include/block/block_int.h | 3 ---
block/io.c | 50 ++++++++++-------------------------------------
2 files changed, 10 insertions(+), 43 deletions(-)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index bf2598856cf..5ae7738cf8d 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -215,9 +215,6 @@ struct BlockDriver {
* as well as non-NULL pnum, map, and file; in turn, the driver
* must return an error or set pnum to an aligned non-zero value.
*/
- int64_t coroutine_fn (*bdrv_co_get_block_status)(BlockDriverState *bs,
- int64_t sector_num, int nb_sectors, int *pnum,
- BlockDriverState **file);
int coroutine_fn (*bdrv_co_block_status)(BlockDriverState *bs,
bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum,
int64_t *map, BlockDriverState **file);
diff --git a/block/io.c b/block/io.c
index 5bae79f282e..4c3dba09730 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1963,7 +1963,7 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs,
/* Must be non-NULL or bdrv_getlength() would have failed */
assert(bs->drv);
- if (!bs->drv->bdrv_co_get_block_status && !bs->drv->bdrv_co_block_status) {
+ if (!bs->drv->bdrv_co_block_status) {
*pnum = bytes;
ret = BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED;
if (offset + bytes == total_size) {
@@ -1981,53 +1981,23 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs,
/* Round out to request_alignment boundaries */
align = bs->bl.request_alignment;
- if (bs->drv->bdrv_co_get_block_status && align < BDRV_SECTOR_SIZE) {
- align = BDRV_SECTOR_SIZE;
- }
aligned_offset = QEMU_ALIGN_DOWN(offset, align);
aligned_bytes = ROUND_UP(offset + bytes, align) - aligned_offset;
- if (bs->drv->bdrv_co_get_block_status) {
- int count; /* sectors */
- int64_t longret;
-
- assert(QEMU_IS_ALIGNED(aligned_offset | aligned_bytes,
- BDRV_SECTOR_SIZE));
- /*
- * The contract allows us to return pnum smaller than bytes, even
- * if the next query would see the same status; we truncate the
- * request to avoid overflowing the driver's 32-bit interface.
- */
- longret = bs->drv->bdrv_co_get_block_status(
- bs, aligned_offset >> BDRV_SECTOR_BITS,
- MIN(INT_MAX, aligned_bytes) >> BDRV_SECTOR_BITS, &count,
- &local_file);
- if (longret < 0) {
- assert(INT_MIN <= longret);
- ret = longret;
- goto out;
- }
- if (longret & BDRV_BLOCK_OFFSET_VALID) {
- local_map = longret & BDRV_BLOCK_OFFSET_MASK;
- }
- ret = longret & ~BDRV_BLOCK_OFFSET_MASK;
- *pnum = count * BDRV_SECTOR_SIZE;
- } else {
- ret = bs->drv->bdrv_co_block_status(bs, want_zero, aligned_offset,
- aligned_bytes, pnum, &local_map,
- &local_file);
- if (ret < 0) {
- *pnum = 0;
- goto out;
- }
- assert(*pnum); /* The block driver must make progress */
+ ret = bs->drv->bdrv_co_block_status(bs, want_zero, aligned_offset,
+ aligned_bytes, pnum, &local_map,
+ &local_file);
+ if (ret < 0) {
+ *pnum = 0;
+ goto out;
}
/*
- * The driver's result must be a multiple of request_alignment.
+ * The driver's result must be a non-zero multiple of request_alignment.
* Clamp pnum and adjust map to original request.
*/
- assert(QEMU_IS_ALIGNED(*pnum, align) && align > offset - aligned_offset);
+ assert(*pnum && QEMU_IS_ALIGNED(*pnum, align) &&
+ align > offset - aligned_offset);
*pnum -= offset - aligned_offset;
if (*pnum > bytes) {
*pnum = bytes;
--
2.14.3
next prev parent reply other threads:[~2018-02-13 20:27 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 20:26 [Qemu-devel] [PATCH v8 00/21] add byte-based block_status driver callbacks Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 01/21] block: Add .bdrv_co_block_status() callback Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 02/21] nvme: Drop pointless .bdrv_co_get_block_status() Eric Blake
2018-02-14 17:41 ` Philippe Mathieu-Daudé
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 03/21] block: Switch passthrough drivers to .bdrv_co_block_status() Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 04/21] file-posix: Switch " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 05/21] gluster: " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 06/21] iscsi: Switch cluster_sectors to byte-based Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 07/21] iscsi: Switch iscsi_allocmap_update() " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 08/21] iscsi: Switch to .bdrv_co_block_status() Eric Blake
2018-02-14 11:53 ` Kevin Wolf
2018-02-14 14:33 ` Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 09/21] null: " Eric Blake
2018-02-14 12:05 ` Kevin Wolf
2018-02-14 14:44 ` Eric Blake
2018-02-14 14:55 ` Kevin Wolf
2018-02-23 16:43 ` Eric Blake
2018-02-23 17:05 ` Kevin Wolf
2018-02-23 23:38 ` Eric Blake
2018-02-26 14:05 ` Kevin Wolf
2018-03-01 7:25 ` Vladimir Sementsov-Ogievskiy
2018-03-01 9:48 ` Kevin Wolf
2018-03-01 9:57 ` Vladimir Sementsov-Ogievskiy
2018-03-01 10:13 ` Kevin Wolf
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 10/21] parallels: " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 11/21] qcow: " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 12/21] qcow2: " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 13/21] qed: " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 14/21] raw: " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 15/21] sheepdog: " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 16/21] vdi: Avoid bitrot of debugging code Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 17/21] vdi: Switch to .bdrv_co_block_status() Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 18/21] vmdk: " Eric Blake
2018-02-13 20:26 ` [Qemu-devel] [PATCH v8 19/21] vpc: " Eric Blake
2018-02-14 13:08 ` Kevin Wolf
2018-02-14 14:51 ` Eric Blake
2018-02-13 20:27 ` [Qemu-devel] [PATCH v8 20/21] vvfat: " Eric Blake
2018-02-14 13:12 ` Kevin Wolf
2018-02-14 14:50 ` Eric Blake
2018-02-14 15:00 ` Kevin Wolf
2018-02-13 20:27 ` Eric Blake [this message]
2018-02-14 17:11 ` [Qemu-devel] [PATCH v8 00/21] add byte-based block_status driver callbacks 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=20180213202701.15858-22-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).