public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Groves <john@groves.net>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	 Dan Williams <dan.j.williams@intel.com>,
	Bernd Schubert <bschubert@ddn.com>,
	 Alison Schofield <alison.schofield@intel.com>,
	John Groves <jgroves@micron.com>,
	 John Groves <jgroves@fastmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	 Vishal Verma <vishal.l.verma@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	 Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	David Hildenbrand <david@kernel.org>,
	 Christian Brauner <brauner@kernel.org>,
	"Darrick J . Wong" <djwong@kernel.org>,
	 Randy Dunlap <rdunlap@infradead.org>,
	Jeff Layton <jlayton@kernel.org>,
	 Amir Goldstein <amir73il@gmail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	 Stefan Hajnoczi <shajnocz@redhat.com>,
	Josef Bacik <josef@toxicpanda.com>,
	 Bagas Sanjaya <bagasdotme@gmail.com>,
	James Morse <james.morse@arm.com>, Fuad Tabba <tabba@google.com>,
	 Sean Christopherson <seanjc@google.com>,
	Shivank Garg <shivankg@amd.com>,
	 Ackerley Tng <ackerleytng@google.com>,
	Gregory Price <gourry@gourry.net>,
	 Aravind Ramesh <arramesh@micron.com>,
	Ajay Joshi <ajayjoshi@micron.com>,
	 "venkataravis@micron.com" <venkataravis@micron.com>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>,
	 "linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH V5 09/19] famfs_fuse: magic.h: Add famfs magic numbers
Date: Wed, 11 Feb 2026 12:26:47 -0600	[thread overview]
Message-ID: <aYy_c3Wh6RbJflvs@groves.net> (raw)
In-Reply-To: <CAJnrk1Y6HayeS-C3sOEOc_CgaS_K=SedZNpHASAXAkgZyp3Xsg@mail.gmail.com>

