Received: from eggs.gnu.org ([2001:4830:134:3::10]:58234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfkKM-0005u3-Vy for qemu-devel@nongnu.org; Fri, 02 Sep 2016 05:00:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfkKM-0006O8-6Y for qemu-devel@nongnu.org; Fri, 02 Sep 2016 04:59:59 -0400 Date: Fri, 2 Sep 2016 10:59:46 +0200 From: Kevin Wolf Message-ID: <20160902085946.GB4513@noname.redhat.com> References: <20160829171021.4902-1-pbutsykin@virtuozzo.com> <20160829171021.4902-9-pbutsykin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160829171021.4902-9-pbutsykin@virtuozzo.com> Subject: Re: [Qemu-devel] [PATCH RFC v2 08/22] block/pcache: implement pickup parts of the cache List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Butsykin Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com, eblake@redhat.com, famz@redhat.com 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 > +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? Kevin