From patchwork Mon Oct 31 11:45:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2262991wru; Mon, 31 Oct 2022 04:48:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QuW7O7/QdgHWKKBDs4l+1FzPpdE3XbDLBnm5wsB0YzF4EO/dnY2qnU6sVo/eHKTctn6we X-Received: by 2002:a17:907:968b:b0:78d:f5c2:70d8 with SMTP id hd11-20020a170907968b00b0078df5c270d8mr12163193ejc.564.1667216888223; Mon, 31 Oct 2022 04:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667216888; cv=none; d=google.com; s=arc-20160816; b=lMCcXXJ+8befmW/fLuaKen8leOTgPaBSAFmifa3T5ScxT+QdEGjnkiWKsGj2JJvrQk r+HSq5ws8xQmAv1w4r80ff4mon5VeXCRp88N6fwsJ1ylr7Ov/PP9JlikMrdEx650jePO 8ERouE43+jHAvgLAgnR9O3eUSX9TfZjsZgP5EynX+K5Kac+Ps99k6QEVMUm3fQNrM3F/ z0cjANMiH4NQ9M4s6m9/zFZbuzSRZfakQw8r6vvaiYIPULxgo9V63dwumci01jKazxi+ h7NmiayjYwEeWAaEKb/+EOhoaAPvNVBv1qGeyw5KX3/b1U+tDLiVHNVEWukSI3w1Nh1O 1sbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=0iKJXqoHSlwS8vEZQq8a9M+jZZbmGeDzJGf+xlQtrOE=; b=Q88pMmfPRE1HGD0IlFNJ8azs+D8ledCJR5Ktjwhq7hoTl8sPCsUuuVKs93tKB5Mm8n 2xkDiM1Y7niR4nCdKmI2kKPnyu/creoXlpnEgRZaCY24wK/zlRnpQK5V7EcfDmETI19L q5EIgtqrnnjxHgUsS6AGFqJ1X0ocMRZy4FTfAflSnS0eDly/nOgNhUQSzvHsyb+sMmXT hqbfe1J2W2PNFJ0V/Cv5V7AswQIJxsz7+b1tkXHECedfN5aWE2ePKuRLm9r2z0oM6nkJ Xfa+EOEJc69ZehO0oOafI+hISvSniYF8kf1nP9ycIXSnZWU1hAuQFsBxdQsJ/OIFEV7h nEFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=di1R1BCG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a50eb0c000000b00461ebe2a168si6704877edp.447.2022.10.31.04.47.44; Mon, 31 Oct 2022 04:48:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=di1R1BCG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbiJaLqC (ORCPT + 99 others); Mon, 31 Oct 2022 07:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231204AbiJaLpk (ORCPT ); Mon, 31 Oct 2022 07:45:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BD1CF023; Mon, 31 Oct 2022 04:45:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AE1A0CE134C; Mon, 31 Oct 2022 11:45:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09213C433D6; Mon, 31 Oct 2022 11:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667216723; bh=/nzQwQ7t8fEd/Xbji8T5TlBeyziGmIQJxHg8N9W/ml4=; h=From:To:Cc:Subject:Date:From; b=di1R1BCGvDv5KIfYWJ/0WhYLVQzNM99ivj4PXRekT4VkQArg598dXS6df8fUPt/qy PL7JlHCF5TrQNlt3ISUO9gHqjDWWpnPw59eVNi+FnE3fdzrdJwgelZYr/afK5L3XED 1pzWTJ7nkI2/uAXIJxOcL0Dav5rcI9YuEo0A+RLi4JgST/jFmnjJP01UiUjrVDVT+P mVRYq+GU/7y1c+/YSLmuUlnkBzD0IB9LQH5DMOAhzOis2HHkm43zRFeUMhdJMxH5ST yhcLFqhAA7VpSOeTeuObjthPMQHzBdvW3rwzZFb8ml+x7C9qatEeJXaez50ykda6cH q+lcUjCfNPo/g== From: "Jiri Slaby (SUSE)" To: tj@kernel.org Cc: linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Martin Liska , Josef Bacik , Jens Axboe , cgroups@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints Date: Mon, 31 Oct 2022 12:45:20 +0100 Message-Id: <20221031114520.10518-1-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748203615672295278?= X-GMAIL-MSGID: =?utf-8?q?1748203615672295278?= Since gcc13, each member of an enum has the same type as the enum [1]. And that is inherited from its members. Provided: VTIME_PER_SEC_SHIFT = 37, VTIME_PER_SEC = 1LLU << VTIME_PER_SEC_SHIFT, the named type is unsigned long. This generates warnings with gcc-13: block/blk-iocost.c: In function 'ioc_weight_prfill': block/blk-iocost.c:3037:37: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' block/blk-iocost.c: In function 'ioc_weight_show': block/blk-iocost.c:3047:34: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' Cast the enum members to int when printing them. Alternatively, we can cast them to ulong (to silence gcc < 12) and use %lu. Alternatively, we can move VTIME_PER_SEC away from the enum. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113 Cc: Martin Liska Cc: Tejun Heo Cc: Josef Bacik Cc: Jens Axboe Cc: cgroups@vger.kernel.org Cc: linux-block@vger.kernel.org Signed-off-by: Jiri Slaby (SUSE) --- block/blk-iocost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index f01359906c83..a257ba17183b 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -3034,7 +3034,8 @@ static u64 ioc_weight_prfill(struct seq_file *sf, struct blkg_policy_data *pd, struct ioc_gq *iocg = pd_to_iocg(pd); if (dname && iocg->cfg_weight) - seq_printf(sf, "%s %u\n", dname, iocg->cfg_weight / WEIGHT_ONE); + seq_printf(sf, "%s %d\n", dname, + iocg->cfg_weight / (int)WEIGHT_ONE); return 0; } @@ -3044,7 +3045,8 @@ static int ioc_weight_show(struct seq_file *sf, void *v) struct blkcg *blkcg = css_to_blkcg(seq_css(sf)); struct ioc_cgrp *iocc = blkcg_to_iocc(blkcg); - seq_printf(sf, "default %u\n", iocc->dfl_weight / WEIGHT_ONE); + seq_printf(sf, "default %d\n", + iocc->dfl_weight / (int)WEIGHT_ONE); blkcg_print_blkgs(sf, blkcg, ioc_weight_prfill, &blkcg_policy_iocost, seq_cft(sf)->private, false); return 0;