On 26/01/28 10:54AM, Joanne Koong wrote:
> On Wed, Jan 28, 2026 at 6:33 AM John Groves <john@jagalactic.com> wrote:
> >
> > On 26/01/27 01:55PM, Joanne Koong wrote:
> > > On Fri, Jan 16, 2026 at 11:52 AM John Groves <john@jagalactic.com> wrote:
> > > >
> > > > From: John Groves <john@groves.net>
> > > >
> > > > Famfs distinguishes between its on-media and in-memory superblocks. This
> > > > reserves the numbers, but they are only used by the user space
> > > > components of famfs.
> > > >
> > > > Signed-off-by: John Groves <john@groves.net>
> > > > ---
> > > >  include/uapi/linux/magic.h | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
> > > > index 638ca21b7a90..712b097bf2a5 100644
> > > > --- a/include/uapi/linux/magic.h
> > > > +++ b/include/uapi/linux/magic.h
> > > > @@ -38,6 +38,8 @@
> > > >  #define OVERLAYFS_SUPER_MAGIC  0x794c7630
> > > >  #define FUSE_SUPER_MAGIC       0x65735546
> > > >  #define BCACHEFS_SUPER_MAGIC   0xca451a4e
> > > > +#define FAMFS_SUPER_MAGIC      0x87b282ff
> > > > +#define FAMFS_STATFS_MAGIC      0x87b282fd
> > >
> > > Could you explain why this needs to be added to uapi? If they are used
> > > only by userspace, does it make more sense for these constants to live
> > > in the userspace code instead?
> > >
> > > Thanks,
> > > Joanne
> >
> > Hi Joanne,
> >
> > I think this is where it belongs; one function of uapi/linux/magic.h is as
> > a "registry" of magic numbers, which do need to be unique because they're
> > the first step of recognizing what is on a device.
> >
> > This is a well-established ecosystem with block devices. Blkid / libblkid
> > scan block devices and keep a database of what devices exist and what
> > appears to be on them. When one adds a magic number that applies to block
> > devices, one sends a patch to util-linux (where blkid lives) to add ability
> > to recognize your media format (which IIRC includes the second recognition
> > step - if the magic # matches, verify the superblock checksum).
> >
> > For character dax devices the ecosystem isn't really there yet, but the
> > pattern is the same - and still makes sense.
> >
> > Also, 2 years ago in the very first public famfs patch set (pre-fuse),
> > Christian Brauner told me they belong here [1].

Apologies for not responding to this sooner.

First, FAMFS_STATFS_MAGIC will be dropped for sure. At one point I thought
I'd be able to override FUSE_SUPER_MAGIC in the output from statfs, but
that's not currently true. I've had to take a different approach in the 
famfs user space for definitively identifying whether a path falls in a 
famfs file system...

> 
> Hi John,
> 
> Thanks for the context. I was under the impression include/uapi/ was
> only for constants the kernel exposes as part of its ABI. If I'm
> understanding it correctly, FAMFS_SUPER_MAGIC is used purely as an
> on-disk format marker for identification by userspace tools. Why
> doesn't having the magic number defined in the equivalent of
> blkid/libblkid for dax devices and defined/used in the famfs
> server-side implementation suffice for that purpose? I'm asking in
> part because it seems like a slippery slope to me where any fuse
> server could make the same argument in the future that their magic
> constant should be added to uapi.

Right now there is no equivalent of util-linux/blkid for character device
superblock identification. Therefore this seems better than nothing to
record FAMFS_SUPER_MAGIC, since keeping it unique is a public good and
it is an actual on-media magic number. Although it's not currently used
on block devices, there is a very real possibility of famfs on block
devices in the future (pmem is block, and fs-dax, supporting that with
famfs would be straightforward, and there are problems for which it's a
good solution...)

There doesn't seem to be an explicit maintainer of magic.h; if somebody
can speak for the intent, or the rules etc., that would be helpful. I don't
want to abandon this based on general uapi guidelines alone. Is there
anybody in particular who should make a ruling here?

I don't really see a slippery slope; this isn't an arbitrary constant, 
it's an actual on-media magic number. 

> 
> For Christian's comment, my understanding was that with the pre-fuse
> patchset, it did need to be in uapi because the kernel explicitly set
> sb->s_magic to it, but with famfs now going through fuse, sb->s_magic
> uses FUSE_SUPER_MAGIC.

Even in the before-times with standalone famfs, on media (in-memory)
metadata was not accessed directly from the kernel module. So that didn't 
change with the fuse port (though it's possible that detail of the prior
implementation wasn't broadly understood...).

Would anybody like to weigh in to swing consensus here?

Thanks,
John


  reply	other threads:[~2026-02-11 18:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260116185911.1005-1-john@jagalactic.com>
     [not found] ` <20260116125831.953.compound@groves.net>
2026-01-16 18:58   ` [PATCH BUNDLE v3] famfs: Fabric-Attached Memory File System John Groves
2026-01-16 18:59   ` [PATCH V5 00/19] famfs: port into fuse John Groves
2026-01-16 19:10   ` [PATCH V5 0/3] John Groves
     [not found]   ` <20260116191036.1470-2-john@jagalactic.com>
     [not found]     ` <20260116191036.1470-1-john@jagalactic.com>
2026-01-16 19:11       ` [PATCH V5 1/3] fuse_kernel.h: bring up to baseline 6.19 John Groves
2026-01-16 19:11       ` [PATCH V5 2/3] fuse_kernel.h: add famfs DAX fmap protocol definitions John Groves
2026-01-16 19:12       ` [PATCH V5 3/3] fuse: add famfs DAX fmap support John Groves
2026-01-16 19:12   ` [PATCH V3 0/2] ndctl: Add daxctl support for the new "famfs" mode of devdax John Groves
     [not found]   ` <20260116191253.1559-2-john@jagalactic.com>
     [not found]     ` <20260116191253.1559-1-john@jagalactic.com>
2026-01-16 19:13       ` [PATCH V3 1/2] daxctl: Add support for famfs mode John Groves
2026-01-16 19:14       ` [PATCH V3 2/2] Add test/daxctl-famfs.sh to test famfs mode transitions: John Groves
2026-01-16 18:59 ` [PATCH V5 01/19] dax: move dax_pgoff_to_phys from [drivers/dax/] device.c to bus.c John Groves
2026-01-16 19:00 ` [PATCH V5 02/19] dax: Factor out dax_folio_reset_order() helper John Groves
2026-01-16 19:00 ` [PATCH V5 03/19] dax: add fsdev.c driver for fs-dax on character dax John Groves
2026-01-16 19:01 ` [PATCH V5 04/19] dax: Save the kva from memremap John Groves
2026-01-16 19:02 ` [PATCH V5 05/19] dax: Add dax_operations for use by fs-dax on fsdev dax John Groves
2026-01-16 19:02 ` [PATCH V5 06/19] dax: Add dax_set_ops() for setting dax_operations at bind time John Groves
2026-01-16 19:03 ` [PATCH V5 07/19] dax: Add fs_dax_get() func to prepare dax for fs-dax usage John Groves
2026-01-16 19:03 ` [PATCH V5 08/19] dax: export dax_dev_get() John Groves
2026-01-16 19:04 ` [PATCH V5 09/19] famfs_fuse: magic.h: Add famfs magic numbers John Groves
2026-01-27 21:55   ` Joanne Koong
2026-01-28 14:33     ` John Groves
2026-01-28 18:54       ` Joanne Koong
2026-02-11 18:26         ` John Groves [this message]
2026-01-16 19:04 ` [PATCH V5 10/19] famfs_fuse: Update macro s/FUSE_IS_DAX/FUSE_IS_VIRTIO_DAX/ John Groves
2026-01-16 19:05 ` [PATCH V5 11/19] famfs_fuse: Basic fuse kernel ABI enablement for famfs John Groves
2026-01-16 19:06 ` [PATCH V5 12/19] famfs_fuse: Plumb the GET_FMAP message/response John Groves
2026-01-16 19:06 ` [PATCH V5 13/19] famfs_fuse: Create files with famfs fmaps John Groves
2026-01-16 19:07 ` [PATCH V5 14/19] famfs_fuse: GET_DAXDEV message and daxdev_table John Groves
2026-01-16 19:07 ` [PATCH V5 15/19] famfs_fuse: Plumb dax iomap and fuse read/write/mmap John Groves
2026-01-16 19:08 ` [PATCH V5 16/19] famfs_fuse: Add holder_operations for dax notify_failure() John Groves
2026-01-16 19:08 ` [PATCH V5 17/19] famfs_fuse: Add DAX address_space_operations with noop_dirty_folio John Groves
2026-01-16 19:09 ` [PATCH V5 18/19] famfs_fuse: Add famfs fmap metadata documentation John Groves
2026-01-16 19:10 ` [PATCH V5 19/19] famfs_fuse: Add documentation John Groves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYy_c3Wh6RbJflvs@groves.net \
    --to=john@groves.net \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=ackerleytng@google.com \
    --cc=ajayjoshi@micron.com \
    --cc=alison.schofield@intel.com \
    --cc=amir73il@gmail.com \
    --cc=arramesh@micron.com \
    --cc=bagasdotme@gmail.com \
    --cc=brauner@kernel.org \
    --cc=bschubert@ddn.com \
    --cc=corbet@lwn.net \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david@kernel.org \
    --cc=djwong@kernel.org \
    --cc=gourry@gourry.net \
    --cc=jack@suse.cz \
    --cc=james.morse@arm.com \
    --cc=jgroves@fastmail.com \
    --cc=jgroves@micron.com \
    --cc=jlayton@kernel.org \
    --cc=joannelkoong@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=nvdimm@lists.linux.dev \
    --cc=rdunlap@infradead.org \
    --cc=seanjc@google.com \
    --cc=shajnocz@redhat.com \
    --cc=shivankg@amd.com \
    --cc=tabba@google.com \
    --cc=venkataravis@micron.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vishal.l.verma@intel.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox