linux-nilfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: Jeff Layton <jlayton@kernel.org>, "Darrick J. Wong" <djwong@kernel.org>
Cc: "Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"David Sterba" <dsterba@suse.cz>,
	"Amir Goldstein" <amir73il@gmail.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Jeremy Kerr" <jk@ozlabs.org>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Sven Schnelle" <svens@linux.ibm.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers
Date: Thu, 28 Sep 2023 16:21:12 -0400	[thread overview]
Message-ID: <ded0ef74-bdad-42f2-b0a7-5d867e446c19@app.fastmail.com> (raw)
In-Reply-To: <6a6f37d16b55a3003af3f3dbb7778a367f68cd8d.camel@kernel.org>

On Thu, Sep 28, 2023, at 13:40, Jeff Layton wrote:
> On Thu, 2023-09-28 at 10:19 -0700, Darrick J. Wong wrote:
>>
>> > I remember seeing those patches go by. I don't remember that change
>> > being NaK'ed, but I wasn't paying close attention at the time 
>> > 
>> > Looking at it objectively now, I think it's worth it to recover 8 bytes
>> > per inode and open a 4 byte hole that Amir can use to grow the
>> > i_fsnotify_mask. We might even able to shave off another 12 bytes
>> > eventually if we can move to a single 64-bit word per timestamp. 
>> 
>> I don't think you can, since btrfs timestamps utilize s64 seconds
>> counting in both directions from the Unix epoch.  They also support ns
>> resolution:
>> 
>> 	struct btrfs_timespec {
>> 		__le64 sec;
>> 		__le32 nsec;
>> 	} __attribute__ ((__packed__));
>> 
>
> Correct. We'd lose some fidelity in currently stored timestamps, but as
> Linus and Ted pointed out, anything below ~100ns granularity is
> effectively just noise, as that's the floor overhead for calling into
> the kernel. It's hard to argue that any application needs that sort of
> timestamp resolution, at least with contemporary hardware. 

There are probably applications that have come up with creative
ways to use the timestamp fields of file systems that 94 bits
of data, with both the MSB of the seconds and the LSB of the
nanoseconds carrying information that they expect to be preserved.

Dropping any information in the nanoseconds other than the top two
bits would trivially change the 'ls -t' output when two files have
the same timestamp in one kernel but slightly different timestamps
in another one. For large values of 'tv_sec', there are fewer
obvious things that break, but if current kernels are able to
retrieve arbitrary times that were stored with utimensat(), then we
should probably make sure future kernels can see the same.

        Arnd

  reply	other threads:[~2023-09-28 20:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 11:05 [PATCH 85/87] fs: rename i_atime and i_mtime fields to __i_atime and __i_mtime Jeff Layton
2023-09-28 11:05 ` [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers Jeff Layton
2023-09-28 15:48   ` Arnd Bergmann
2023-09-28 17:06     ` Jeff Layton
2023-09-28 17:19       ` Darrick J. Wong
2023-09-28 17:40         ` Jeff Layton
2023-09-28 20:21           ` Arnd Bergmann [this message]
2023-09-28 21:26           ` Theodore Ts'o
2023-09-29  0:18             ` Linus Torvalds
2023-09-29  3:50               ` Amir Goldstein
     [not found]                 ` <CAOQ4uxg5ctY9yCjLOjN1nETAcEuNb2UERnYuDv7PoErdxX=WUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-09-29 16:22                   ` Linus Torvalds
2023-09-29  3:27         ` Amir Goldstein
     [not found]         ` <6a6f37d16b55a3003af3f3dbb7778a367f68cd8d.camel-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-09-29  6:32           ` David Howells
2023-09-30 14:50             ` Steve French
2023-10-01  5:01               ` [OT] " Gabriel Paubert
2023-09-29  9:44       ` Christian Brauner
2023-09-29 10:16         ` Jeff Layton
2023-09-28 17:09   ` Jeff Layton
2023-09-28 11:05 ` [PATCH 87/87] fs: move i_blocks up a few places in struct inode Jeff Layton
2023-09-28 11:35   ` Amir Goldstein
2023-09-28 12:01     ` Jeff Layton
2023-09-28 17:41   ` Linus Torvalds
2023-09-28 18:01     ` Jeff Layton
2023-09-29  9:32     ` Christian Brauner

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=ded0ef74-bdad-42f2-b0a7-5d867e446c19@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=agordeev@linux.ibm.com \
    --cc=amir73il@gmail.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=brauner@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=djwong@kernel.org \
    --cc=dsterba@suse.cz \
    --cc=ebiederm@xmission.com \
    --cc=gor@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hca@linux.ibm.com \
    --cc=jk@ozlabs.org \
    --cc=jlayton@kernel.org \
    --cc=keescook@chromium.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=svens@linux.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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).