From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com, famz@redhat.com,
jsnow@redhat.com, Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v4 20/20] block: Drop unused .bdrv_co_get_block_status()
Date: Thu, 12 Oct 2017 13:59:16 -0500 [thread overview]
Message-ID: <20171012185916.22776-21-eblake@redhat.com> (raw)
In-Reply-To: <20171012185916.22776-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>
---
v4: rebase to interface tweak
v3: no change
v2: rebase to earlier changes
---
include/block/block_int.h | 3 ---
block/io.c | 34 +---------------------------------
2 files changed, 1 insertion(+), 36 deletions(-)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 7c8503f693..6e7ae5fc8d 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -213,9 +213,6 @@ struct BlockDriver {
* guarantees input aligned to request_alignment, as well as
* non-NULL pnum, map, and file.
*/
- 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 *bd,
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 6a2a2e1484..7ae4cdadf5 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1847,7 +1847,7 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs,
bytes = n;
}
- 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) {
@@ -1865,40 +1865,9 @@ 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;
- goto refine;
- }
-
ret = bs->drv->bdrv_co_block_status(bs, want_zero, aligned_offset,
aligned_bytes, pnum, &local_map,
&local_file);
@@ -1916,7 +1885,6 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs,
*pnum = total_size - aligned_offset;
}
-refine:
/*
* The driver's result must be a multiple of request_alignment.
* Clamp pnum and adjust map to original request.
--
2.13.6
next prev parent reply other threads:[~2017-10-12 19:06 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 18:58 [Qemu-devel] [PATCH v4 00/20] add byte-based block_status driver callbacks Eric Blake
2017-10-12 18:58 ` [Qemu-devel] [PATCH v4 01/20] block: Add .bdrv_co_block_status() callback Eric Blake
2017-11-28 8:02 ` Vladimir Sementsov-Ogievskiy
2017-10-12 18:58 ` [Qemu-devel] [PATCH v4 02/20] block: Switch passthrough drivers to .bdrv_co_block_status() Eric Blake
2017-11-28 8:19 ` Vladimir Sementsov-Ogievskiy
2017-11-28 16:05 ` Eric Blake
2017-10-12 18:58 ` [Qemu-devel] [PATCH v4 03/20] file-posix: Switch " Eric Blake
2017-11-30 8:06 ` Vladimir Sementsov-Ogievskiy
2017-11-30 20:40 ` Eric Blake
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 04/20] gluster: " Eric Blake
2017-11-30 8:44 ` Vladimir Sementsov-Ogievskiy
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 05/20] iscsi: Switch cluster_sectors to byte-based Eric Blake
2017-10-18 9:20 ` Paolo Bonzini
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 06/20] iscsi: Switch iscsi_allocmap_update() " Eric Blake
2017-10-18 9:20 ` Paolo Bonzini
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 07/20] iscsi: Switch to .bdrv_co_block_status() Eric Blake
2017-10-18 9:20 ` Paolo Bonzini
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 08/20] null: " Eric Blake
2017-11-30 8:47 ` Vladimir Sementsov-Ogievskiy
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 09/20] parallels: " Eric Blake
2017-11-30 9:03 ` Vladimir Sementsov-Ogievskiy
2017-11-30 22:12 ` Eric Blake
2017-11-30 22:18 ` Eric Blake
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 10/20] qcow: " Eric Blake
2017-11-30 9:26 ` Vladimir Sementsov-Ogievskiy
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 11/20] qcow2: " Eric Blake
2017-11-30 9:51 ` Vladimir Sementsov-Ogievskiy
2017-11-30 22:38 ` Eric Blake
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 12/20] qed: " Eric Blake
2017-11-30 10:27 ` Vladimir Sementsov-Ogievskiy
2017-11-30 23:17 ` Eric Blake
2017-12-04 8:59 ` Vladimir Sementsov-Ogievskiy
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 13/20] raw: " Eric Blake
2017-11-30 11:10 ` Vladimir Sementsov-Ogievskiy
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 14/20] sheepdog: " Eric Blake
2017-11-30 11:13 ` Vladimir Sementsov-Ogievskiy
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 15/20] vdi: Avoid bitrot of debugging code Eric Blake
2017-11-30 11:17 ` Vladimir Sementsov-Ogievskiy
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 16/20] vdi: Switch to .bdrv_co_block_status() Eric Blake
2017-11-30 11:26 ` Vladimir Sementsov-Ogievskiy
2017-11-30 23:11 ` Eric Blake
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 17/20] vmdk: " Eric Blake
2017-11-30 11:39 ` Vladimir Sementsov-Ogievskiy
2017-11-30 23:18 ` Eric Blake
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 18/20] vpc: " Eric Blake
2017-11-30 12:22 ` Vladimir Sementsov-Ogievskiy
2017-11-30 23:28 ` Eric Blake
2017-10-12 18:59 ` [Qemu-devel] [PATCH v4 19/20] vvfat: " Eric Blake
2017-11-30 12:25 ` Vladimir Sementsov-Ogievskiy
2017-11-30 23:31 ` Eric Blake
2017-10-12 18:59 ` Eric Blake [this message]
2017-11-30 12:29 ` [Qemu-devel] [PATCH v4 20/20] block: Drop unused .bdrv_co_get_block_status() Vladimir Sementsov-Ogievskiy
2017-11-21 11:27 ` [Qemu-devel] [PATCH v4 00/20] add byte-based block_status driver callbacks Vladimir Sementsov-Ogievskiy
2017-11-21 12:28 ` Eric Blake
2017-11-30 13:04 ` Vladimir Sementsov-Ogievskiy
2017-11-30 15:36 ` Eric Blake
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=20171012185916.22776-21-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=jsnow@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).