[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/22] qcow2: Rewrite the documentation of qcow2_alloc_cluster_off
From: |
Max Reitz |
Subject: |
[PULL 11/22] qcow2: Rewrite the documentation of qcow2_alloc_cluster_offset() |
Date: |
Tue, 15 Sep 2020 12:46:16 +0200 |
From: Alberto Garcia <berto@igalia.com>
The current text corresponds to an earlier, simpler version of this
function and it does not explain how it works now.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-Id:
<bb5bd06f07c5a05b0818611de0d06ec5b66c8df3.1599150873.git.berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/qcow2-cluster.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index f65ccc5840..ce1260e746 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1714,18 +1714,22 @@ out:
}
/*
- * alloc_cluster_offset
+ * For a given area on the virtual disk defined by @offset and @bytes,
+ * find the corresponding area on the qcow2 image, allocating new
+ * clusters (or subclusters) if necessary. The result can span a
+ * combination of allocated and previously unallocated clusters.
*
- * For a given offset on the virtual disk, find the cluster offset in qcow2
- * file. If the offset is not found, allocate a new cluster.
+ * On return, @host_offset is set to the beginning of the requested
+ * area. This area is guaranteed to be contiguous on the qcow2 file
+ * but it can be smaller than initially requested. In this case @bytes
+ * is updated with the actual size.
*
- * If the cluster was already allocated, m->nb_clusters is set to 0 and
- * other fields in m are meaningless.
- *
- * If the cluster is newly allocated, m->nb_clusters is set to the number of
- * contiguous clusters that have been allocated. In this case, the other
- * fields of m are valid and contain information about the first allocated
- * cluster.
+ * If any clusters or subclusters were allocated then @m contains a
+ * list with the information of all the affected regions. Note that
+ * this can happen regardless of whether this function succeeds or
+ * not. The caller is responsible for updating the L2 metadata of the
+ * allocated clusters (on success) or freeing them (on failure), and
+ * for clearing the contents of @m afterwards in both cases.
*
* If the request conflicts with another write request in flight, the coroutine
* is queued and will be reentered when the dependency has completed.
--
2.26.2
- [PULL 00/22] Block patches, Max Reitz, 2020/09/15
- [PULL 01/22] qemu-iotests: Fix FilePaths cleanup, Max Reitz, 2020/09/15
- [PULL 02/22] qemu-iotests: Fix FilePaths docstring, Max Reitz, 2020/09/15
- [PULL 03/22] qemu-iotests: Support varargs syntax in FilePaths, Max Reitz, 2020/09/15
- [PULL 04/22] qemu-iotests: Merge FilePaths and FilePath, Max Reitz, 2020/09/15
- [PULL 05/22] qemu-iotests: Simplify FilePath __init__, Max Reitz, 2020/09/15
- [PULL 06/22] block/quorum.c: stable children names, Max Reitz, 2020/09/15
- [PULL 07/22] qemu-img: avoid unaligned read requests during convert, Max Reitz, 2020/09/15
- [PULL 08/22] qcow2: Use macros for the L1, refcount and bitmap table entry sizes, Max Reitz, 2020/09/15
- [PULL 10/22] qcow2: Don't check nb_clusters when removing l2meta from the list, Max Reitz, 2020/09/15
- [PULL 11/22] qcow2: Rewrite the documentation of qcow2_alloc_cluster_offset(),
Max Reitz <=
- [PULL 12/22] qemu-img: Explicit number replaced by a constant, Max Reitz, 2020/09/15
- [PULL 09/22] qcow2: Fix removal of list members from BDRVQcow2State.cluster_allocs, Max Reitz, 2020/09/15
- [PULL 13/22] iotests: Skip test_stream_parallel in test 030 when doing "make check", Max Reitz, 2020/09/15
- [PULL 14/22] block/vhdx: Support vhdx image only with 512 bytes logical sector size, Max Reitz, 2020/09/15
- [PULL 15/22] qcow2: Handle QCowL2Meta on error in preallocate_co(), Max Reitz, 2020/09/15
- [PULL 16/22] qcow2: Make qcow2_free_any_clusters() free only one cluster, Max Reitz, 2020/09/15
- [PULL 17/22] qcow2: Return the original error code in qcow2_co_pwrite_zeroes(), Max Reitz, 2020/09/15
- [PULL 18/22] block/rbd: remove runtime_opts, Max Reitz, 2020/09/15
- [PULL 19/22] block/qcow: remove runtime opts, Max Reitz, 2020/09/15
- [PULL 22/22] block/rbd: add 'namespace' to qemu_rbd_strong_runtime_opts[], Max Reitz, 2020/09/15