Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp292081pxb; Wed, 22 Sep 2021 23:17:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrYe/OtwNByY0xaCr2MMeEufJkAYCTjXjwsNsNp+RmI5igI2AMfTDlrMYErzjo+BMVlpId X-Received: by 2002:a05:6e02:1c02:: with SMTP id l2mr2342605ilh.162.1632377844120; Wed, 22 Sep 2021 23:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632377844; cv=none; d=google.com; s=arc-20160816; b=QW4bJAcdPKtQvlUQPh5w7s2MKmU+VnmqfkpD/uGhAetBiuIcvENHNHOhqN/aIdbBG5 5uQ938+YJTHDE3KbdJPLIaZ0ovuro7dy0UdJMRjvzov48nnnz3D7Bb2bZr/UOwAo9HfY em/IinViJqDGSKokoCEIBAQ0MwWl+k/NuHVW1jT9XmnDdwc/cKdEDa2ox/x8/Z8VPXi+ d3FKBmqHcD7UUVBIZ0/ln/0tqp8OpnLRE8R9XkDDqV7ukGdqm11UKRF8Znt/p1QzNNl6 TTfC/ZHgdWbVGyW0NFeJ5wK0V1Z/KOyvygtgAJUkzDfVrw9HfCanFm0+5DWCsFW3qbzt kKag== 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=o0l2RHdc1VTxle7geiUN7AAnIlMhU8AgWvN0GgDIMdE=; b=Je3XDJsP1CRHPSaBix7gmJYmAI/6ZCYse9cwqPcop2BI+W8zx8JEnuivcvqKbUuFEw HnLzafZpyJl+zGiqnUkZlOYQwSULj61pYQ2i0BIX7L/dPQdIA0eXfSIfPTt6sLP+z8Nj m1U99YHZ612GtBNJgmmlNPtoT5eerYa/1IwFdY5kl6unqScSga8o/KCh2MkrQmF4dCeb byJ3d55QM+UGB8FWEqA2wTjJVe4wVCrPvO6Dy0DkDKgln9ZEw3n+leEMuYura7o49fVV fLSstntDmvSbmlCiDkczmc/CXkew3gPpVyQh5M+DvT+428dWH1biZ5P3y+6Gtla81crS ou7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=HyEJd+cN; dkim=neutral (no key) header.i=@suse.de header.b="9bE/juPl"; 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 e24si5043417jak.17.2021.09.22.23.17.11; Wed, 22 Sep 2021 23:17:24 -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=HyEJd+cN; dkim=neutral (no key) header.i=@suse.de header.b="9bE/juPl"; 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 S239310AbhIWGPu (ORCPT + 99 others); Thu, 23 Sep 2021 02:15:50 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:47608 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239226AbhIWGPt (ORCPT ); Thu, 23 Sep 2021 02:15:49 -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-out1.suse.de (Postfix) with ESMTPS id 7847622326; Thu, 23 Sep 2021 06:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1632377657; 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=o0l2RHdc1VTxle7geiUN7AAnIlMhU8AgWvN0GgDIMdE=; b=HyEJd+cNPg3rUBdiB/5jTWFbun2xaZfnqW48HD5bLI2EDmo3D1lUUxrT0tc1cttoXdoWE+ D8HhDttgCm7dq1M/s54x7rWMb2GW5A2v93X0T8Frhn6nF1aVCyOTWArX2uMQzg2XLDaBNw dumzyXgB5rztuWMH6KIJx56EjmGqaIw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1632377657; 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=o0l2RHdc1VTxle7geiUN7AAnIlMhU8AgWvN0GgDIMdE=; b=9bE/juPlOpYXf9idmLGTvOH4t7+Ic5QXdOBeROUigVxpY5/fkyZIOLBdQbEhf8otiBRvvm yhVIAyyCvfuU6TDg== 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 5804B13DB5; Thu, 23 Sep 2021 06:14:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1T2PCTYbTGFlWAAAMHmgww (envelope-from ); Thu, 23 Sep 2021 06:14:14 +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: Date: Thu, 23 Sep 2021 14:14:12 +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: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. > 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 ? Thanks. Coly Li