From nobody Tue Dec 16 20:04:05 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B2DAC4167B for ; Sun, 29 Oct 2023 10:37:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbjJ2KaU (ORCPT ); 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =3D=3D &sysfs_ ## file) { \ ssize_t ret =3D bch_hprint(buf, val); \ - strcat(buf, "\n"); \ + strcat(buf + ret, "\n"); \ return ret + 1; \ } \ } while (0) --=20 2.34.1