From patchwork Mon Apr 8 12:16:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13621041 Received: from fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E57EC6A8A3 for ; Mon, 8 Apr 2024 12:16:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712578619; cv=none; b=qu7q8rUjbRgebXhfGK5mHhUrCXkz9KldZPvIDb4mZFLDsmd3KRGECkjtuEWJSxOjeWEfIMKypbHDgIJnT+JvrwlUovVmg3N8t9DRy1Yko/EMXD5dN85hEnYN4laQ6yAGLVLbi6Seh1dunCkVInaEXGzkUiPIZQ/0OF/hpZOfrP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712578619; c=relaxed/simple; bh=HzRr0J6eFAjXeVqNXsGRR6aGFJP55W0WvuXfjTZCejE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JCiZIPas5l3TTm4zWae0kMz4jbGA4XVJ8/sTKupYt1q5NOYgTnltbaAwh6+UjEvpSPZ0B3zYMMBsN6q1rXA7h1QEhce3RijWBjA62cgfQVgjI34aoJdHKIzX0MqmKAwB+bEWDq0yy0D3a6F0RvbVFnhmCbx/QmwJM2/DiOCXxWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=cIff7wFi; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=GZpL6gL2; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="cIff7wFi"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GZpL6gL2" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 3CB671140077; Mon, 8 Apr 2024 08:16:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 08 Apr 2024 08:16:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1712578604; x=1712665004; bh=MpVXaBDT+9 GHdv574Gar3EYI1kJvGsH4TGuUo3QnhzA=; b=cIff7wFiZSv+IzQ8MxLOvoaxvl WZorVgvnJyBnA1hwGt7s1N1DCTJH3/jv33Qqew1JGLo5IqaK5kgntaF3D++Fmj7h l/9v4T8E55DlFCTF7RNtXWMo5IFXqA8IPCLjUC2D9A+jpNz7BlE3saK0VLYZWlt6 lzeEZPWSlMZOjNw2F3JRJ7gcNhxyu/omdZmtJH7KlyKapX0h7KEQt+8JCH7M/08d 1ZUnkipCKjv+Yt2DE4TcJJJwZJ065bMcGoe/pmE8s8ucIejmw8mWHzUT/k/Bv9iS +XNgANf9SNbjuHzEFczkhc8cgYz2IzRj3l/hLdUYplWf3biiDc7BQU67EgnQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1712578604; x=1712665004; bh=MpVXaBDT+9GHdv574Gar3EYI1kJv GsH4TGuUo3QnhzA=; b=GZpL6gL2vlCvCJpQWFWC0WjRH9OOHpM3NpmErFTV6u30 zvGF4f9e49FNssxuBRF+tK9hJyPEawXHJkaAV0zl2bg35kt66b3LVSstGlRoEEtf gT9HmxszRVBEe1mAFY/kj1wVrrdVfv5226IFfNdIHZjAVhteVIGGPsTd7KdXH1sZ +mNc2yrhxF00YhVvkm2QI090AReBqpuClYaaG1vijwKOlemQv1OpITRVP+YOust0 F3836ZVQH2bGnTpQ7EZoIWLIDu9BTxChqOkYMZdprlbcFD2bakfhk6RZ5759FgUS 8/OGAN8s6IbK53QHQKpB+yeRI+3+7w4+URirDsH7gw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudegiedghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 Apr 2024 08:16:43 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 9d347e97 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 8 Apr 2024 12:16:37 +0000 (UTC) Date: Mon, 8 Apr 2024 14:16:40 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Karthik Nayak , Justin Tobler Subject: [PATCH v2 04/10] reftable/block: introduce `block_reader_release()` Message-ID: <35f1bf50729efcee7b9162ffe79d40142418c0cf.1712578376.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Introduce a new function `block_reader_release()` that releases resources acquired by the block reader. This function will be extended in a subsequent commit. Signed-off-by: Patrick Steinhardt --- reftable/block.c | 5 +++++ reftable/block.h | 2 ++ reftable/reader.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/reftable/block.c b/reftable/block.c index e65453e11b..fe836c21e5 100644 --- a/reftable/block.c +++ b/reftable/block.c @@ -256,6 +256,11 @@ int block_reader_init(struct block_reader *br, struct reftable_block *block, return err; } +void block_reader_release(struct block_reader *br) +{ + reftable_block_done(&br->block); +} + uint8_t block_reader_type(struct block_reader *r) { return r->block.data[r->header_off]; diff --git a/reftable/block.h b/reftable/block.h index d73ed73549..601a1e0e89 100644 --- a/reftable/block.h +++ b/reftable/block.h @@ -81,6 +81,8 @@ int block_reader_init(struct block_reader *br, struct reftable_block *bl, uint32_t header_off, uint32_t table_block_size, int hash_size); +void block_reader_release(struct block_reader *br); + /* Returns the block type (eg. 'r' for refs) */ uint8_t block_reader_type(struct block_reader *r); diff --git a/reftable/reader.c b/reftable/reader.c index f70efa2b7c..f925570bf3 100644 --- a/reftable/reader.c +++ b/reftable/reader.c @@ -253,7 +253,7 @@ static void table_iter_block_done(struct table_iter *ti) if (!ti->bi.br) { return; } - reftable_block_done(&ti->bi.br->block); + block_reader_release(ti->bi.br); FREE_AND_NULL(ti->bi.br); ti->bi.last_key.len = 0;