[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 6/9] block: Use common req handling for disca
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v2 6/9] block: Use common req handling for discard |
Date: |
Thu, 5 Jul 2018 14:44:06 +0200 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
Am 05.07.2018 um 09:36 hat Fam Zheng geschrieben:
> Reuse the new bdrv_co_write_req_prepare/finish helpers. The variation
> here is that discard requests don't affect bs->wr_highest_offset.
>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> block/io.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/block/io.c b/block/io.c
> index f06978dda0..912fcb962a 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -1582,7 +1582,18 @@ bdrv_co_write_req_finish(BdrvChild *child,
> BdrvTrackedRequest *req, int ret)
> bdrv_parent_cb_resize(bs);
> bdrv_dirty_bitmap_truncate(bs, end_sector << BDRV_SECTOR_BITS);
> }
> - bdrv_set_dirty(bs, req->offset, req->bytes);
> + if (req->bytes) {
> + switch (req->type) {
> + case BDRV_TRACKED_WRITE:
> + stat64_max(&bs->wr_highest_offset, req->offset + req->bytes);
You forgot to remove this line above, so now this one is redundant and
we still execute it always.
Apart from that, why shouldn't discard be included in
bs->wr_highest_offset? It's an access to an area in the image that must
be present, so it indicates a larger file size, doesn't it?
> + /* fall through, to set dirty bits */
> + case BDRV_TRACKED_DISCARD:
> + bdrv_set_dirty(bs, req->offset, req->bytes);
> + break;
> + default:
> + break;
> + }
> + }
> }
Kevin
- Re: [Qemu-devel] [PATCH v2 1/9] block: Add copy offloading trace points, (continued)
- [Qemu-devel] [PATCH v2 2/9] block: Use BdrvChild to discard, Fam Zheng, 2018/07/05
- [Qemu-devel] [PATCH v2 3/9] block: Use uint64_t for BdrvTrackedRequest byte fields, Fam Zheng, 2018/07/05
- [Qemu-devel] [PATCH v2 4/9] block: Extract common write req handling, Fam Zheng, 2018/07/05
- [Qemu-devel] [PATCH v2 5/9] block: Fix handling of image enlarging write, Fam Zheng, 2018/07/05
- [Qemu-devel] [PATCH v2 6/9] block: Use common req handling for discard, Fam Zheng, 2018/07/05
- Re: [Qemu-devel] [PATCH v2 6/9] block: Use common req handling for discard,
Kevin Wolf <=
- [Qemu-devel] [PATCH v2 7/9] block: Use common req handling in copy offloading, Fam Zheng, 2018/07/05
- [Qemu-devel] [PATCH v2 8/9] block: Fix bdrv_co_truncate overlap check, Fam Zheng, 2018/07/05
- [Qemu-devel] [PATCH v2 9/9] block: Use common write req handling in truncate, Fam Zheng, 2018/07/05
- Re: [Qemu-devel] [PATCH v2 0/9] block: Fix dst reading after tail copy offloading, Kevin Wolf, 2018/07/05