Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp493517pxa; Wed, 12 Aug 2020 07:12:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzJuhEQbF/FdbBcWQ7HEdTNJ2TclW7J5KX24Ui0U5fEsBNArZ0JIzTob7BAc+GDex2H2+f X-Received: by 2002:aa7:da0e:: with SMTP id r14mr108317eds.236.1597241541639; Wed, 12 Aug 2020 07:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597241541; cv=none; d=google.com; s=arc-20160816; b=FSDxmdqauxECwHJFzaaCmc8tMeF63gDd20cOicBMr08AY4wDuSaShI8IqwZlupz1fe F5BV3GG4/Ogxo1cqdY1OnKp2oqSXGx8atbfLPMxfT5dE1ZHIQcKHcJ9BdFo6d/RR/jgX ONy0SpQ1mwIKq8mrLWAsHXaDxj6nzzjzJlCzMFDTT3a8p76ZHOCH+q/NJ0Zg1Pb3RYtF Z+8hE4rWLWm0zHnQ4LjcjkuPN+WO1MGjjUPG9kg4SsZpfdgRLRutB7PsaY/ydQNwYZLF oZ4dDnBzlWPN+ZuIZ3/v2FTNpSiHvFPxK5E8YDTHog+u96h9Pi3vbx4wloRNa3UUJtk6 9xXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=iAI5XSM3iLSzZtbpzf+lyAZodExx8Fv/UVCtkgNqIpw=; b=IStfFwAdni7P82GA7nXiJ3NSJjemcinonUOyJqN8dD6iK0slWi9G7dVDaXvge7ruNh 8OtD/DOqVq3Htl4CSNXYbAYu0PSlN3thqHqW65ma1WPZ3ei0Bnpe/00V53KuUCanPdJw B5UYR0ct9wjmvTjm63vTsp6SgAyYsFPnrdIoYW7h+JTzWqwLNzrn89UERETm38TyRTqk NPSmRJLsTfMCfe7l6468E3QV+b6r9B4TeOXVoirFCVC7nL/LovgrCOcncIBg4HnhlYyx Q4T1pEK/Eu4Gh4lJeHfHN3B7ljJOgtsn0IXjZ0y1voRtI0o2bSD5eT7lvwfNhtXkz2KO 6TZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Ev5v2cO1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si1234198eju.89.2020.08.12.07.11.58; Wed, 12 Aug 2020 07:12:21 -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=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=Ev5v2cO1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbgHLOLK (ORCPT + 99 others); Wed, 12 Aug 2020 10:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726543AbgHLOLJ (ORCPT ); Wed, 12 Aug 2020 10:11:09 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10E5CC061385 for ; Wed, 12 Aug 2020 07:11:09 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id p24so2391736ejf.13 for ; Wed, 12 Aug 2020 07:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iAI5XSM3iLSzZtbpzf+lyAZodExx8Fv/UVCtkgNqIpw=; b=Ev5v2cO14QrSiyYcOC/Fz6swER260kegAoQqygVAc1l4xp7iWj9y1sNUklptY5fWyh UpTrThzpnTLffpSrHOf2H63dAcVssZmBeRiLgorfycUPPCMMTFGXSVEqYOgJikBrkCYO UVuT7X9u60ilNRyU6Ttwt5duD6hAUjAYWcjFk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iAI5XSM3iLSzZtbpzf+lyAZodExx8Fv/UVCtkgNqIpw=; b=JMGjZWPOeA8lPQnqsANcGcm+rVpSPX7hELyMm5O0saM7qeSEtkIoltKfjHhj76gJsx L1drFhiCcjup1Coclm8//AwAtyL6kbitYqjx5ly4cm2ITaAkt8m7rJxcJSAvvWNslDaz 1CJUfjYppEbQLXtnfc5Ao9U6mPZIL53dw7bR1+E+U/r3/0uYgOpIfEimvLcvMIXkWOE1 nUs3wbbQMZioqHqZ2euuS+Rx+7TfXZQKYrttfZ4IAC/e92h8k3az2voaVkGgkFnynvL/ AULtHzEICnwmPE2iIlh8ue1+nYfCpW8GPdSNhfqF54OU486HHWA/QW/3gcCaOJIl+lb6 yTlg== X-Gm-Message-State: AOAM5331yEr5r8cWbCEfgHulgz3/k78CKuHv4Y09pn89yQ9TvHeFk/5n 58zBpgfpJKTnuuLQIlyxg0voQ48glng5N/cI9AOWbQ== X-Received: by 2002:a17:906:4e4f:: with SMTP id g15mr16755594ejw.443.1597241467668; Wed, 12 Aug 2020 07:11:07 -0700 (PDT) MIME-Version: 1.0 References: <1842689.1596468469@warthog.procyon.org.uk> <1845353.1596469795@warthog.procyon.org.uk> <20200811135419.GA1263716@miu.piliscsaba.redhat.com> <135551.1597240486@warthog.procyon.org.uk> In-Reply-To: <135551.1597240486@warthog.procyon.org.uk> From: Miklos Szeredi Date: Wed, 12 Aug 2020 16:10:56 +0200 Message-ID: Subject: Re: file metadata via fs API (was: [GIT PULL] Filesystem Information) To: David Howells Cc: Linus Torvalds , linux-fsdevel , Al Viro , Karel Zak , Jeff Layton , Miklos Szeredi , Nicolas Dichtel , Christian Brauner , Lennart Poettering , Linux API , Ian Kent , LSM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 12, 2020 at 3:54 PM David Howells wrote: > > Linus Torvalds wrote: > > > IOW, if you do something more along the lines of > > > > fd = open(""foo/bar", O_PATH); > > metadatafd = openat(fd, "metadataname", O_ALT); > > > > it might be workable. > > What is it going to walk through? You need to end up with an inode and dentry > from somewhere. > > It sounds like this would have to open up a procfs-like magic filesystem, and > walk into it. But how would that actually work? Would you create a new > superblock each time you do this, labelled with the starting object (say the > dentry for "foo/bar" in this case), and then walk from the root? > > An alternative, maybe, could be to make a new dentry type, say, and include it > in the superblock of the object being queried - and let the filesystems deal > with it. That would mean that non-dir dentries would then have virtual > children. You could then even use this to implement resource forks... > > Another alternative would be to note O_ALT and then skip pathwalk entirely, > but just use the name as a key to the attribute, creating an anonfd to read > it. But then why use openat() at all? You could instead do: > > metadatafd = openmeta(fd, "metadataname"); > > and save the page flag. You could even merge the two opens and do: > > metadatafd = openmeta("foo/bar", "metadataname"); > > Why not even combine this with Miklos's readfile() idea: > > readmeta(AT_FDCWD, "foo/bar", "metadataname", buf, sizeof(buf)); And writemeta() and createmeta() and readdirmeta() and ... The point is that generic operations already exist and no need to add new, specialized ones to access metadata. Thanks, Miklos