From: Donald Buczek <buczek@molgen.mpg.de>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Theodore Ts'o <tytso@mit.edu>, Dave Chinner <david@fromorbit.com>,
NeilBrown <neilb@suse.de>,
linux-bcachefs@vger.kernel.org,
Stefan Krueger <stefan.krueger@aei.mpg.de>,
David Howells <dhowells@redhat.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: file handle in statx
Date: Tue, 19 Dec 2023 08:41:29 +0100 [thread overview]
Message-ID: <cf9ddb5f-357a-474d-9ca9-9e7ef0dd7bc3@molgen.mpg.de> (raw)
In-Reply-To: <7ed8baa0-b895-43a2-bb13-93a92e18a823@molgen.mpg.de>
Dear Kent,
On 12/13/23 14:48, Donald Buczek wrote:
> On 12/13/23 13:28, Kent Overstreet wrote:
>> On Wed, Dec 13, 2023 at 08:37:57AM +0100, Donald Buczek wrote:
>>> Probably not for the specific applications I mentioned (backup, mirror,
>>> accounting). These are intended to run continuously, slowly and unnoticed
>>> in the background, so they are memory and i/o throttled via cgroups anyway
>>> and one is even using sleep after so-and-so many stat calls to reduce
>>> its impact.
>>>
>>> If they could tell a directory from a snapshot, I would probably stop them
>>> from walking into snapshots. And if not, the snapshot id is all that is
>>> needed to tell a clone in a snapshot from a hardlink. So these don't really
>>> need the filehandle.
>>
>> Perhaps we should allocate a bit for differentiating a snapshot from a
>> non snapshot subvolume?
> Are there non-snapshots subvolumes?
>
> From debugfs bcachefs/../btrees, I've got the impression, that every
> volume starts with a (single) snapshot.
> [...]
> So is there really a type difference between the objects created by
> `bcachefs subvolume create` and `bcachefs subvolume snapshot` ? It appears
> that they both point to a volume which points to a snapshot in the snapshot
> tree.
On a second thought: Even if my guesses were true, it would make sense to give
userspace the information. I'd probably code my backup code to walk into volumes
(or singleton snapshots) directories and copy the data just as it would do
with conventional directories. There is no risk of seeing the same file multiple
times. Only the hardlink logic should regard these volume borders and don't
treat entries in different volumes as hardlink candidates.
Only for subvolumes which potentially duplicate data we'd need
special coding to avoid copying the same data to the backup volume over
and over. Although we already might have a similar problem already with
reflink copies.
Best
Donald
>
> Best
>
> Donald
>
>
>>> In the thread it was assumed, that there are other (unspecified)
>>> applications which need the filehandle and currently use name_to_handle_at().
>>>
>>> I though it was self-evident that a single syscall to retrieve all
>>> information atomically is better than a set of syscalls. Each additional
>>> syscall has overhead and you need to be concerned with the data changing
>>> between the calls.
>>
>> All other things being equal, yeah it would be. But things are never
>> equal :)
>>
>> Expanding struct statx is not going to be as easy as hoped, so we need
>> to be a bit careful how we use the remaining space, and since as Dave
>> pointed out the filehandle isn't needed for checking uniqueness unless
>> nlink > 1 it's not really a hotpath in any application I can think of.
>>
>> (If anyone does know of an application where it might matter, now's the
>> time to bring it up!)
>>
>>> Userspace nfs server as an example of an application, where visible
>>> performance is more relevant, was already mentioned by someone else.
>>
>> I'd love to hear confirmation from someone more intimately familiar with
>> NFS, but AFAIK it shouldn't matter there; the filehandle exists to
>> support resuming IO or other operations to a file (because the server
>> can go away and come back). If all the client did was a stat, there's no
>> need for a filehandle - that's not needed until a file is opened.
>
--
Donald Buczek
buczek@molgen.mpg.de
Tel: +49 30 8413 1433
next prev parent reply other threads:[~2023-12-19 7:42 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <12f711f9-70a2-408e-8588-2839e599b668@molgen.mpg.de>
[not found] ` <170181366042.7109.5045075782421670339@noble.neil.brown.name>
[not found] ` <97375d00-4bf7-4c4f-96ec-47f4078abb3d@molgen.mpg.de>
[not found] ` <170199821328.12910.289120389882559143@noble.neil.brown.name>
[not found] ` <20231208013739.frhvlisxut6hexnd@moria.home.lan>
[not found] ` <170200162890.12910.9667703050904306180@noble.neil.brown.name>
[not found] ` <20231208024919.yjmyasgc76gxjnda@moria.home.lan>
[not found] ` <630fcb48-1e1e-43df-8b27-a396a06c9f37@molgen.mpg.de>
[not found] ` <20231208200247.we3zrwmnkwy5ibbz@moria.home.lan>
[not found] ` <170233460764.12910.276163802059260666@noble.neil.brown.name>
2023-12-11 23:32 ` file handle in statx (was: Re: How to cope with subvolumes and snapshots on muti-user systems?) Kent Overstreet
2023-12-11 23:53 ` NeilBrown
2023-12-12 0:05 ` Kent Overstreet
2023-12-12 0:59 ` NeilBrown
2023-12-12 1:10 ` Kent Overstreet
2023-12-12 2:13 ` NeilBrown
2023-12-12 2:24 ` Kent Overstreet
2023-12-12 9:08 ` Christian Brauner
2023-12-12 5:53 ` Dave Chinner
2023-12-12 6:32 ` Amir Goldstein
2023-12-12 8:56 ` Christian Brauner
2023-12-12 15:16 ` Kent Overstreet
2023-12-12 15:29 ` Christian Brauner
2023-12-12 15:35 ` Kent Overstreet
2023-12-12 15:38 ` Miklos Szeredi
2023-12-12 15:43 ` Kent Overstreet
2023-12-12 15:57 ` Miklos Szeredi
2023-12-12 16:08 ` Kent Overstreet
2023-12-12 16:30 ` Miklos Szeredi
2023-12-12 16:41 ` Kent Overstreet
2023-12-12 21:53 ` NeilBrown
2023-12-13 9:41 ` Christian Brauner
2023-12-12 21:46 ` NeilBrown
2023-12-13 9:47 ` Christian Brauner
2023-12-13 10:04 ` Christian Brauner
2023-12-14 22:47 ` NeilBrown
2023-12-15 0:36 ` Kent Overstreet
2023-12-12 9:10 ` David Howells
2023-12-12 9:23 ` Christian Brauner
2023-12-12 9:28 ` Miklos Szeredi
2023-12-12 9:35 ` Christian Brauner
2023-12-12 9:42 ` Miklos Szeredi
2023-12-12 13:47 ` Christian Brauner
2023-12-12 14:06 ` Miklos Szeredi
2023-12-12 15:24 ` Christian Brauner
2023-12-12 15:28 ` Kent Overstreet
2023-12-12 9:46 ` David Howells
2023-12-12 9:10 ` file handle in statx Donald Buczek
2023-12-12 15:20 ` Theodore Ts'o
2023-12-12 17:15 ` Frank Filz
2023-12-12 17:44 ` Kent Overstreet
2023-12-12 18:17 ` Amir Goldstein
2023-12-12 19:18 ` Frank Filz
2023-12-12 20:59 ` Dave Chinner
2023-12-12 21:57 ` NeilBrown
2023-12-12 22:23 ` Dave Chinner
2023-12-12 22:36 ` NeilBrown
2023-12-12 22:39 ` Kent Overstreet
2023-12-12 23:44 ` Dave Chinner
2023-12-13 0:00 ` Kent Overstreet
2023-12-13 7:37 ` Donald Buczek
2023-12-13 12:28 ` Kent Overstreet
2023-12-13 13:48 ` Donald Buczek
2023-12-19 7:41 ` Donald Buczek [this message]
2023-12-12 15:21 ` file handle in statx (was: Re: How to cope with subvolumes and snapshots on muti-user systems?) Kent Overstreet
2023-12-12 20:48 ` Dave Chinner
2023-12-12 21:23 ` Kent Overstreet
2023-12-12 22:10 ` Dave Chinner
2023-12-12 22:31 ` NeilBrown
2023-12-12 23:06 ` Dave Chinner
2023-12-12 23:42 ` Kent Overstreet
2023-12-13 0:03 ` NeilBrown
2023-12-12 22:00 ` NeilBrown
2023-12-12 7:03 ` David Howells
2023-12-12 0:25 ` David Howells
2023-12-11 23:40 ` David Howells
2023-12-12 20:59 ` Kent Overstreet
2023-12-12 22:57 ` NeilBrown
2023-12-12 23:43 ` Kent Overstreet
2023-12-13 0:02 ` NeilBrown
2023-12-13 0:14 ` Kent Overstreet
2023-12-13 22:45 ` Andreas Dilger
2023-12-13 23:24 ` Kent Overstreet
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=cf9ddb5f-357a-474d-9ca9-9e7ef0dd7bc3@molgen.mpg.de \
--to=buczek@molgen.mpg.de \
--cc=david@fromorbit.com \
--cc=dhowells@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=stefan.krueger@aei.mpg.de \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).