aboutsummaryrefslogtreecommitdiff
path: root/block/dirty-bitmap.c
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2019-07-29 16:35:53 -0400
committerJohn Snow <jsnow@redhat.com>2019-08-16 16:28:02 -0400
commit28636b8211c30e9b7ab05806a8824eabf377f307 (patch)
tree222052df2f06426b22f2396380de35b0527cffa6 /block/dirty-bitmap.c
parentb7661ca5d84a7d330acc3c3f471e757e55261f84 (diff)
block/dirty-bitmap: add bdrv_dirty_bitmap_get
Add a public interface for get. While we're at it, rename "bdrv_get_dirty_bitmap_locked" to "bdrv_dirty_bitmap_get_locked". (There are more functions to rename to the bdrv_dirty_bitmap_VERB form, but they will wait until the conclusion of this series.) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 20190709232550.10724-11-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'block/dirty-bitmap.c')
-rw-r--r--block/dirty-bitmap.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 7881fea684..75a5daf116 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -509,14 +509,19 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
}
/* Called within bdrv_dirty_bitmap_lock..unlock */
-bool bdrv_get_dirty_locked(BlockDriverState *bs, BdrvDirtyBitmap *bitmap,
- int64_t offset)
+bool bdrv_dirty_bitmap_get_locked(BdrvDirtyBitmap *bitmap, int64_t offset)
{
- if (bitmap) {
- return hbitmap_get(bitmap->bitmap, offset);
- } else {
- return false;
- }
+ return hbitmap_get(bitmap->bitmap, offset);
+}
+
+bool bdrv_dirty_bitmap_get(BdrvDirtyBitmap *bitmap, int64_t offset)
+{
+ bool ret;
+ bdrv_dirty_bitmap_lock(bitmap);
+ ret = bdrv_dirty_bitmap_get_locked(bitmap, offset);
+ bdrv_dirty_bitmap_unlock(bitmap);
+
+ return ret;
}
/**