[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/11] block/copy-before-write: add cbw_snapshot_discard()
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH 10/11] block/copy-before-write: add cbw_snapshot_discard() |
Date: |
Wed, 4 Aug 2021 16:17:49 +0300 |
To be used soon.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
block/copy-before-write.h | 1 +
block/copy-before-write.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/block/copy-before-write.h b/block/copy-before-write.h
index a7e286620c..5809ffc7d0 100644
--- a/block/copy-before-write.h
+++ b/block/copy-before-write.h
@@ -40,5 +40,6 @@ void bdrv_cbw_drop(BlockDriverState *bs);
int cbw_snapshot_read_lock(BlockDriverState *bs, int64_t offset,
int64_t bytes, const BlockReq **req, int64_t *pnum);
void cbw_snapshot_read_unlock(BlockDriverState *bs, const BlockReq *req);
+void cbw_snapshot_discard(BlockDriverState *bs, int64_t offset, int64_t bytes);
#endif /* COPY_BEFORE_WRITE_H */
diff --git a/block/copy-before-write.c b/block/copy-before-write.c
index a96131358e..a9fc8e34e9 100644
--- a/block/copy-before-write.c
+++ b/block/copy-before-write.c
@@ -103,6 +103,17 @@ void cbw_snapshot_read_unlock(BlockDriverState *bs, const
BlockReq *req)
drop_read_req(s, (BlockReq *)req);
}
+void cbw_snapshot_discard(BlockDriverState *bs, int64_t offset, int64_t bytes)
+{
+ BDRVCopyBeforeWriteState *s = bs->opaque;
+
+ WITH_QEMU_LOCK_GUARD(&s->lock) {
+ bdrv_reset_dirty_bitmap(s->access_bitmap, offset, bytes);
+ }
+
+ block_copy_reset(s->bcs, offset, bytes);
+}
+
static coroutine_fn int cbw_co_preadv(
BlockDriverState *bs, uint64_t offset, uint64_t bytes,
QEMUIOVector *qiov, int flags)
--
2.29.2
- [PATCH RFC DRAFT 00/11] Make image fleecing more usable, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 01/11] block/block-copy: move copy_bitmap initialization to block_copy_state_new(), Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 02/11] block/dirty-bitmap: bdrv_merge_dirty_bitmap(): add return value, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 04/11] block/copy-before-write: add bitmap open parameter, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 03/11] block/block-copy: block_copy_state_new(): add bitmap parameter, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 06/11] block: intoduce reqlist, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 05/11] block/block-copy: add block_copy_reset(), Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 08/11] block/reqlist: add reqlist_wait_all(), Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 07/11] block/dirty-bitmap: introduce bdrv_dirty_bitmap_status(), Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 09/11] block/copy-before-write: add cbw_snapshot_read_{lock, unlock}(), Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH 10/11] block/copy-before-write: add cbw_snapshot_discard(),
Vladimir Sementsov-Ogievskiy <=
- [PATCH 11/11] block: introduce fleecing block driver, Vladimir Sementsov-Ogievskiy, 2021/08/04