[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v5 1/8] vmdk: Move vmdk_find_offset_in_cluster() to
From: |
Ashijeet Acharya |
Subject: |
[Qemu-block] [PATCH v5 1/8] vmdk: Move vmdk_find_offset_in_cluster() to the top |
Date: |
Mon, 5 Jun 2017 11:23:20 +0530 |
Move the existing vmdk_find_offset_in_cluster() function to the top of
the driver.
Signed-off-by: Ashijeet Acharya <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
---
block/vmdk.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index a9bd22b..22be887 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -242,6 +242,18 @@ static void vmdk_free_last_extent(BlockDriverState *bs)
s->extents = g_renew(VmdkExtent, s->extents, s->num_extents);
}
+static inline uint64_t vmdk_find_offset_in_cluster(VmdkExtent *extent,
+ int64_t offset)
+{
+ uint64_t extent_begin_offset, extent_relative_offset;
+ uint64_t cluster_size = extent->cluster_sectors * BDRV_SECTOR_SIZE;
+
+ extent_begin_offset =
+ (extent->end_sector - extent->sectors) * BDRV_SECTOR_SIZE;
+ extent_relative_offset = offset - extent_begin_offset;
+ return extent_relative_offset % cluster_size;
+}
+
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
{
char *desc;
@@ -1266,18 +1278,6 @@ static VmdkExtent *find_extent(BDRVVmdkState *s,
return NULL;
}
-static inline uint64_t vmdk_find_offset_in_cluster(VmdkExtent *extent,
- int64_t offset)
-{
- uint64_t extent_begin_offset, extent_relative_offset;
- uint64_t cluster_size = extent->cluster_sectors * BDRV_SECTOR_SIZE;
-
- extent_begin_offset =
- (extent->end_sector - extent->sectors) * BDRV_SECTOR_SIZE;
- extent_relative_offset = offset - extent_begin_offset;
- return extent_relative_offset % cluster_size;
-}
-
static inline uint64_t vmdk_find_index_in_cluster(VmdkExtent *extent,
int64_t sector_num)
{
--
2.6.2
- [Qemu-block] [PATCH v5 0/8] Optimize VMDK I/O by allocating multiple clusters, Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v5 1/8] vmdk: Move vmdk_find_offset_in_cluster() to the top,
Ashijeet Acharya <=
- [Qemu-block] [PATCH v5 2/8] vmdk: Rename get_whole_cluster() to vmdk_perform_cow(), Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v5 3/8] vmdk: Rename get_cluster_offset() to vmdk_get_cluster_offset(), Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v5 4/8] vmdk: Factor out metadata loading code out of vmdk_get_cluster_offset(), Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v5 5/8] vmdk: Set maximum bytes allocated in one cycle, Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v5 6/8] vmdk: New functions to assist allocating multiple clusters, Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v5 7/8] vmdk: Update metadata for multiple clusters, Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v5 8/8] vmdk: Make vmdk_get_cluster_offset() return cluster offset only, Ashijeet Acharya, 2017/06/05