From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 15/37] sheepdog: Switch to .bdrv_co_block_status()
Date: Fri, 2 Mar 2018 19:54:26 +0100 [thread overview]
Message-ID: <20180302185448.6314-16-kwolf@redhat.com> (raw)
In-Reply-To: <20180302185448.6314-1-kwolf@redhat.com>
From: Eric Blake <eblake@redhat.com>
We are gradually moving away from sector-based interfaces, towards
byte-based. Update the sheepdog driver accordingly.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/sheepdog.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index ac02b10fe0..3c3becf94d 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -3004,19 +3004,19 @@ static coroutine_fn int sd_co_pdiscard(BlockDriverState *bs, int64_t offset,
return acb.ret;
}
-static coroutine_fn int64_t
-sd_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
- int *pnum, BlockDriverState **file)
+static coroutine_fn int
+sd_co_block_status(BlockDriverState *bs, bool want_zero, int64_t offset,
+ int64_t bytes, int64_t *pnum, int64_t *map,
+ BlockDriverState **file)
{
BDRVSheepdogState *s = bs->opaque;
SheepdogInode *inode = &s->inode;
uint32_t object_size = (UINT32_C(1) << inode->block_size_shift);
- uint64_t offset = sector_num * BDRV_SECTOR_SIZE;
unsigned long start = offset / object_size,
- end = DIV_ROUND_UP((sector_num + nb_sectors) *
- BDRV_SECTOR_SIZE, object_size);
+ end = DIV_ROUND_UP(offset + bytes, object_size);
unsigned long idx;
- int64_t ret = BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID | offset;
+ *map = offset;
+ int ret = BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID;
for (idx = start; idx < end; idx++) {
if (inode->data_vdi_id[idx] == 0) {
@@ -3033,9 +3033,9 @@ sd_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
}
}
- *pnum = (idx - start) * object_size / BDRV_SECTOR_SIZE;
- if (*pnum > nb_sectors) {
- *pnum = nb_sectors;
+ *pnum = (idx - start) * object_size;
+ if (*pnum > bytes) {
+ *pnum = bytes;
}
if (ret > 0 && ret & BDRV_BLOCK_OFFSET_VALID) {
*file = bs;
@@ -3113,7 +3113,7 @@ static BlockDriver bdrv_sheepdog = {
.bdrv_co_writev = sd_co_writev,
.bdrv_co_flush_to_disk = sd_co_flush_to_disk,
.bdrv_co_pdiscard = sd_co_pdiscard,
- .bdrv_co_get_block_status = sd_co_get_block_status,
+ .bdrv_co_block_status = sd_co_block_status,
.bdrv_snapshot_create = sd_snapshot_create,
.bdrv_snapshot_goto = sd_snapshot_goto,
@@ -3149,7 +3149,7 @@ static BlockDriver bdrv_sheepdog_tcp = {
.bdrv_co_writev = sd_co_writev,
.bdrv_co_flush_to_disk = sd_co_flush_to_disk,
.bdrv_co_pdiscard = sd_co_pdiscard,
- .bdrv_co_get_block_status = sd_co_get_block_status,
+ .bdrv_co_block_status = sd_co_block_status,
.bdrv_snapshot_create = sd_snapshot_create,
.bdrv_snapshot_goto = sd_snapshot_goto,
@@ -3185,7 +3185,7 @@ static BlockDriver bdrv_sheepdog_unix = {
.bdrv_co_writev = sd_co_writev,
.bdrv_co_flush_to_disk = sd_co_flush_to_disk,
.bdrv_co_pdiscard = sd_co_pdiscard,
- .bdrv_co_get_block_status = sd_co_get_block_status,
+ .bdrv_co_block_status = sd_co_block_status,
.bdrv_snapshot_create = sd_snapshot_create,
.bdrv_snapshot_goto = sd_snapshot_goto,
--
2.13.6
next prev parent reply other threads:[~2018-03-02 18:55 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-02 18:54 [Qemu-devel] [PULL 00/37] Block layer patches Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 01/37] block: Add .bdrv_co_block_status() callback Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 02/37] nvme: Drop pointless .bdrv_co_get_block_status() Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 03/37] block: Switch passthrough drivers to .bdrv_co_block_status() Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 04/37] file-posix: Switch " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 05/37] gluster: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 06/37] iscsi: Switch cluster_sectors to byte-based Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 07/37] iscsi: Switch iscsi_allocmap_update() " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 08/37] iscsi: Switch to .bdrv_co_block_status() Kevin Wolf
2018-05-08 15:37 ` Peter Maydell
2018-05-08 16:38 ` Eric Blake
2018-03-02 18:54 ` [Qemu-devel] [PULL 09/37] null: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 10/37] parallels: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 11/37] qcow: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 12/37] qcow2: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 13/37] qed: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 14/37] raw: " Kevin Wolf
2018-03-02 18:54 ` Kevin Wolf [this message]
2018-03-02 18:54 ` [Qemu-devel] [PULL 16/37] vdi: Avoid bitrot of debugging code Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 17/37] vdi: Switch to .bdrv_co_block_status() Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 18/37] vmdk: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 19/37] vpc: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 20/37] vvfat: " Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 21/37] block: Drop unused .bdrv_co_get_block_status() Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 22/37] block: fix write with zero flag set and iovector provided Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 23/37] iotest 033: add misaligned write-zeroes test via truncate Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 24/37] specs/qcow2: Fix documentation of the compressed cluster descriptor Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 25/37] docs: document how to use the l2-cache-entry-size parameter Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 26/37] aio: rename aio_context_in_iothread() to in_aio_context_home_thread() Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 27/37] block: extract AIO_WAIT_WHILE() from BlockDriverState Kevin Wolf
2018-03-05 19:53 ` Eric Blake
2018-03-02 18:54 ` [Qemu-devel] [PULL 28/37] block: add BlockBackend->in_flight counter Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 29/37] block: test blk_aio_flush() with blk->root == NULL Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 30/37] Revert "IDE: Do not flush empty CDROM drives" Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 31/37] block: rename .bdrv_create() to .bdrv_co_create_opts() Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 32/37] qcow2: make qcow2_co_create2() a coroutine_fn Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 33/37] qemu-img: Make resize error message more general Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 34/37] block/ssh: Pull ssh_grow_file() from ssh_create() Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 35/37] block/ssh: Make ssh_grow_file() blocking Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 36/37] block/ssh: Add basic .bdrv_truncate() Kevin Wolf
2018-03-02 18:54 ` [Qemu-devel] [PULL 37/37] qcow2: Replace align_offset() with ROUND_UP() Kevin Wolf
2018-03-05 13:27 ` [Qemu-devel] [PULL 00/37] Block layer patches Peter Maydell
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=20180302185448.6314-16-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).