From 291ab8f6e638bdc8a813989f8d19d8edb4a5c8ef Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Fri, 2 May 2014 16:58:38 -0500 Subject: [PATCH 06/26] qcow2: Finalise interface of handle_alloc() RH-Author: Max Reitz Message-id: <1399049936-13496-7-git-send-email-mreitz@redhat.com> Patchwork-id: 58652 O-Subject: [RHEL-6.6 qemu-kvm PATCH v3 06/24] qcow2: Finalise interface of handle_alloc() Bugzilla: 1004420 RH-Acked-by: Laszlo Ersek RH-Acked-by: Kevin Wolf RH-Acked-by: Stefan Hajnoczi From: Kevin Wolf The interface works completely on a byte granularity now and duplicated parameters are removed. Signed-off-by: Kevin Wolf Signed-off-by: Stefan Hajnoczi (cherry picked from commit c37f4cd71d99b7658d238bd8399048fc6e506958) This backport does not include the actual functionality of this patch (since it is part of and depends on a rather large series), but only the single function offset_into_cluster() in qcow2.h. Conflicts: block/qcow2-cluster.c Remove all changes which are not part of qcow2.h Signed-off-by: Max Reitz --- block/qcow2.h | 5 +++++ 1 file changed, 5 insertions(+) Signed-off-by: Jeff E. Nelson --- block/qcow2.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index fc17122..832bbfb 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -211,6 +211,11 @@ static inline int64_t start_of_cluster(BDRVQcowState *s, int64_t offset) return offset & ~(s->cluster_size - 1); } +static inline int64_t offset_into_cluster(BDRVQcowState *s, int64_t offset) +{ + return offset & (s->cluster_size - 1); +} + static inline int size_to_clusters(BDRVQcowState *s, int64_t size) { return (size + (s->cluster_size - 1)) >> s->cluster_bits; -- 1.7.1