Received: by 2002:a19:651b:0:0:0:0:0 with SMTP id z27csp7569lfb; Tue, 3 May 2022 10:20:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy83aOv5mzDaH/XuUWpgfM616PSKogU+bNsksxVbpfpLd/JebA5an/CEzkl7PeD0BPHi5ag X-Received: by 2002:a17:906:aed8:b0:6f3:7e6b:14d with SMTP id me24-20020a170906aed800b006f37e6b014dmr16612000ejb.451.1651598441853; Tue, 03 May 2022 10:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651598441; cv=none; d=google.com; s=arc-20160816; b=J2UEXaV1lIZbwy1ADCwg788laq018rQHi4YUjoYxVGN+f76wJOh0WwyzDA2U2GZQhT e5+NC+QVgccHJdg3Ajg5z9Q/9hJ1yyZxSLZKaBhVczBerhscTyPZSwRNJfWlV8vib33P 91MGlXk4qyMWkldK36CZpKfLceMV9iQzDpTigF0wjsVYnhKhrn95j0yGI+DHzeLpOaX/ 80b6to/nuOZMAF0TAoZbhQtY3tp0q9HQuQWDlLmT73O0COT9mvgHTKHO66pmu3jDWP1H DKnaxD+2sJ1tV0Y4/T7Aojq7C1Vzhh40MJh1RIH1R0q92fIfOzdD67Q4bIv6s2XVuz9l uZfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NUl8y8DFhT/H3TezgUGttRrq6WXDqnGtv31fafVq2EM=; b=GR+/9BhMuYYMIddKobba2BOcB8kU/BAACyrmVdBpIm7s+fQ+cXFy9lq5pmzTv78rAr /0fPlNvcXYEk8VBRCOxx3Y6Lmkeg6+5ygdIZ0e9VqZUkFW63dldnTpMU1JzCA8nr7rRG L/nv7qNugCJCILmJMQs974Ykp4T60YfB9IB4C/Mkfm5dzhmRRnJ83g5IjJ8yGzwZUPzY 2FnHrYvt63FvvmJ8SeamR0JdyRiX43iIxRqRQ+XAptLQ9j+AS9eeCogwkq/YIa/BO73u fwDFnFZZb56lgr5QR7/usjgrrwBhDP+R5RCwmPyX/ER76VJCXl7dg/vjidm1SpRcjopv VjOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IyWn4OGC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a50d641000000b00425ee4958fasi13473935edj.67.2022.05.03.10.19.43; Tue, 03 May 2022 10:20:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IyWn4OGC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237448AbiECO50 (ORCPT + 99 others); Tue, 3 May 2022 10:57:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbiECO5Y (ORCPT ); Tue, 3 May 2022 10:57:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A22721E39; Tue, 3 May 2022 07:53:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B923560C8E; Tue, 3 May 2022 14:53:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F25B5C385A4; Tue, 3 May 2022 14:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651589630; bh=w4Xoznwtn3tyLr1cRCPJ8Tdo2kOlrKOwvD7MSq9598s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IyWn4OGCKIQfCoxx32JI1GCwxVovGVNz6H+TT+Vmx1nsr80YfM9XlxGM+qPZ4Vjcf vutt68+pESkS+B05T6D76+md0K1qTXmBrG5Xw6qAeJb+comkTppxOC4FYmH6777Img LPA/+W66303oz14RM5evehJfP/n/hn5hy981rZDI= Date: Tue, 3 May 2022 16:53:49 +0200 From: Greg KH To: Amir Goldstein Cc: Miklos Szeredi , linux-fsdevel , Dave Chinner , Theodore Ts'o , Karel Zak , Christian Brauner , linux-kernel , Linux API , linux-man , LSM , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , James Bottomley Subject: Re: [RFC PATCH] getting misc stats/attributes via xattr API Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 03, 2022 at 05:39:46PM +0300, Amir Goldstein wrote: > On Tue, May 3, 2022 at 3:23 PM Miklos Szeredi wrote: > > > > This is a simplification of the getvalues(2) prototype and moving it to the > > getxattr(2) interface, as suggested by Dave. > > > > The patch itself just adds the possibility to retrieve a single line of > > /proc/$$/mountinfo (which was the basic requirement from which the fsinfo > > patchset grew out of). > > > > But this should be able to serve Amir's per-sb iostats, as well as a host of > > other cases where some statistic needs to be retrieved from some object. Note: > > a filesystem object often represents other kinds of objects (such as processes > > in /proc) so this is not limited to fs attributes. > > > > This also opens up the interface to setting attributes via setxattr(2). > > > > After some pondering I made the namespace so: > > > > : - root > > bar - an attribute > > foo: - a folder (can contain attributes and/or folders) > > > > The contents of a folder is represented by a null separated list of names. > > > > Examples: > > > > $ getfattr -etext -n ":" . > > # file: . > > :="mnt:\000mntns:" > > > > $ getfattr -etext -n ":mnt:" . > > # file: . > > :mnt:="info" > > > > $ getfattr -etext -n ":mnt:info" . > > # file: . > > :mnt:info="21 1 254:0 / / rw,relatime - ext4 /dev/root rw\012" > > > > $ getfattr -etext -n ":mntns:" . > > # file: . > > :mntns:="21:\00022:\00024:\00025:\00023:\00026:\00027:\00028:\00029:\00030:\00031:" > > > > $ getfattr -etext -n ":mntns:28:" . > > # file: . > > :mntns:28:="info" > > > > Comments? > > > > I like that :) > > It should be noted that while this API mandates text keys, > it does not mandate text values, so for example, sb iostats could be > exported as text or as binary struct, or as individual text/binary records or > all of the above. Ugh, no, that would be a total mess. Don't go exporting random binary structs depending on the file, that's going to be completely unmaintainable. As it is, this is going to be hard enough with random text fields. As for this format, it needs to be required to be documented in Documentation/ABI/ for each entry and key type so that we have a chance of knowing what is going on and tracking how things are working and validating stuff. thanks, greg k-h