Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp322817pxb; Thu, 23 Sep 2021 00:17:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0968EnP8Bnkr806cvKHlcpoIQfjbwLZkZUcjLI75EvFSWmZ6ItgbpTSw/7KxRcGLupxnn X-Received: by 2002:a05:6402:1c87:: with SMTP id cy7mr3851369edb.311.1632381425137; Thu, 23 Sep 2021 00:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632381425; cv=none; d=google.com; s=arc-20160816; b=nxhoKq3iz+K4AsGCzsmWUjg0AgLybPgDiLYvmQVRbv+lZAlyqTna07QRfU+aTYhdfe UQaL4Cc69o+dLvIXRv4a1XLM5/Osq0XJ07d16dntLbm9wrf5hIXAbufT8Psm4swfWPI6 mC1DaXYnUNc7XhRYggVv20OKgejr/cW6f3t8MIBUUJB610/jUm1lUO2YxLWPimNmEyY8 LgAFEX+Pt0aSUonFFiaG72vK4mrSSJKMLSr5Y7g0zWTI6NAdFedBNHk2t3A2HQzk/CLP tApulWgd0jMjBk1fn1IF1T+kR6VTqR1Y4+5ao733btDF2nfGUy8q7iiE2v3cA/xFSVTa UbKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=QY7WPyKmhlWy7yhhaiksEFQ2o0DzPZj/w9H1QqhuKSk=; b=AUjcAMUoM+dlbQ7AHPr754e5xJFoxZ88jH2v2y5a2kYCZPKraAPHHFMETnPtg8RyPC wFKXCtwNLAos50+jI8kbxcQ7Fn5FB8sA+Xa2xaSd4GgIiQB5/gDwbh8yQzvFmnTZ7CQN UiLPyQm+0sKSreczMvHujx4GbjVpbkQ3GBWuCSIq6pTpLy6hjSVRIPHbQN+pWeinR6SB PvKCER1ZHuBACxJE8LeH/4AemVAn+cApw/23JtHBzaDj/OWGWAuwg5UCfoRY0gmG1nJo 1Tr2n5GFWYJdV1SuqmmnF1yaaW2VK4WyzltRs3d0QH0oFHA1Yf5yweSchRnfuDX6Ye41 +zcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TCLmHYAU; dkim=neutral (no key) header.i=@suse.de header.b=dUbcrPlG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b88si6976151edf.312.2021.09.23.00.16.39; Thu, 23 Sep 2021 00:17:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TCLmHYAU; dkim=neutral (no key) header.i=@suse.de header.b=dUbcrPlG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239553AbhIWHP3 (ORCPT + 99 others); Thu, 23 Sep 2021 03:15:29 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:37218 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234343AbhIWHP3 (ORCPT ); Thu, 23 Sep 2021 03:15:29 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C012920278; Thu, 23 Sep 2021 07:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1632381236; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QY7WPyKmhlWy7yhhaiksEFQ2o0DzPZj/w9H1QqhuKSk=; b=TCLmHYAUJbBa25xCbUStdXDCFQLpDhOEySKAa0C/wKkmvol8THH6kNOvtm4kXMH2E3J8+j 9AaGqDrqopZEGzTtsTCutCElnq2ezUVRgEgXXLLoMJDit+V7v9aOmo/N9RIQPX7fC9ld6r lVSSHmNLSAsoYl4PZGAWTZG1dn0FGA0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1632381236; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QY7WPyKmhlWy7yhhaiksEFQ2o0DzPZj/w9H1QqhuKSk=; b=dUbcrPlGddRby7zrgkcuSNqKrOPPR66Anzv6Ad3RLQpBeQLL2CDO2cwrtPkPWXYrEfiH9u eg7ZCDqHtS3Vz+Ag== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 61C5C13DC4; Thu, 23 Sep 2021 07:13:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id u+DLDTIpTGHcdAAAMHmgww (envelope-from ); Thu, 23 Sep 2021 07:13:54 +0000 Subject: Re: Too large badblocks sysfs file (was: [PATCH v3 0/7] badblocks improvement for multiple bad block ranges) To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, antlists@youngman.org.uk, Dan Williams , Hannes Reinecke , Jens Axboe , NeilBrown , Richard Fan , Vishal L Verma , rafael@kernel.org References: <20210913163643.10233-1-colyli@suse.de> From: Coly Li Message-ID: <0a9f7fd9-a587-0152-118f-c61fe563f97f@suse.de> Date: Thu, 23 Sep 2021 15:13:52 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/23/21 2:47 PM, Greg Kroah-Hartman wrote: > On Thu, Sep 23, 2021 at 02:14:12PM +0800, Coly Li wrote: >> On 9/23/21 2:08 PM, Greg Kroah-Hartman wrote: >>> On Thu, Sep 23, 2021 at 01:59:28PM +0800, Coly Li wrote: >>>> Hi all the kernel gurus, and folks in mailing lists, >>>> >>>> This is a question about exporting 4KB+ text information via sysfs >>>> interface. I need advice on how to handle the problem. >> Hi Greg, >> >> This is the code in mainline kernel for quite long time. > {sigh} > > What tools rely on this? If none, just don't add new stuff to the file > and work to create a new api instead. At least I know mdadm uses this sysfs interface for md raid component disks monitoring. It has been in mdadm for around 5 years. Yes you are right, let it be for existing sysfs interface to avoid breaking things. >>> Please do not do that. Seriously, that is not what sysfs is for, and is >>> an abuse of it. >>> >>> sysfs is for "one value per file" and should never even get close to a >>> 4kb limit. If it does, you are doing something really really wrong and >>> should just remove that sysfs file from the system and redesign your >>> api. >> I understand this. And what I addressed is the problem I need to fix. >> >> The code is there for almost 10 years, I just find it during my work on bad >> blocks API fixing. >> >> >>>> Recently I work on the bad blocks API (block/badblocks.c) improvement, there >>>> is a sysfs file to export the bad block ranges for me raid. E.g for a md >>>> raid1 device, file >>>>     /sys/block/md0/md/rd0/bad_blocks >>>> may contain the following text content, >>>>     64 32 >>>>    128 8 >>> Ick, again, that's not ok at all. sysfs files should never have to be >>> parsed like this. >> I cannot agree more with you. What I am asking for was ---- how to fix it ? > Best solution, come up with a new api. > > Worst solution, you are stuck with the existing file and I can show you > the "way out" of dealing with files larger than 4kb in sysfs that a > number of other apis are being forced to do as they grow over time. Now I am sure you are very probably not willing to accept the patches, even I know how to do that :-) > > But ideally, just drop ths api and make a new one please. OK, then I leave the existing things as what they are, avoid to make them worse. Thanks for your response. Coly Li