From patchwork Tue Sep 12 19:15:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 138397 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp632101vqx; Tue, 12 Sep 2023 12:26:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGj32PILXaT0GR6FVElqA+T6RD1CHE2fSem6U7nhPFdttjDY79kqt1dDcn6bPI+NZ1wbym2 X-Received: by 2002:a17:903:22c5:b0:1c3:cee1:cc8e with SMTP id y5-20020a17090322c500b001c3cee1cc8emr687973plg.68.1694546780176; Tue, 12 Sep 2023 12:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694546780; cv=none; d=google.com; s=arc-20160816; b=z2tNBo1T/8qBak7qR6jsu9ndumQorncMvnbD6KBljmT/TkkUGxhd90iL/LwLJM9tdI 9jhWGm8mAytFgtLaZ+hUoOyHcg0fHBFd++oig3CHp2owyPxHw7ZZxyLfelfnCwwfi6GC Xavpnc0MBF2Fc+Wor0kkOAEnhoxWWvDiMlBXXnx+zEy9ogzdhsPeMy4rXm2E8b4R/wWF xKwqQ1U+clZYWWbSvzL8lcMmV4dfZzPBEUZW70Mb/aQSP0rfEPVC5X1fjYUHYVTWl3I9 zz8qwPFJ3J2iQAC2+a8Iyl2lqdeGjAskL/O3dxKOceHhs3j69iaWqc1SRC0Igxzf1R/a MooQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=q3V/k759hU7123W2WE46ESQD+om3+QYIOciZJmKadW0=; fh=LKcvcjZf5PsjROekZNw7xjJ5nIYaOTDvnGnvjnjiGNw=; b=TWzpoLQpFhFb2o6H95EcTRHzNnlqxRmYhxKIEv0db584Avr+IIzOD8n1acgdf5+ff3 jaKzAI9gix1Hvs0O0cfpr2Tuwuo7bzyLun7thj1uHQwjA890YUxaBV3rvgQTiDlBzlSO p5cYq3L/Az99yJnv2f+afgdv+4I8mABhKF0lFBG0r8j2J/swAGApVQEs5AU5dJmeb1cU V0mpK5KZTP70cc4/G2iJ3kt/On6h5rV//iOc+yAehRgB+qlpqjrS04dBpVR9+jHjXAb3 2gJh1k7RDtE6A0pbJT2DfOsMRl5GU+o7dHSjHTjM3RebUOby3xQLAFutanV+sxMsvj1u BTSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="AH/84kA7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id o2-20020a170902d4c200b001b8698149fbsi452604plg.477.2023.09.12.12.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 12:26:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="AH/84kA7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 12BD78095F6F; Tue, 12 Sep 2023 12:16:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237670AbjILTQ1 (ORCPT + 36 others); Tue, 12 Sep 2023 15:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbjILTQJ (ORCPT ); Tue, 12 Sep 2023 15:16:09 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DE71B2; Tue, 12 Sep 2023 12:16:05 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACFB3C433CD; Tue, 12 Sep 2023 19:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694546165; bh=mr+NsehKtc1BM6Zeb//Yv+u2js+H8NOBbn0lM+STLiQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AH/84kA77EldxqpYgZUOTgWE/L6f+l0bWErarIiliOr5C9rkQ/l4NAu9RJUy4djrF /8qxmyozJjvcZan2n1MtDOF0w/5F6dW5iDf2slA3LbFK4y7ZDYe97+I54ynPK3tks4 EU1Ksvzv0GBR+sYTwq3LhgcI2DsCtdDBsJo1LDfRsjopqcs8up1trLemS3kcwYhnNr KHaYos6HAw0aR5qhYOqiY1LiKUpLvlXNf/3Y/dZPUI8K0EXBuFG4iZampU/LzfP/Bi Hj/aR8J/WDAX+PaN1o7eZ6MUKlLtdxMmwVARuiRIfKdlBMf/dFeR+feVpSMfGm+82I N8wdIvCvKNaHw== From: Nathan Chancellor Date: Tue, 12 Sep 2023 12:15:44 -0700 Subject: [PATCH 7/7] bcachefs: Fix -Wcompare-distinct-pointer-types in bch2_copygc_get_buckets() MIME-Version: 1.0 Message-Id: <20230912-bcachefs-warning-fixes-v1-7-a1cc83a38836@kernel.org> References: <20230912-bcachefs-warning-fixes-v1-0-a1cc83a38836@kernel.org> In-Reply-To: <20230912-bcachefs-warning-fixes-v1-0-a1cc83a38836@kernel.org> To: kent.overstreet@linux.dev Cc: bfoster@redhat.com, linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor X-Mailer: b4 0.13-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2289; i=nathan@kernel.org; h=from:subject:message-id; bh=mr+NsehKtc1BM6Zeb//Yv+u2js+H8NOBbn0lM+STLiQ=; b=owGbwMvMwCEmm602sfCA1DTG02pJDKkMOz4s5HJeOSmEcY/TU4mXthwf5hqbWnN/dO6+vUjMa Wae1tF3HaUsDGIcDLJiiizVj1WPGxrOOct449QkmDmsTCBDGLg4BWAiqzYw/E+Jeldxm7dK02Kq +tId+4pkGN+x+6StDN31tcMjUp3jph4jw+45IsYvDMJmb9qafOn8k36LexPVS/8sm9ZX+P5Q4hr zVdwA X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Sep 2023 12:16:42 -0700 (PDT) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776861084465881461 X-GMAIL-MSGID: 1776861084465881461 When building bcachefs for 32-bit ARM, there is a warning when using max() to compare an expression involving 'size_t' with an 'unsigned long' literal: fs/bcachefs/movinggc.c:159:21: error: comparison of distinct pointer types ('typeof (16UL) *' (aka 'unsigned long *') and 'typeof (buckets_in_flight->nr / 4) *' (aka 'unsigned int *')) [-Werror,-Wcompare-distinct-pointer-types] 159 | size_t nr_to_get = max(16UL, buckets_in_flight->nr / 4); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:76:19: note: expanded from macro 'max' 76 | #define max(x, y) __careful_cmp(x, y, >) | ^~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:38:24: note: expanded from macro '__careful_cmp' 38 | __builtin_choose_expr(__safe_cmp(x, y), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:28:4: note: expanded from macro '__safe_cmp' 28 | (__typecheck(x, y) && __no_side_effects(x, y)) | ^~~~~~~~~~~~~~~~~ include/linux/minmax.h:22:28: note: expanded from macro '__typecheck' 22 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) | ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ 1 error generated. On 64-bit architectures, size_t is 'unsigned long', so there is no warning when comparing these two expressions. Use max_t(size_t, ...) for this situation, eliminating the warning. Fixes: dd49018737d4 ("bcachefs: Rhashtable based buckets_in_flight for copygc") Signed-off-by: Nathan Chancellor Reviewed-by: Justin Stitt --- fs/bcachefs/movinggc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c index 256431a6dc0c..1cb441d90b34 100644 --- a/fs/bcachefs/movinggc.c +++ b/fs/bcachefs/movinggc.c @@ -156,7 +156,7 @@ static int bch2_copygc_get_buckets(struct btree_trans *trans, struct bch_fs *c = trans->c; struct btree_iter iter; struct bkey_s_c k; - size_t nr_to_get = max(16UL, buckets_in_flight->nr / 4); + size_t nr_to_get = max_t(size_t, 16U, buckets_in_flight->nr / 4); size_t saw = 0, in_flight = 0, not_movable = 0, sectors = 0; int ret;