From patchwork Tue Feb 6 02:04:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Sakai X-Patchwork-Id: 13546521 X-Patchwork-Delegate: snitzer@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 737AB56766 for ; Tue, 6 Feb 2024 02:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; cv=none; b=hs0zcQHBQV4kHI4zBB0r9jAHsBpnAN1bG6faF0E+XZnRLfTfvGWBy2Ds4mTZaqVJTjEeYqXnro5EmwSlAK9WNvtNwXeWSrew4i/ff2MEdr1w6npqxL8IExXrZYZIJoei7qvsCKOHI+SedxR8ojC+EZmqXaZ7KISp0hCbwHJlvIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; c=relaxed/simple; bh=Ojs6Y0xoYdr0pXOS88rFZbDg6kwZfb38ana5KhSkQGc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZhBAAA5E+sLS7F9JrN9UfJo6xn5ekhQXgdckRwyix1CfDdHcqvMo8PQszIvWAgK+PcbkkAXvOISqs3dBmynBMIGrMalY2F3blqyaRRPkNppBzQsjm2CHgmuLPt1R/GRHpElKMGZlUFiIKFjfb1K13OLwBe8abHy0qdeO4ilFPNg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=EgwGUIKy; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EgwGUIKy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707185064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cppm0AAV5/kpwWZMY+i724CaJV6s98ZVpMkhhLnGFss=; b=EgwGUIKyVUVEB8rjzzQJ//GgUogrPYsiaKfSYK3Qdhv30sf9D/iv0LtMg9m4D6Ua0z8K1j 5DzHqaKeLlH9VtXpbc3jVqml9Db6A/94pboAYc3LqogWKXcVrIGmoZNk7E2Ik08XZOn+Xr M25bGkVGKJuIWVd3ArRzNDwMXVFulPM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-302-WD1VIUMuMmCs-mnPJ7kDoA-1; Mon, 05 Feb 2024 21:04:22 -0500 X-MC-Unique: WD1VIUMuMmCs-mnPJ7kDoA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9AEF438117FD; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: from vdo-builder-msakai.permabit.com (vdo-builder-msakai.permabit.lab.eng.bos.redhat.com [10.0.103.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 957102026D66; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: by vdo-builder-msakai.permabit.com (Postfix, from userid 1138) id 8E41E569F8; Mon, 5 Feb 2024 21:04:22 -0500 (EST) From: Matthew Sakai To: dm-devel@lists.linux.dev Cc: Mike Snitzer , Matthew Sakai Subject: [PATCH 1/7] dm vdo: fix sparse warnings about missing statics Date: Mon, 5 Feb 2024 21:04:16 -0500 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Mike Snitzer Addresses various sparse warnings like: warning: symbol 'SYMBOL' was not declared. Should it be static? Signed-off-by: Mike Snitzer Signed-off-by: Susan LeGendre-McGhee Signed-off-by: Matthew Sakai --- drivers/md/dm-vdo/Makefile | 1 - drivers/md/dm-vdo/block-map.c | 2 +- drivers/md/dm-vdo/constants.c | 15 --------------- drivers/md/dm-vdo/constants.h | 6 +++--- drivers/md/dm-vdo/encodings.c | 2 +- 5 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 drivers/md/dm-vdo/constants.c diff --git a/drivers/md/dm-vdo/Makefile b/drivers/md/dm-vdo/Makefile index 8f8d161a6dbe..8c06c3b969e3 100644 --- a/drivers/md/dm-vdo/Makefile +++ b/drivers/md/dm-vdo/Makefile @@ -9,7 +9,6 @@ dm-vdo-objs := \ chapter-index.o \ completion.o \ config.o \ - constants.o \ data-vio.o \ dedupe.o \ delta-index.o \ diff --git a/drivers/md/dm-vdo/block-map.c b/drivers/md/dm-vdo/block-map.c index 54ad6939cab7..1278a5791160 100644 --- a/drivers/md/dm-vdo/block-map.c +++ b/drivers/md/dm-vdo/block-map.c @@ -67,7 +67,7 @@ struct block_map_tree_segment { struct block_map_tree { struct block_map_tree_segment *segments; -} block_map_tree; +}; struct forest { struct block_map *map; diff --git a/drivers/md/dm-vdo/constants.c b/drivers/md/dm-vdo/constants.c deleted file mode 100644 index 14ac047101f8..000000000000 --- a/drivers/md/dm-vdo/constants.c +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright 2023 Red Hat - */ - -#include "types.h" - -/* The maximum logical space is 4 petabytes, which is 1 terablock. */ -const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS = 1024ULL * 1024 * 1024 * 1024; - -/* The maximum physical space is 256 terabytes, which is 64 gigablocks. */ -const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS = 1024ULL * 1024 * 1024 * 64; - -/* unit test minimum */ -const block_count_t MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2; diff --git a/drivers/md/dm-vdo/constants.h b/drivers/md/dm-vdo/constants.h index 9ae3917d00de..3a997dd7d0b1 100644 --- a/drivers/md/dm-vdo/constants.h +++ b/drivers/md/dm-vdo/constants.h @@ -91,12 +91,12 @@ enum { }; /** The maximum logical space is 4 petabytes, which is 1 terablock. */ -extern const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS; +static const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS = 1024ULL * 1024 * 1024 * 1024; /** The maximum physical space is 256 terabytes, which is 64 gigablocks. */ -extern const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS; +static const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS = 1024ULL * 1024 * 1024 * 64; /** unit test minimum */ -extern const block_count_t MINIMUM_VDO_SLAB_JOURNAL_BLOCKS; +static const block_count_t MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2; #endif /* VDO_CONSTANTS_H */ diff --git a/drivers/md/dm-vdo/encodings.c b/drivers/md/dm-vdo/encodings.c index 2d9d8645f66b..6b3e9a5b3a91 100644 --- a/drivers/md/dm-vdo/encodings.c +++ b/drivers/md/dm-vdo/encodings.c @@ -85,7 +85,7 @@ const struct header VDO_SLAB_DEPOT_HEADER_2_0 = { .size = sizeof(struct slab_depot_state_2_0), }; -const struct header VDO_LAYOUT_HEADER_3_0 = { +static const struct header VDO_LAYOUT_HEADER_3_0 = { .id = VDO_LAYOUT, .version = { .major_version = 3, From patchwork Tue Feb 6 02:04:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Sakai X-Patchwork-Id: 13546519 X-Patchwork-Delegate: snitzer@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 54F565675B for ; Tue, 6 Feb 2024 02:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; cv=none; b=Dy7SsJdnuqlN5uYEfYh3myF7Wf7Z9iaL4ZZWc3gy3k5zSeGpLSIW4H/UBRZl9e1J9y7Z9c2fWRvSbuGaDS5sZ7JTffDN+9Rt/VOZxgBpFbQRApTuP9ZpFM0gTIbMzcJj2iUFcitHt5+pyX7YZLJIEN/3LHCqsN7QEW0QDSlCMRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; c=relaxed/simple; bh=eltB9wxMdKiyaxk6OLgUlbzN/tNvW7hx+7ZCGRChaCI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L8uZmN2uqCXggKtmwMHMrRdIOdwyWhp9GH6K0Of4dnfqVRO7NxDqKOSHO/4ZY8luNaVNzLxJNVEvbwQXZjyq9twmsjKP9g3R7SArXFJf+SHXGfGZz9TH7ibORMGr6KVCqkiZD6DSVNaTdIAKvcWSK3Wt8O54eitYSI4tdnEYjA4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Mc6Uh/Nn; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Mc6Uh/Nn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707185064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6MiRUKBMB0KuUXvrN8OXpYC2JlZPNs9i3tDHSc13fd4=; b=Mc6Uh/NnkJ7qhO3yJTe4ALsrvBpOz3Zee6KkyPmmlUfv91per75Tl/9hFvRHnIAq+Vzfik YcdleSIDkUO8fl2+5pH+WpQtYgJS8TeLNVQjSE9bZTbaz7oGMi/0KM+CuC2Rdht0u4J/fq hrH5dFsEy8gQTO8nXWDJFJ5scSPjGug= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-57-5-mEUAtmOjSyfC7kZ4S4Bg-1; Mon, 05 Feb 2024 21:04:22 -0500 X-MC-Unique: 5-mEUAtmOjSyfC7kZ4S4Bg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A43C0185A783; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: from vdo-builder-msakai.permabit.com (vdo-builder-msakai.permabit.lab.eng.bos.redhat.com [10.0.103.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99156492BF0; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: by vdo-builder-msakai.permabit.com (Postfix, from userid 1138) id 939E3569FA; Mon, 5 Feb 2024 21:04:22 -0500 (EST) From: Matthew Sakai To: dm-devel@lists.linux.dev Cc: Mike Snitzer , Matthew Sakai Subject: [PATCH 2/7] dm vdo: fix sparse 'warning: Using plain integer as NULL pointer' Date: Mon, 5 Feb 2024 21:04:17 -0500 Message-ID: <454e6715c7d8811765295ba656e60a09f294373d.1707184413.git.msakai@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Mike Snitzer Signed-off-by: Mike Snitzer Signed-off-by: Susan LeGendre-McGhee Signed-off-by: Matthew Sakai --- drivers/md/dm-vdo/index.c | 8 ++++---- drivers/md/dm-vdo/vdo.c | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-vdo/index.c b/drivers/md/dm-vdo/index.c index e343a973881d..1596f6ba43a5 100644 --- a/drivers/md/dm-vdo/index.c +++ b/drivers/md/dm-vdo/index.c @@ -732,18 +732,18 @@ static void close_chapters(void *arg) static void stop_chapter_writer(struct chapter_writer *writer) { - struct thread *writer_thread = 0; + struct thread *writer_thread = NULL; uds_lock_mutex(&writer->mutex); - if (writer->thread != 0) { + if (writer->thread != NULL) { writer_thread = writer->thread; - writer->thread = 0; + writer->thread = NULL; writer->stop = true; uds_broadcast_cond(&writer->cond); } uds_unlock_mutex(&writer->mutex); - if (writer_thread != 0) + if (writer_thread != NULL) uds_join_threads(writer_thread); } diff --git a/drivers/md/dm-vdo/vdo.c b/drivers/md/dm-vdo/vdo.c index 1ead769f0150..e0eddd4007b8 100644 --- a/drivers/md/dm-vdo/vdo.c +++ b/drivers/md/dm-vdo/vdo.c @@ -889,7 +889,8 @@ int vdo_synchronous_flush(struct vdo *vdo) int result; struct bio bio; - bio_init(&bio, vdo_get_backing_device(vdo), 0, 0, REQ_OP_WRITE | REQ_PREFLUSH); + bio_init(&bio, vdo_get_backing_device(vdo), NULL, 0, + REQ_OP_WRITE | REQ_PREFLUSH); submit_bio_wait(&bio); result = blk_status_to_errno(bio.bi_status); From patchwork Tue Feb 6 02:04:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Sakai X-Patchwork-Id: 13546525 X-Patchwork-Delegate: snitzer@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 45B275677B for ; Tue, 6 Feb 2024 02:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185069; cv=none; b=dHJW0Kt3HoamhqqS+Mef24AREdEGfVt05A0NayDroZx70vvU6fyOxKVvpOYoc/eXkV0wAQAPQaqBBUiPcxn/74BOlyjKhyfs6lKlE0rG+hNHctshg5smzAWaxunDLVR1m/ritcS0QYJSVOvLpIbGP73cPLiOg5f4mjtqWtoCVZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185069; c=relaxed/simple; bh=z06DROj/sqQ6Zum95kkdCP3FuvjNJXoMBbRSttq2uxY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VaoNyML3TTHfSzBHqOyJiNAaJrYkWvuKTDaSIa+PdRdrIj3y6nAvlPAc6GSJEbyvlBOzIGeoxaeFO39xfWAhVn9mGm02CH7ZOqP27XhgT3qKBEcdlzNaPJ193yyih6+jx9Wf8GF5E+ux4mQOylD65NF2Hi4lwxW05NgleEo/xCs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VFUNdS1a; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VFUNdS1a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707185065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7bhjFQlp5QV+6QlxdbpIcfz5Te4XJ3oKkLmlwC4OaJU=; b=VFUNdS1aZjlQmsCBRCSoZTUaqdXR8yEXxKTNdsC92uTsC0sv/dx61pZgtx3eBCXpCSayWl hv8JTEzkSffgejh2CcfKhFf7jof5iW+82iTnCO+/ghUTk1ttD/m7hBELORQLah3P1q1san GY0bOd26l7FIrF/NQ3doeXlg3Ip4J4A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-136-G3hLxbOwNb-nmtktxW3g7w-1; Mon, 05 Feb 2024 21:04:22 -0500 X-MC-Unique: G3hLxbOwNb-nmtktxW3g7w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A0D73835145; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: from vdo-builder-msakai.permabit.com (vdo-builder-msakai.permabit.lab.eng.bos.redhat.com [10.0.103.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B779492BC6; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: by vdo-builder-msakai.permabit.com (Postfix, from userid 1138) id 99010569FC; Mon, 5 Feb 2024 21:04:22 -0500 (EST) From: Matthew Sakai To: dm-devel@lists.linux.dev Cc: Mike Snitzer , Matthew Sakai Subject: [PATCH 3/7] dm vdo: fix various blk_opf_t sparse warnings Date: Mon, 5 Feb 2024 21:04:18 -0500 Message-ID: <4ebc72afc1322fb76e635d73cc9c9b36eaa98aed.1707184413.git.msakai@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Mike Snitzer Use proper blk_opf_t type rather than unsigned int. Signed-off-by: Mike Snitzer Signed-off-by: Susan LeGendre-McGhee Signed-off-by: Matthew Sakai --- drivers/md/dm-vdo/block-map.c | 2 +- drivers/md/dm-vdo/data-vio.c | 4 ++-- drivers/md/dm-vdo/io-submitter.c | 2 +- drivers/md/dm-vdo/io-submitter.h | 4 ++-- drivers/md/dm-vdo/vio.c | 4 ++-- drivers/md/dm-vdo/vio.h | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/md/dm-vdo/block-map.c b/drivers/md/dm-vdo/block-map.c index 1278a5791160..cc87e1ac72b6 100644 --- a/drivers/md/dm-vdo/block-map.c +++ b/drivers/md/dm-vdo/block-map.c @@ -1620,7 +1620,7 @@ static void write_initialized_page(struct vdo_completion *completion) struct block_map_zone *zone = pooled->context; struct tree_page *tree_page = completion->parent; struct block_map_page *page = (struct block_map_page *) vio->data; - unsigned int operation = REQ_OP_WRITE | REQ_PRIO; + blk_opf_t operation = REQ_OP_WRITE | REQ_PRIO; /* * Now that we know the page has been written at least once, mark the copy we are writing diff --git a/drivers/md/dm-vdo/data-vio.c b/drivers/md/dm-vdo/data-vio.c index 328b645dee16..e0f1574ae112 100644 --- a/drivers/md/dm-vdo/data-vio.c +++ b/drivers/md/dm-vdo/data-vio.c @@ -69,7 +69,7 @@ * ASAP to service heavy load, which is the only place where REQ_BACKGROUND might aid in load * prioritization. */ -static unsigned int PASSTHROUGH_FLAGS = (REQ_PRIO | REQ_META | REQ_SYNC | REQ_RAHEAD); +static blk_opf_t PASSTHROUGH_FLAGS = (REQ_PRIO | REQ_META | REQ_SYNC | REQ_RAHEAD); /** * DOC: @@ -1570,7 +1570,7 @@ static void read_block(struct vdo_completion *completion) result = vio_reset_bio(vio, (char *) data_vio->compression.block, read_endio, REQ_OP_READ, data_vio->mapped.pbn); } else { - int opf = ((data_vio->user_bio->bi_opf & PASSTHROUGH_FLAGS) | REQ_OP_READ); + blk_opf_t opf = ((data_vio->user_bio->bi_opf & PASSTHROUGH_FLAGS) | REQ_OP_READ); if (data_vio->is_partial) { result = vio_reset_bio(vio, vio->data, read_endio, opf, diff --git a/drivers/md/dm-vdo/io-submitter.c b/drivers/md/dm-vdo/io-submitter.c index 74f33a3ddce5..6c050f2b3b44 100644 --- a/drivers/md/dm-vdo/io-submitter.c +++ b/drivers/md/dm-vdo/io-submitter.c @@ -338,7 +338,7 @@ void vdo_submit_data_vio(struct data_vio *data_vio) */ void __submit_metadata_vio(struct vio *vio, physical_block_number_t physical, bio_end_io_t callback, vdo_action_fn error_handler, - unsigned int operation, char *data) + blk_opf_t operation, char *data) { int result; struct vdo_completion *completion = &vio->completion; diff --git a/drivers/md/dm-vdo/io-submitter.h b/drivers/md/dm-vdo/io-submitter.h index ddd5f4b391b6..80748699496f 100644 --- a/drivers/md/dm-vdo/io-submitter.h +++ b/drivers/md/dm-vdo/io-submitter.h @@ -26,11 +26,11 @@ void vdo_submit_data_vio(struct data_vio *data_vio); void __submit_metadata_vio(struct vio *vio, physical_block_number_t physical, bio_end_io_t callback, vdo_action_fn error_handler, - unsigned int operation, char *data); + blk_opf_t operation, char *data); static inline void vdo_submit_metadata_vio(struct vio *vio, physical_block_number_t physical, bio_end_io_t callback, vdo_action_fn error_handler, - unsigned int operation) + blk_opf_t operation) { __submit_metadata_vio(vio, physical, callback, error_handler, operation, vio->data); diff --git a/drivers/md/dm-vdo/vio.c b/drivers/md/dm-vdo/vio.c index 6acaba149c75..f9c54ec56176 100644 --- a/drivers/md/dm-vdo/vio.c +++ b/drivers/md/dm-vdo/vio.c @@ -172,7 +172,7 @@ void free_vio(struct vio *vio) /* Set bio properties for a VDO read or write. */ void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callback, - unsigned int bi_opf, physical_block_number_t pbn) + blk_opf_t bi_opf, physical_block_number_t pbn) { struct vdo *vdo = vio->completion.vdo; struct device_config *config = vdo->device_config; @@ -193,7 +193,7 @@ void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callb * vio associated with the bio. */ int vio_reset_bio(struct vio *vio, char *data, bio_end_io_t callback, - unsigned int bi_opf, physical_block_number_t pbn) + blk_opf_t bi_opf, physical_block_number_t pbn) { int bvec_count, offset, len, i; struct bio *bio = vio->bio; diff --git a/drivers/md/dm-vdo/vio.h b/drivers/md/dm-vdo/vio.h index 71585424f85b..fbfee5e3415d 100644 --- a/drivers/md/dm-vdo/vio.h +++ b/drivers/md/dm-vdo/vio.h @@ -119,10 +119,10 @@ static inline void initialize_vio(struct vio *vio, struct bio *bio, } void vdo_set_bio_properties(struct bio *bio, struct vio *vio, bio_end_io_t callback, - unsigned int bi_opf, physical_block_number_t pbn); + blk_opf_t bi_opf, physical_block_number_t pbn); int vio_reset_bio(struct vio *vio, char *data, bio_end_io_t callback, - unsigned int bi_opf, physical_block_number_t pbn); + blk_opf_t bi_opf, physical_block_number_t pbn); void update_vio_error_stats(struct vio *vio, const char *format, ...) __printf(2, 3); From patchwork Tue Feb 6 02:04:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Sakai X-Patchwork-Id: 13546526 X-Patchwork-Delegate: snitzer@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 779F056B63 for ; Tue, 6 Feb 2024 02:04:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185069; cv=none; b=I225LNH2D9C7wo6Lsn1hSPY7lEPwPPvfhPPFJ4bG6MczE4iNr4a8rksFVcSL4robLUgpSdW1y4+GobFFAcmUzVKz4Em1NOBvILhNC/pAvnAuVR/EwXQzJVg+1EVm0OybfTrCe0iQSuRkiCCfeySoYDoQxYk6DPJrJpK4gIc2aMw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185069; c=relaxed/simple; bh=QjCEwke2q8md+7XYXgP0M4hWqJ6rqzuJXuo/F2COq6Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Cpn8jEGxbq5DZrHATUixzQg4Dpwkz+5oL8/8TWRRJpeHB+R0VmtybqNKxDlftMl7xmRrmw5PInPo2wRESl9pXeypElvMlMyGsla8otit7GzS6Mqc39EbiReLZK60rCyA05F0mRlkG8bjxAHt5lpyRPWglzDd1WYZNIhzS9VNb4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Na7epnFr; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Na7epnFr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707185066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NsTg64+GPsxKmgqRI9XjEW4h5kvap/d+2pnLf1r3Y6A=; b=Na7epnFrMFZLylLNvA5KHwOamsmsgsxqIa2hzxkdvJeTpesCtDfULdi7nFuP2fckhjCGvM SoKvomq7GW9M+7S0J8TgS5CpnQcdIMUWOFtwMDIdlnOnlgCZpiyoH76geqH4CzVxdDnrNI yfAr6xm9TbXiUw/hAUrVzJqeFeZdO5Q= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-73-anSpZxPlOcOmy9gCheYTHw-1; Mon, 05 Feb 2024 21:04:23 -0500 X-MC-Unique: anSpZxPlOcOmy9gCheYTHw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4F0884ACA2; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: from vdo-builder-msakai.permabit.com (vdo-builder-msakai.permabit.lab.eng.bos.redhat.com [10.0.103.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FE37492BC7; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: by vdo-builder-msakai.permabit.com (Postfix, from userid 1138) id 9E759569FE; Mon, 5 Feb 2024 21:04:22 -0500 (EST) From: Matthew Sakai To: dm-devel@lists.linux.dev Cc: Mike Snitzer , Matthew Sakai Subject: [PATCH 4/7] dm vdo data-vio: silence sparse warnings about locking context imbalances Date: Mon, 5 Feb 2024 21:04:19 -0500 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Mike Snitzer Factor wait_permit() out from acquire_permit() so that the latter always holds the spinlock and the former always releases it. Otherwise sparse complains about locking context imbalances due to conditional spin_unlock in acquire_permit: warning: context imbalance in 'acquire_permit' - different lock contexts for basic block warning: context imbalance in 'vdo_launch_bio' - unexpected unlock Signed-off-by: Mike Snitzer Signed-off-by: Susan LeGendre-McGhee Signed-off-by: Matthew Sakai --- drivers/md/dm-vdo/data-vio.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/md/dm-vdo/data-vio.c b/drivers/md/dm-vdo/data-vio.c index e0f1574ae112..d77adeb5006e 100644 --- a/drivers/md/dm-vdo/data-vio.c +++ b/drivers/md/dm-vdo/data-vio.c @@ -929,27 +929,30 @@ void free_data_vio_pool(struct data_vio_pool *pool) uds_free(pool); } -static bool acquire_permit(struct limiter *limiter, struct bio *bio) +static bool acquire_permit(struct limiter *limiter) { - if (limiter->busy >= limiter->limit) { - DEFINE_WAIT(wait); - - bio_list_add(&limiter->new_waiters, bio); - prepare_to_wait_exclusive(&limiter->blocked_threads, &wait, - TASK_UNINTERRUPTIBLE); - spin_unlock(&limiter->pool->lock); - io_schedule(); - finish_wait(&limiter->blocked_threads, &wait); + if (limiter->busy >= limiter->limit) return false; - } WRITE_ONCE(limiter->busy, limiter->busy + 1); if (limiter->max_busy < limiter->busy) WRITE_ONCE(limiter->max_busy, limiter->busy); - return true; } +static void wait_permit(struct limiter *limiter, struct bio *bio) + __releases(&limiter->pool->lock) +{ + DEFINE_WAIT(wait); + + bio_list_add(&limiter->new_waiters, bio); + prepare_to_wait_exclusive(&limiter->blocked_threads, &wait, + TASK_UNINTERRUPTIBLE); + spin_unlock(&limiter->pool->lock); + io_schedule(); + finish_wait(&limiter->blocked_threads, &wait); +} + /** * vdo_launch_bio() - Acquire a data_vio from the pool, assign the bio to it, and launch it. * @@ -965,11 +968,15 @@ void vdo_launch_bio(struct data_vio_pool *pool, struct bio *bio) bio->bi_private = (void *) jiffies; spin_lock(&pool->lock); if ((bio_op(bio) == REQ_OP_DISCARD) && - !acquire_permit(&pool->discard_limiter, bio)) + !acquire_permit(&pool->discard_limiter)) { + wait_permit(&pool->discard_limiter, bio); return; + } - if (!acquire_permit(&pool->limiter, bio)) + if (!acquire_permit(&pool->limiter)) { + wait_permit(&pool->limiter, bio); return; + } data_vio = get_available_data_vio(pool); spin_unlock(&pool->lock); From patchwork Tue Feb 6 02:04:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Sakai X-Patchwork-Id: 13546520 X-Patchwork-Delegate: snitzer@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 7001356765 for ; Tue, 6 Feb 2024 02:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; cv=none; b=O7kD7Qp6COYllNkIxRbu+JfwaersVcd3u81aJszeFNmoJak5pxfLg1eP38GcRM5emzL8ztf97Cw+ng2flwV29+uop0I/1BfTPBkqv27gZHj+0fVed52dw05nHb7Fx2aI5qP6lg40kDDCciqvMtsjGqs3H8RvWXC0UCciW72xd1s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; c=relaxed/simple; bh=kaLt7Xjw5pOeaAn32AUOavZUw1BiWLUToNB19RR9+Ls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FS6fAFU3NKPwdvio9eyU0GahbDeE7XfhAeWT7GwkbrMw+gvuh9IotJ2ZkN4QGZJ1GR5GATIPdIC9b0p6HFs23/qcy5UiWjtCDdF6wQtlHiCFt3r+cY5+upAWJgxlBQk6k3caKEvAs1S2B86TusoCL/VI5yO/w6IRPX1jX9N+Zi8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CN0mBD+V; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CN0mBD+V" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707185064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sRAaR/4uefbevI7lF7wpXRy1a6wT1HiIk/2urx412w0=; b=CN0mBD+V6SlVQmpW1i8v21ATkibqEb19ii02C3Rzv/kor/riJv4XTf0TCcN6svV/nKNe79 pTceS37JqdvDjzC08zLbHo9SU2Otk7Pse9cGDlsQGbGf3h7Yk7X6o+S1bTDMSz9KXYx+qB xfvrEGmIFSlSoiFalgb1elI2k5Ri3WA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-73-HYbpI2QjM3ehCAkTeYpeLQ-1; Mon, 05 Feb 2024 21:04:23 -0500 X-MC-Unique: HYbpI2QjM3ehCAkTeYpeLQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD6C21C09825; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: from vdo-builder-msakai.permabit.com (vdo-builder-msakai.permabit.lab.eng.bos.redhat.com [10.0.103.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5FABC15E61; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: by vdo-builder-msakai.permabit.com (Postfix, from userid 1138) id A386F56A00; Mon, 5 Feb 2024 21:04:22 -0500 (EST) From: Matthew Sakai To: dm-devel@lists.linux.dev Cc: Mike Snitzer , Matthew Sakai Subject: [PATCH 5/7] dm vdo dedupe: silence sparse warnings about locking context imbalances Date: Mon, 5 Feb 2024 21:04:20 -0500 Message-ID: <8cb7d0b05fa3b51d9923a05d1aeb213f28ba5eeb.1707184413.git.msakai@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Mike Snitzer Annotate both open_index() and close_index() with __must_hold(&zones->lock) to silence these sparse warnings: warning: context imbalance in 'close_index' - unexpected unlock warning: context imbalance in 'open_index' - unexpected unlock Signed-off-by: Mike Snitzer Signed-off-by: Susan LeGendre-McGhee Signed-off-by: Matthew Sakai --- drivers/md/dm-vdo/dedupe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm-vdo/dedupe.c b/drivers/md/dm-vdo/dedupe.c index 8533f1669a01..4b00135511dd 100644 --- a/drivers/md/dm-vdo/dedupe.c +++ b/drivers/md/dm-vdo/dedupe.c @@ -2092,6 +2092,7 @@ static void finish_uds_queue(void *ptr __always_unused) } static void close_index(struct hash_zones *zones) + __must_hold(&zones->lock) { int result; @@ -2113,6 +2114,7 @@ static void close_index(struct hash_zones *zones) } static void open_index(struct hash_zones *zones) + __must_hold(&zones->lock) { /* ASSERTION: We enter in IS_CLOSED state. */ int result; From patchwork Tue Feb 6 02:04:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Sakai X-Patchwork-Id: 13546522 X-Patchwork-Delegate: snitzer@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 CDD525676F for ; Tue, 6 Feb 2024 02:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; cv=none; b=aaxCynLhHHGpW0HnlHy73P5mMtJpira2OuN1r6ATJgx286vKgwiKwpEnl1PNcIx2S+JsueQXPDVSY64DxgXQPCSdkMCYyxjhpPehbcx77UqUetWGmFyVzDoen+Snclwg/gaLy3FNMNSycyReVRVvm9gUDDW7MkHoZ5wwoPiabO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; c=relaxed/simple; bh=9lxeS38XCTby4oJyeVz6gQP9cWYCtulttXM+6kSXcIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e8o4kcFgjxtJwW5D9GXYuVVvs+vPKoWFwk6dYGdlLxDCw+9Y1OGtRkt65GlMNTUj1FUd/MekUd8VpMcE0Q8Yrj7H/NwI/Z2kO140sT6xJVIafvwizHpvGjtBrC8BjEbKr8CCO95k6W8pscsqIH1ZMX2pYfuJ8aULdOyFno+QeaU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DaKpyksl; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DaKpyksl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707185064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7WnUIAtQDifd54KL6mFjc90R3SFnvGSNMhvNMhBfIlU=; b=DaKpykslWyt4vAQrA9MOVGAT4Iz3DMK7th/ZMLmle+Xu8GYnPZEJfovREactqkdSJj1cNo 1EgbeniHGxxFMeImoxMRqDMcA0mK0JbMzEr3/AmHQq/epyrOMXgMRR/p/c0IJY8QnJXUzM 7Yg3eawuSqDWbsUeW7bTjsuEiqxbARs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-136-b3DQYp_dMcalH_3lGPSTvQ-1; Mon, 05 Feb 2024 21:04:23 -0500 X-MC-Unique: b3DQYp_dMcalH_3lGPSTvQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B180187B2A1; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: from vdo-builder-msakai.permabit.com (vdo-builder-msakai.permabit.lab.eng.bos.redhat.com [10.0.103.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABEA2492BF0; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: by vdo-builder-msakai.permabit.com (Postfix, from userid 1138) id A92DF56A02; Mon, 5 Feb 2024 21:04:22 -0500 (EST) From: Matthew Sakai To: dm-devel@lists.linux.dev Cc: Mike Snitzer , Matthew Sakai Subject: [PATCH 6/7] dm vdo recovery-journal: fix sparse 'mixed bitwiseness' warning Date: Mon, 5 Feb 2024 21:04:21 -0500 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Mike Snitzer Only one user of WRITE_FLAGS so no need to factor it out in an enum (which causes sparse's 'mixed bitwiseness' warning). Just use the flags in the only consumer. Signed-off-by: Mike Snitzer Signed-off-by: Susan LeGendre-McGhee Signed-off-by: Matthew Sakai --- drivers/md/dm-vdo/recovery-journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-vdo/recovery-journal.c b/drivers/md/dm-vdo/recovery-journal.c index a6981e5dd017..1e15bfe42cfc 100644 --- a/drivers/md/dm-vdo/recovery-journal.c +++ b/drivers/md/dm-vdo/recovery-journal.c @@ -34,7 +34,6 @@ enum { */ RECOVERY_JOURNAL_RESERVED_BLOCKS = (MAXIMUM_VDO_USER_VIOS / RECOVERY_JOURNAL_ENTRIES_PER_BLOCK) + 2, - WRITE_FLAGS = REQ_OP_WRITE | REQ_PRIO | REQ_PREFLUSH | REQ_SYNC | REQ_FUA, }; /** @@ -1398,7 +1397,8 @@ static void write_block(struct vdo_waiter *waiter, void *context __always_unused * block itself is stable before allowing overwrites of the lbn's previous data. */ vdo_submit_metadata_vio(&block->vio, journal->origin + block->block_number, - complete_write_endio, handle_write_error, WRITE_FLAGS); + complete_write_endio, handle_write_error, + REQ_OP_WRITE | REQ_PRIO | REQ_PREFLUSH | REQ_SYNC | REQ_FUA); } From patchwork Tue Feb 6 02:04:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Sakai X-Patchwork-Id: 13546523 X-Patchwork-Delegate: snitzer@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 6FFE85675F for ; Tue, 6 Feb 2024 02:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; cv=none; b=FiFD2lTeY8q01iTxmJOO44ct54u+CUNYuDHWPMO1ROFORnDJe93OfF+7SHH0Q+auLSrBJaAj0PLAYell8XI71qk3OdYUU8shCY/OcZOhn/LEl70T+Ml7Os1iGHQyPidfA1qZSaA6l4fP+5xA26t3YAFwtspT7HzzhbfY7leYHW0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185067; c=relaxed/simple; bh=QMz9nCGnPyoYGriR7tLD/u/8j7df1eNbdyr4kg/5g2U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uSuJm80TWmMb2Ok5SqbMjLU+JAPSVgoB/xukJ4pW5u++oHY0uzUCROKkcp5s32Nq3hElKVBxTsJruI+LwCU9sw8tc+dIbrj0C4QaSAKQdMVnUxgw1vJvmXHIKnaU6HYFpWmqMZMFm5ubfaQrUtWt5khrLq5/lu2nvKm8kk52TME= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=S8XU+nej; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="S8XU+nej" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707185064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FPXamWO6dyaLKK0XGPvP4+Jj0w019gpKIhXbvupHH+0=; b=S8XU+nejJQ0ftXUtTh9KWh66OEjn5keCWvXPNpFdIvOxOhUm8wgv6nanQjDi77kmJHaBg2 MLUqx7BbbjsNtib+HKOe/6Y2Yaw0xYoQIJKy3APhl8LnODcb2iOMFzydSWXbSZRALdZ7lY zEOw0Xxyr5XzUo3bQIlejHbHtmHjmbg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-449-IE6NhQUwM1W9yxfnLpvd7Q-1; Mon, 05 Feb 2024 21:04:23 -0500 X-MC-Unique: IE6NhQUwM1W9yxfnLpvd7Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B466785A58C for ; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: from vdo-builder-msakai.permabit.com (vdo-builder-msakai.permabit.lab.eng.bos.redhat.com [10.0.103.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF973492BFA; Tue, 6 Feb 2024 02:04:22 +0000 (UTC) Received: by vdo-builder-msakai.permabit.com (Postfix, from userid 1138) id AE4CC56A04; Mon, 5 Feb 2024 21:04:22 -0500 (EST) From: Matthew Sakai To: dm-devel@lists.linux.dev Cc: Susan LeGendre-McGhee , Matthew Sakai Subject: [PATCH 7/7] dm vdo: move encoding constants to encodings.h Date: Mon, 5 Feb 2024 21:04:22 -0500 Message-ID: <6f22c72513105c9bb05c71dc34be57b9c37a5f16.1707184413.git.msakai@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Susan LeGendre-McGhee Signed-off-by: Susan LeGendre-McGhee Signed-off-by: Matthew Sakai --- drivers/md/dm-vdo/constants.h | 12 +++--------- drivers/md/dm-vdo/encodings.h | 6 ++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/md/dm-vdo/constants.h b/drivers/md/dm-vdo/constants.h index 3a997dd7d0b1..24237bc29f87 100644 --- a/drivers/md/dm-vdo/constants.h +++ b/drivers/md/dm-vdo/constants.h @@ -44,6 +44,9 @@ enum { /** The default size of each slab journal, in blocks */ DEFAULT_VDO_SLAB_JOURNAL_SIZE = 224, + /** Unit test minimum */ + MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2, + /* * The initial size of lbn_operations and pbn_operations, which is based upon the expected * maximum number of outstanding VIOs. This value was chosen to make it highly unlikely @@ -90,13 +93,4 @@ enum { VDO_ZERO_BLOCK = 0, }; -/** The maximum logical space is 4 petabytes, which is 1 terablock. */ -static const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS = 1024ULL * 1024 * 1024 * 1024; - -/** The maximum physical space is 256 terabytes, which is 64 gigablocks. */ -static const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS = 1024ULL * 1024 * 1024 * 64; - -/** unit test minimum */ -static const block_count_t MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2; - #endif /* VDO_CONSTANTS_H */ diff --git a/drivers/md/dm-vdo/encodings.h b/drivers/md/dm-vdo/encodings.h index 260822a3958a..bfc397a72f9f 100644 --- a/drivers/md/dm-vdo/encodings.h +++ b/drivers/md/dm-vdo/encodings.h @@ -609,6 +609,12 @@ struct vdo_config { block_count_t slab_journal_blocks; /* number of slab journal blocks */ }; +/** The maximum logical space is 4 petabytes, which is 1 terablock. */ +static const block_count_t MAXIMUM_VDO_LOGICAL_BLOCKS = 1024ULL * 1024 * 1024 * 1024; + +/** The maximum physical space is 256 terabytes, which is 64 gigablocks. */ +static const block_count_t MAXIMUM_VDO_PHYSICAL_BLOCKS = 1024ULL * 1024 * 1024 * 64; + /* This is the structure that captures the vdo fields saved as a super block component. */ struct vdo_component { enum vdo_state state;