From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, pbonzini@redhat.com, kwolf@redhat.com,
stefanha@redhat.com, Fam Zheng <famz@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v2 17/19] block: Kill .bdrv_co_discard()
Date: Fri, 15 Jul 2016 17:23:06 -0600 [thread overview]
Message-ID: <1468624988-423-18-git-send-email-eblake@redhat.com> (raw)
In-Reply-To: <1468624988-423-1-git-send-email-eblake@redhat.com>
Now that all drivers have a byte-based .bdrv_co_pdiscard(), we
no longer need to worry about the sector-based version. We can
also relax our minimum alignment to 1 for drivers that support it.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
include/block/block_int.h | 2 --
block/io.c | 9 ++-------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index b4d4cd2..42bbed4 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -165,8 +165,6 @@ struct BlockDriver {
*/
int coroutine_fn (*bdrv_co_pwrite_zeroes)(BlockDriverState *bs,
int64_t offset, int count, BdrvRequestFlags flags);
- int coroutine_fn (*bdrv_co_discard)(BlockDriverState *bs,
- int64_t sector_num, int nb_sectors);
int coroutine_fn (*bdrv_co_pdiscard)(BlockDriverState *bs,
int64_t offset, int count);
int64_t coroutine_fn (*bdrv_co_get_block_status)(BlockDriverState *bs,
diff --git a/block/io.c b/block/io.c
index ee87fbf..b81d1fc 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2403,14 +2403,12 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset,
return 0;
}
- if (!bs->drv->bdrv_co_discard && !bs->drv->bdrv_co_pdiscard &&
- !bs->drv->bdrv_aio_pdiscard) {
+ if (!bs->drv->bdrv_co_pdiscard && !bs->drv->bdrv_aio_pdiscard) {
return 0;
}
/* Discard is advisory, so ignore any unaligned head or tail */
- align = MAX(BDRV_SECTOR_SIZE,
- MAX(bs->bl.pdiscard_alignment, bs->bl.request_alignment));
+ align = MAX(bs->bl.pdiscard_alignment, bs->bl.request_alignment);
assert(is_power_of_2(align));
head = MIN(count, -offset & (align - 1));
if (head) {
@@ -2438,9 +2436,6 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset,
if (bs->drv->bdrv_co_pdiscard) {
ret = bs->drv->bdrv_co_pdiscard(bs, offset, num);
- } else if (bs->drv->bdrv_co_discard) {
- ret = bs->drv->bdrv_co_discard(bs, offset >> BDRV_SECTOR_BITS,
- num >> BDRV_SECTOR_BITS);
} else {
BlockAIOCB *acb;
CoroutineIOCompletion co = {
--
2.5.5
next prev parent reply other threads:[~2016-07-15 23:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-15 23:22 [Qemu-devel] [PATCH for-2.7 v2 00/19] byte-based block discard Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 01/19] block: Convert bdrv_co_discard() to byte-based Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 02/19] block: Convert bdrv_discard() " Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 03/19] block: Switch BlockRequest " Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 04/19] block: Convert bdrv_aio_discard() " Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 05/19] block: Convert BB interface to byte-based discards Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 06/19] raw-posix: Switch paio_submit() to byte-based Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 07/19] rbd: Switch rbd_start_aio() " Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 08/19] block: Convert .bdrv_aio_discard() " Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 09/19] block: Add .bdrv_co_pdiscard() driver callback Eric Blake
2016-07-15 23:22 ` [Qemu-devel] [PATCH v2 10/19] blkreplay: Switch .bdrv_co_discard() to byte-based Eric Blake
2016-07-15 23:23 ` [Qemu-devel] [PATCH v2 11/19] gluster: " Eric Blake
2016-07-15 23:23 ` [Qemu-devel] [PATCH v2 12/19] iscsi: " Eric Blake
2016-07-15 23:23 ` [Qemu-devel] [PATCH v2 13/19] nbd: " Eric Blake
2016-07-15 23:23 ` [Qemu-devel] [PATCH v2 14/19] qcow2: " Eric Blake
2016-07-15 23:23 ` [Qemu-devel] [PATCH v2 15/19] raw_bsd: " Eric Blake
2016-07-15 23:23 ` [Qemu-devel] [PATCH v2 16/19] sheepdog: " Eric Blake
2016-07-15 23:23 ` Eric Blake [this message]
2016-07-15 23:23 ` [Qemu-devel] [PATCH v2 18/19] nbd: Convert to byte-based interface Eric Blake
2016-07-15 23:23 ` [Qemu-devel] [PATCH v2 19/19] raw_bsd: " Eric Blake
2016-07-19 16:12 ` [Qemu-devel] [Qemu-block] [PATCH for-2.7 v2 00/19] byte-based block discard Stefan Hajnoczi
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=1468624988-423-18-git-send-email-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@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).