qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH RFC v2 08/22] block/pcache: implement pickup par


From: Pavel Butsykin
Subject: Re: [Qemu-block] [PATCH RFC v2 08/22] block/pcache: implement pickup parts of the cache
Date: Thu, 8 Sep 2016 15:29:22 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 02.09.2016 11:59, Kevin Wolf wrote:
Am 29.08.2016 um 19:10 hat Pavel Butsykin geschrieben:
Implementation of obtaining fragments of the cache belonging to one area
of request. This will allow to handle the case when a request is partially
hits the cache.

Signed-off-by: Pavel Butsykin <address@hidden>

+static void pcache_pickup_parts_of_cache(PrefCacheAIOCB *acb, PCNode *node,
+                                         uint64_t num, uint32_t size)
+{
+    uint32_t up_size;
+
+    do {
+        if (num < node->cm.sector_num) {
+            PCNode *new_node;
+            RbNodeKey lc_key = {
+                .num = num,
+                .size = node->cm.sector_num - num,
+            };
+            up_size = lc_key.size;
+
+            if (!pcache_node_find_and_create(acb, &lc_key, &new_node)) {
+                node = new_node;
+                continue;
+            }

We're creating additional nodes here; and we need them because they have
their own status. But once the read has completed, wouldn't it make
sense to merge all adjacent nodes in NODE_SUCCESS_STATUS?

This can be done, but first we need to think, worth it or not. If we
merge nodes, the tree will have less nodes, the search will be faster,
that's good. But we will have to re-allocate memory, as well as the
merging could lead to the formation of larger nodes, and it's not very
good for the displacement, because it increases the chance of
displacement of unread areas of the cache memory.

I think we do not need to cache missing memory, because it is contrary
to the read-ahead policy. (read the area of the disk once will not be
read again) Also, considering the 22nd patch(
[PATCH RFC v2 22/22] block/pcache: drop used pcache node), it just
makes no sense to move the missing pieces of data in the cache memory.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]