Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2162380lqt; Mon, 22 Apr 2024 03:24:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWT7aHmxTW98LFoi+vSZhzDMSLkWKvPWGqz9UWA+2KFF3Ly9KtX6Hdn2+K13dMCP855Jw2iXTztWMDJvm54UUTFS9y50iFTyDp2/nbG2A== X-Google-Smtp-Source: AGHT+IFayygnlQtfm/x7x8b+m/NhWbCT+r4cAqgJISqqsr8FcfyIZc0IdpsvX/Esq4ZVsYOMu+W+ X-Received: by 2002:a50:d5ce:0:b0:568:bfcd:e895 with SMTP id g14-20020a50d5ce000000b00568bfcde895mr5212408edj.41.1713781495658; Mon, 22 Apr 2024 03:24:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713781495; cv=pass; d=google.com; s=arc-20160816; b=V47QYlUohX9oP/DfivaWea5SS8r1RTrTCfKB+8i0LW+EZ8k01FPRm4sB5Tao3IsE2J WPWXYayvwdBDZ15oUIrPSwip9bae6Eq+s1Jb0Pr0NYbpPvekxn5CzFADxWit3Ye6LwOO O+r5pXjnG95Z9W1RkTGRwHBJyhH/V19FPzhWmn7h2C85tDcW8bBnvcPSzwkDgE1Yokbn +1RA9FsgMJ7q/VkS75eTjLS4xJTKyhCQVLIZ7D/UTn3eeTLhr7mfxRyVJB8LMtc6tLMy Ci1sF1bpTm72BkSVnxE2X2Y88w0NEzG6IfX7FK4PaB48B2Yiy/ZNsj6gznOjbKRYm6BL 0New== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+5BQBZK9oCOuonQNxMEsho7X/755sEqmuR+eW6M9akU=; fh=bP25YwJIDb2Kjmp7Hok+zLKVrjxKyDSipNMMaH3IxS4=; b=TRXtRMZsbZSepfWv2VxwPvECQMpScl5Qqhz+1WmI1K7u4WPljeepzGoDrMGpcMVjsl g6eiAsy9O3uXREFUc1qhcWsgWDyt14u2QjN0kz2YyijhYZhvFeEbnrA0vatuTrBu8zEV fCDjx7QWXMJwKSba1Drik8HsII/hHXAAwC23wSTtbrTdHM5uGza4FLRZrDhFZRXWfn8e MB1jJ+gmHosAAZbgYqIfqchl6k9qh0df1gqr1OiFAl/gXH74RjEFvfsQj8d8ec+dPLDB VBnFYluakx356Fs3j38T9oCqeDY8g59XZzm+G9miyHOftVvm8QHpYhefgr3+DpcL1hMG WtgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=oTHUNRus; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-153170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153170-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p14-20020a50cd8e000000b0057020ac4578si5608514edi.124.2024.04.22.03.24.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 03:24:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=oTHUNRus; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-153170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153170-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 635231F21759 for ; Mon, 22 Apr 2024 10:24:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA09E13FD7B; Mon, 22 Apr 2024 10:24:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="oTHUNRus" Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1532713E405; Mon, 22 Apr 2024 10:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713781479; cv=none; b=l0W1sCuxpLHAe/OT7QbJ7KbzytR+7QFEGCegsx37wxDr/0pYqpSc16DiGVDJ07xeqEtY51cDBJZzT6lgL3dUNDGE44lO6BVY/nF5eNqHZcSRfvwT33r6piZ8p5nndTHos1hPPrp53hzvC9Y34CShPybkx7yTOgN6oVPhc9U2WXs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713781479; c=relaxed/simple; bh=hx1H2/KTWnm+iopGGZ2Sz91oasiY4UwfCIVVPQyi0m4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tm9z1tQtdYro4iibKyE4gJbfi1GIYsXABpcEinPTe5MB3dL+HHScbmHwCs1OKIwewWkZe0w30p5+wkU26D6EBXqm1MTKP66+5F967PRmzoq4GDFw9Ex13h5uryGkB9MQOgB6ZHdwMURkHWpfqijsWHs8TqkJrWFTLDgI19JCYZk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=oTHUNRus; arc=none smtp.client-ip=80.12.242.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([86.243.17.157]) by smtp.orange.fr with ESMTPA id yqqPr8npHhQSByqqarJn76; Mon, 22 Apr 2024 12:24:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1713781468; bh=+5BQBZK9oCOuonQNxMEsho7X/755sEqmuR+eW6M9akU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=oTHUNRusDFEkufBQoPYgUNC7neHCHwCZ10sQf4n3RqgRoXOB2h2yWNjjoyoFWBokz Mw8L58M6MRMpi1t9BctLz8V4aZ3+H6H1dXB2ZtoGOUNDPnqZxWiAqKtSHpn4UjthCi tLQdpLVZgCLERoP/zyEF9pVVlisHrRkT04AcgMUo/Bbu6RF3JkJGeZ6sDhRpR1fCUr vTOm4pwngn55gQLpeEXWBxh3wRAMavBaaC2e1+WN0Lp9ANdrXaDsM8/EBh2Czdy0rE vI6RTYsRf62vbh+HrochU2oFOcn3OgAIT6jbDdKuXQyfdzhirPmMoFrHdDpvoyvTv0 m7e0L+xEp/Meg== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 22 Apr 2024 12:24:28 +0200 X-ME-IP: 86.243.17.157 From: Christophe JAILLET To: David.Laight@ACULAB.COM, rasmus.villemoes@prevas.dk, Alexander Viro , Christian Brauner , Jan Kara Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-fsdevel@vger.kernel.org Subject: [PATCH v2 2/2] seq_file: Simplify __seq_puts() Date: Mon, 22 Apr 2024 12:24:07 +0200 Message-ID: <7cebc1412d8d1338a7e52cc9291d00f5368c14e4.1713781332.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Change the implementation of the out-of-line __seq_puts() to simply be a seq_write() call instead of duplicating the overflow/memcpy logic. Suggested-by: Rasmus Villemoes Signed-off-by: Christophe JAILLET --- Changes in v2: - New patch Now than most (if not all) seq_puts() calls will be turned into a seq_write() or seq_putc() at compilation time, the added function call in __seq_puts() should not be noticeable. It could be even better to just remove this __seq_puts() and call seq_write(m, s, strlen(s)) directly in seq_puts() if it can't be optimized at compile time. --- fs/seq_file.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/seq_file.c b/fs/seq_file.c index 8ef0a07033ca..e676c8b0cf5d 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -671,14 +671,7 @@ EXPORT_SYMBOL(seq_putc); void __seq_puts(struct seq_file *m, const char *s) { - int len = strlen(s); - - if (m->count + len >= m->size) { - seq_set_overflow(m); - return; - } - memcpy(m->buf + m->count, s, len); - m->count += len; + seq_write(m, s, strlen(s)); } EXPORT_SYMBOL(__seq_puts); -- 2.44.0