Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp841139iob; Wed, 4 May 2022 09:03:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy45OSwC94kJJQiXF94jodvGOiw8zeP2tLXnD0EtVQVsLrwFUfbmV+GaOwBMUBYZANEcgeU X-Received: by 2002:a81:b8d:0:b0:2f7:cf33:e840 with SMTP id 135-20020a810b8d000000b002f7cf33e840mr19637796ywl.73.1651680183553; Wed, 04 May 2022 09:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651680183; cv=none; d=google.com; s=arc-20160816; b=dNNJSLJRKB0054k6jd5eEbv2ku5QKIOcXZ1CesKxS+4DTyLEbgQBLgZ//nP8/pAKEc FGlwBGWHzaVkwe1Tjs5PMAnGYuQkNvfioeXWlEwcl4iOq9PmYFFHtkWAbUepQKDbyWRz 0ps4OHunelIdU0r4civP9pGn3632YYNFlvz8dnIRKTAdaq/yX0wwqKbp6KNg4XOCTeEd +esn2Qk1LjDVrLhfqRfXUrNsCb0EYy9f9tnpXTHvkec7X9Dni5ay590Gj9E+K7rCMmgC jNB9uSvn78Hcxm55WIzAvsmLdSAGpxtRsTNTagbJ6agt/eN3IoC2EnmetbYyhcbg2SO2 eP9g== 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; bh=zfnehx2FzJSEfJfJhMlaLgFaoQYz0pW4CB0ZfGbuV7o=; b=XvuhX86hIVR+yW+US9jVpsUQziqCvryKJAUmp9Iibm0jmIJXoU3s0e7wQ+9E8c5ozc FmWy7eHCdKQIWpp4r2z18bqXj5hiOdGykq52HK6bODpAo0W7FSXc1ZzRXyZQixf1P90w f3Kcnu3tI3jABFXupObGP1diGviA5tXydUDHJcXgoGauN32RBGPZfqDGbzusr/F/ngXa 2neTXL4zpgORlN6yrGVaaxHEqXuq+6Qi86aL5Z0aqXMWpwjDhsgfkWwrGAZjQNTxfTaf n80IfY+33Su1uQjIcBcOd3U+FLEDoooO+Owy8nhRYuPSTk8qMCJoFXGXpKQgLrtmZbIb 4S+w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l127-20020a25cc85000000b00641d1e26d8bsi17621979ybf.3.2022.05.04.09.02.45; Wed, 04 May 2022 09:03:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243799AbiECWqr (ORCPT + 99 others); Tue, 3 May 2022 18:46:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236973AbiECWqq (ORCPT ); Tue, 3 May 2022 18:46:46 -0400 Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 80A662DA8D; Tue, 3 May 2022 15:43:12 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id DCC56534356; Wed, 4 May 2022 08:43:06 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1nm1EX-007glS-UL; Wed, 04 May 2022 08:43:05 +1000 Date: Wed, 4 May 2022 08:43:05 +1000 From: Dave Chinner To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, Theodore Ts'o , Karel Zak , Greg KH , Christian Brauner , linux-kernel@vger.kernel.org, Linux API , linux-man , LSM , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , James Bottomley Subject: Re: [RFC PATCH] getting misc stats/attributes via xattr API Message-ID: <20220503224305.GF1360180@dread.disaster.area> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=VuxAv86n c=1 sm=1 tr=0 ts=6271afff a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=kj9zAlcOel0A:10 a=oZkIemNP1mAA:10 a=7-415B0cAAAA:8 a=yUZlb4BpVi82aJ1b07cA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE,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 02:23:23PM +0200, 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. :) > Thanks, > Miklos > > --- > fs/Makefile | 2 > fs/mount.h | 8 + > fs/namespace.c | 15 ++- > fs/pnode.h | 2 > fs/proc_namespace.c | 15 ++- > fs/values.c | 242 +++++++++++++++++++++++++++++++++++++++++++++++++ > fs/xattr.c | 16 ++- > include/linux/values.h | 11 ++ "values" is a very generic name - probably should end up being something more descriptive of the functionality is provides, especially if the header file is going to be dumped in include/linux/. I don't really have a good suggestion at the moment, though. .... > + > +enum { > + VAL_MNT_INFO, > +}; > + > +static struct val_desc val_mnt_group[] = { > + { VD_NAME("info"), .idx = VAL_MNT_INFO }, > + { } > +}; .... > + > + > +static struct val_desc val_toplevel_group[] = { > + { VD_NAME("mnt:"), .get = val_mnt_get, }, > + { VD_NAME("mntns:"), .get = val_mntns_get, }, > + { }, > +}; I know this is an early POC, my main question is how do you envisiage this table driven structure being extended down from just the mount into the filesystem so we can expose filesystem specific information that isn't covered by generic interfaces like statx? Cheers, Dave. -- Dave Chinner david@fromorbit.com