From patchwork Sun Oct 29 10:30:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 159350 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1615897vqb; Sun, 29 Oct 2023 03:30:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEJbhTR6dLIju8cmXOLWjDDnOzY2RpL0n9EaTHR/5KNXkTO1O0ST8Wpz9GgcHsZs+NnzBc X-Received: by 2002:a05:6e02:1b81:b0:357:61d7:200f with SMTP id h1-20020a056e021b8100b0035761d7200fmr12104556ili.12.1698575449560; Sun, 29 Oct 2023 03:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698575449; cv=none; d=google.com; s=arc-20160816; b=XWNIeIdxjM1uH9HfbW4Dus/z30LYYUt4qv2EACHkj08adOMU9YAapnZdHFol4LGinM 4tNvohutlsf/Ilv9Gidp0P8AhLtF5rIjBV+7Boap2W2DYl/ZyEGy3+M0A3pe0L7LHIPd EwYlaAOYe8tkX346KIMSy3e/zpOKgK6F2GITExqVrYx1gsCPO7JPyv5yuAxpbbhzycc7 1oCzvwdrDJXY5pbEr9CXhv2xcdkUzElevjn6CrrRQhGPdlOtOz3bCLC+0n5xUFh/2ly3 LP6Aun+OGLNOn5vm5pfGvTiLmQmVPlzwQzpgyZKhTTOkyv8JUnJxi/ov2wXtkb6CI21g SoNQ== 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=0csRcwC0zp8g1RspI9Q/JAaWFLGDVf/EQzQzOfWYg+A=; fh=FFVJX7ewqZXmvan3wkRguG1ekK6uSMIMCpDt/Co9YDo=; b=aP8a1zyHLmQBEDNbq6IgBnjG5HSfxpZf/Yn7gTWzoJ5xEgk1sgOz6N2ixtfwF7zbVH nyvRgUTsxEUxaJabRNjzikYZ5Wi+Nt4tsyiMLeAaycZGZ3+HzHrvGdyzGgm/Wuwes4bi yI3f65jNu1qZPfec2ZsUw47HqEU9/DXrE4etIesKO7FF7MbBXumMydApTFEkbJtDNPrC 5kHK7OGL21vyjFOH8QQ+e5APDr1F6ze5x69OIslLDAkO6+IWMMcyF6PAEWwZP5mUL3mN zPlqfWQw42GGDdN2xBbnYTSzRBekeY6Zw21jJQaLe7h1/dmBzTM6GA5VwyrcnegoqCiH WKnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=l4AlWDnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b4-20020aa79504000000b006bf6b23d6d9si3394555pfp.400.2023.10.29.03.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 03:30:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=l4AlWDnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5609D806500B; Sun, 29 Oct 2023 03:30:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229533AbjJ2KaU (ORCPT + 30 others); Sun, 29 Oct 2023 06:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjJ2KaS (ORCPT ); Sun, 29 Oct 2023 06:30:18 -0400 Received: from smtp.smtpout.orange.fr (smtp-15.smtpout.orange.fr [80.12.242.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53B51C0 for ; Sun, 29 Oct 2023 03:30:14 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id x33bqUCJFRr5vx33bqsdPz; Sun, 29 Oct 2023 11:30:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1698575412; bh=0csRcwC0zp8g1RspI9Q/JAaWFLGDVf/EQzQzOfWYg+A=; h=From:To:Cc:Subject:Date; b=l4AlWDncAlsOegFIom9cmvrcSzm61IG9iUnUK/WhCAuIU8SYLlBwbE6Bi8C5v6mLl aotEEC7COAl/0mAxBJiHOm9At/fyciMjWxe9nvB8MIO+aRxeL66M2XCY6pUza46weX 5pw0L1yFqbT24nfpdS08DO1URE2pwg6PdF6f0nkYMg9luatsVfrHSsKtVxjkuhco0s o1J0opi6YXidPzGMQX5GTnJz4S1AOAJeXKjXHbPz9dZx5UNoasgTk8rOkCD8VkiiaH WCSffMQxUyvXrScCqhIwugWUXs9F/j0RsaFaTguyjQJnDrpG5cakgRFuL9hbiKySek 9EsoPN930QBAA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 29 Oct 2023 11:30:12 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Coly Li , Kent Overstreet Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-bcache@vger.kernel.org Subject: [PATCH] bcache: Optimize sysfs_hprint() Date: Sun, 29 Oct 2023 11:30:06 +0100 Message-Id: <9b82413f1ca0b924cc139d945777e32dd22ffe41.1698575385.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Sun, 29 Oct 2023 03:30:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781085450317244862 X-GMAIL-MSGID: 1781085450317244862 The size of what is in 'buf' is already computed by bch_hprint(), so skip these bytes when calling strcat(). This easily saves a few cycles. (should it matter) Signed-off-by: Christophe JAILLET --- drivers/md/bcache/sysfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/sysfs.h b/drivers/md/bcache/sysfs.h index 65b8bd975ab1..798bcbeab0bb 100644 --- a/drivers/md/bcache/sysfs.h +++ b/drivers/md/bcache/sysfs.h @@ -78,7 +78,7 @@ do { \ do { \ if (attr == &sysfs_ ## file) { \ ssize_t ret = bch_hprint(buf, val); \ - strcat(buf, "\n"); \ + strcat(buf + ret, "\n"); \ return ret + 1; \ } \ } while (0)