Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2912031rdb; Tue, 13 Feb 2024 00:30:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWAhR8L6eF5QM2a3qZUvt9Mp9HaqBt2kDe6dt9eRXu6skVOwFEBHGegNPkWLZklOUJ0hI/ILyn9QpAFuTbJBfgzQUIQSY3eey86ZIIaQw== X-Google-Smtp-Source: AGHT+IGY6Du5WYv0+XbS05c+89nOATrN8pXNDES1zA0sMFk72uvQpaL2LyRvrjAevBpJIBjkoYk4 X-Received: by 2002:a17:906:b888:b0:a3c:bfcd:bed2 with SMTP id hb8-20020a170906b88800b00a3cbfcdbed2mr2690821ejb.31.1707813030342; Tue, 13 Feb 2024 00:30:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707813030; cv=pass; d=google.com; s=arc-20160816; b=uZA4qrhPD+nd44iWMcnw9BcYuydI2gXWiY4tWROFvkOcpYlIIMEABMNxN+IucO95h5 pyoWpFmtvZmd/1pqWR342ouIG4+q+aN4jUmnJgylotyrD2hVbwvnPQifPl66imRA2DF3 LGimjZP4jPhFtwyGN01iMcGVvFgRqcfL7rObexT8Z0OvABzrksWjHG3DrNnKMK9YSYcI thgSIsuj/i6iVqQlqRFettA4vG54fzsU96l3fX7Awxn9X6d14zU5mpRUIxsMtqxXdr7B miMnLkCa7Z+F0EEg+YeUxir5b1tuZyF4lWPr0c/edWOZRcU0Gkvrnr3AVxw3n5DbOsx3 CG7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=UVoibj/kriuj68qpqrmYwyDO76NZZTUK51M4zJowuXg=; fh=hYuUgooUopexC8oPvHgbFaC1YiMoeE54aXKxGIgNx3Q=; b=yEoloBNrfZ+UeSLMdFNEMByblH2ZCDX5ptBRfo2vgWQs4KA9OrQnr+ss0IUB4qQO5/ 7NO7B53S7446a1zPNHven6jYrINkhi1f8CsYPLoyqK9KAjt8rSzth1MoZVjqKNE0vqJW rjQlQR74kjdqzfVPaA5Nik0eZClN+/DQ3q6aFEL52vef3Q0AcYPzxMvt1n/PMZ6p1UUI btNYvZwVNDzX92QW3PP//26Lli+LaYnEvnDhMYofoMIw9F/0CD5ao4ZNVTIHyomAmM25 w1VgofLezd8a8I4Rv64AaH0rG3wpo2K9yjDO/2JbCdMLOYL2yiD0ZAcgogcaxJShJjWg vi7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JiyRDzmV; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-63123-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCXbJY+soBTJjP5aKXp+jzl3H+q4+yKd0RskokAu5gPLpnXAvUU4ZrIcdl4PvKtWIIE/8bnOmZl6Z/QBbOrepg61SAhSjLyWj1h6Ptk3rw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r20-20020a170906c29400b00a3ceeef4c84si688629ejz.1044.2024.02.13.00.30.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 00:30:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63123-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=@gmail.com header.s=20230601 header.b=JiyRDzmV; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-63123-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 E28EA1F2359D for ; Tue, 13 Feb 2024 08:30:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C281A182BE; Tue, 13 Feb 2024 08:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JiyRDzmV" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 0316218026; Tue, 13 Feb 2024 08:30:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707813014; cv=none; b=cwPAZn1fQ7WLNwALdks5lm2zLDLTIMz4XCKDO7ArwXzAlwocuYkswtPKr/IbnvrnLgglJU0fPoKMQaBzWbM9cwpKnuOKnuWXYPR5eO5V2QwEKBtqrR3Pk1/Wqd0PwnVvnwKI8NliA4AVP782fvjBtV8taz0bBo5dwNiHTjwX7MA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707813014; c=relaxed/simple; bh=CloOXvX3e3OyBad9i8X+MAxCoHVaXSE6mAVeTadKyHs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=o+7IfvuQr97sZeghIUE6MQ74ClueY4Y+b5rkDQirpEe0ZA1NXbcsKoNjiQ12cLg7YWTfkSjeilbAsm1qpZFnNWO/9sKe7nQGgTOe0+H5ESSzvf+NQkHsYp8VNWx62Yae7kvc8cBo85E+yOFd5i8MkhtYNsaE9MbarrZbcql0IqQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JiyRDzmV; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a3cc8f0c97fso166320166b.0; Tue, 13 Feb 2024 00:30:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707813011; x=1708417811; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UVoibj/kriuj68qpqrmYwyDO76NZZTUK51M4zJowuXg=; b=JiyRDzmVtu7qFQSJxeuvH1GlrRsg59b8das0TSoIaX8WccaN+jvM1iJZKtIUPwsMiZ AMZNs1Nzx1dczXdWoYmm+P3jj5AYvJPfMUs1xTIvftcCGASTCl2yvBfNPzYKZ8xrMTht E57/K5j9P/K3t251uiGjoEWv54IwVcSTFmGhZtq62vltUugmllsugdXLc/kwts5WOZQQ XreW0+YUznNJpOjuS25jM/fxzlvjoHZg6Wn0pBFD3dQueNyT1gnuPK+J48aylm7jYFfQ zRVnLc4bVfMr9XoDXWRB0EY7Np34Gndmd2sRCqhtiui4GJ08PkblcYKvA6DEv0ZPJgV9 kcGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707813011; x=1708417811; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UVoibj/kriuj68qpqrmYwyDO76NZZTUK51M4zJowuXg=; b=Rv+lvl+2DW4cd9qiT5Tf7l5As08KL+lcXqONynVOMj6OQlCK2x86j2B72oHQ6Mm6ss HwlzoGbX5+pQAJEj/9Y419P3NVAUyD0KYkg8VJGkObu6nG+NfN4xoqoKh43CMoBtU4Wg TEo2Zjq7V2Jqjo995T9PN06VMOC+vg77ZXATVpFEz6iQuEjk70dwo4q29jx+rtPrRG0I BeGxD/nJ8Zj+5i70UTSbyZkD0D0ERrQg+s7bEqUoEb4Dm1iFxnMn3w9T3xsKsRxBzI9q wY6st2zgRqS16mTulB524e1qHKLmInpA5x811YoNWEWWbLrTo74LrVGgOEQk36MOJ5ZO qXfg== X-Forwarded-Encrypted: i=1; AJvYcCWA1hs6PDRQ1h1OZR+exmK0KURerX4V9Efp5TEodOGFqEZcqNvX4lgJt3Mott8y3jMATfvs7dOnE2SfT+FFyo0H1I5exvh/lFpy0S15DB0Pr4ck7yFpASQEDQwkwLkaBoh/ogwgSSoo1Y1IBlIqfEl7ku/kSKwE+mpRP5gdQJu/CvvG86GGV8QYA+IZpIUAJf2y4wNUUjk0ve28DI3b5mYaJj6IZjVbcdkhxv05HDTkl7uzc4vSjnpQU3ERm1CdxzyGrLUXspgqTI3r8Mq+r20iYxgeJNMCxzKOVw== X-Gm-Message-State: AOJu0YyuL57iGlEW0ulwhRQRKH71OmmoFuARWVgVEbvNp8lNUybDq1Vj eJDLOWWP9mzu6ynO53znCYAQ7OIlo4XPPMn84M96nceQsT3Fn9txBYBlTpjjsSHpGx02Hn9TNYA CfLaMr55O+MGIB96D732oMq5xs4A= X-Received: by 2002:a17:907:7896:b0:a3d:704:d688 with SMTP id ku22-20020a170907789600b00a3d0704d688mr613690ejc.47.1707813011047; Tue, 13 Feb 2024 00:30:11 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212213922.783301-1-surenb@google.com> <20240212213922.783301-2-surenb@google.com> In-Reply-To: From: Andy Shevchenko Date: Tue, 13 Feb 2024 10:29:34 +0200 Message-ID: Subject: Re: [PATCH v3 01/35] lib/string_helpers: Add flags param to string_get_size() To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, kent.overstreet@linux.dev, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org, Andy Shevchenko , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , "Michael S. Tsirkin" , Jason Wang , =?UTF-8?Q?Noralf_Tr=C3=B8nnes?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 13, 2024 at 10:26=E2=80=AFAM Andy Shevchenko wrote: > > On Mon, Feb 12, 2024 at 11:39=E2=80=AFPM Suren Baghdasaryan wrote: > > > > From: Kent Overstreet > > > > The new flags parameter allows controlling > > - Whether or not the units suffix is separated by a space, for > > compatibility with sort -h > > - Whether or not to append a B suffix - we're not always printing > > bytes. And you effectively missed to _add_ the test cases for the modified code. Formal NAK for this, the rest is discussable, the absence of tests is not. > > Signed-off-by: Kent Overstreet > > Signed-off-by: Suren Baghdasaryan > > It seems most of my points from the previous review were refused... > > ... > > You can move the below under --- cutter, so it won't pollute the git hist= ory. > > > Cc: Andy Shevchenko > > Cc: Michael Ellerman > > Cc: Benjamin Herrenschmidt > > Cc: Paul Mackerras > > Cc: "Michael S. Tsirkin" > > Cc: Jason Wang > > Cc: "Noralf Tr=C3=B8nnes" > > Cc: Jens Axboe > > --- > > ... > > > --- a/include/linux/string_helpers.h > > +++ b/include/linux/string_helpers.h > > @@ -17,14 +17,13 @@ static inline bool string_is_terminated(const char = *s, int len) > > ... > > > -/* Descriptions of the types of units to > > - * print in */ > > -enum string_size_units { > > - STRING_UNITS_10, /* use powers of 10^3 (standard SI) */ > > - STRING_UNITS_2, /* use binary powers of 2^10 */ > > +enum string_size_flags { > > + STRING_SIZE_BASE2 =3D (1 << 0), > > + STRING_SIZE_NOSPACE =3D (1 << 1), > > + STRING_SIZE_NOBYTES =3D (1 << 2), > > }; > > Do not kill documentation, I already said that. Or i.o.w. document this. > Also the _SIZE is ambigous (if you don't want UNITS, use SIZE_FORMAT. > > Also why did you kill BASE10 here? (see below as well) > > ... > > > --- a/lib/string_helpers.c > > +++ b/lib/string_helpers.c > > @@ -19,11 +19,17 @@ > > #include > > #include > > > > +enum string_size_units { > > + STRING_UNITS_10, /* use powers of 10^3 (standard SI) */ > > + STRING_UNITS_2, /* use binary powers of 2^10 */ > > +}; > > Why do we need this duplication? > > ... > > > + enum string_size_units units =3D flags & flags & STRING_SIZE_BA= SE2 > > + ? STRING_UNITS_2 : STRING_UNITS_10; > > Double flags check is redundant. --=20 With Best Regards, Andy Shevchenko