linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/9] fs: add infrastructure for multigrain timestamps
Date: Thu, 08 Aug 2024 20:00:44 -0400	[thread overview]
Message-ID: <796973ee97c0b16761b41f510b852725da07eed7.camel@kernel.org> (raw)
In-Reply-To: <gh5egnyreorb5h7powbmpcj733treuvk7grqsrdbvvqbrlskb5@cu3ld2km33sh>

On Fri, 2024-08-09 at 00:09 +0200, Mateusz Guzik wrote:
> On Mon, Jul 15, 2024 at 08:48:52AM -0400, Jeff Layton wrote:
> > diff --git a/fs/stat.c b/fs/stat.c
> > index 6f65b3456cad..df7fdd3afed9 100644
> > --- a/fs/stat.c
> > +++ b/fs/stat.c
> > @@ -26,6 +26,32 @@
> >  #include "internal.h"
> >  #include "mount.h"
> >  
> > +/**
> > + * fill_mg_cmtime - Fill in the mtime and ctime and flag ctime as QUERIED
> > + * @stat: where to store the resulting values
> > + * @request_mask: STATX_* values requested
> > + * @inode: inode from which to grab the c/mtime
> > + *
> > + * Given @inode, grab the ctime and mtime out if it and store the result
> > + * in @stat. When fetching the value, flag it as queried so the next write
> > + * will ensure a distinct timestamp.
> > + */
> > +void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode)
> > +{
> > +	atomic_t *pcn = (atomic_t *)&inode->i_ctime_nsec;
> > +
> > +	/* If neither time was requested, then don't report them */
> > +	if (!(request_mask & (STATX_CTIME|STATX_MTIME))) {
> > +		stat->result_mask &= ~(STATX_CTIME|STATX_MTIME);
> > +		return;
> > +	}
> > +
> > +	stat->mtime = inode_get_mtime(inode);
> > +	stat->ctime.tv_sec = inode->i_ctime_sec;
> > +	stat->ctime.tv_nsec = ((u32)atomic_fetch_or(I_CTIME_QUERIED, pcn)) & ~I_CTIME_QUERIED;
> > +}
> > +EXPORT_SYMBOL(fill_mg_cmtime);
> > +
> 
> [trimmed the ginormous CC]
> 
> This performs the atomic every time (as in it sets the flag even if it
> was already set), serializing all fstats and reducing scalability of
> stat of the same file.
> 
> Bare minimum it should be conditional -- if the flag is already set,
> don't dirty anything.
> 
> Even that aside adding an atomic to stat is a bummer, but off hand I
> don't have a good solution for that.
> 
> Anyhow, this being in -next, perhaps the conditional dirty can be
> massaged into the thing as present? There are some cosmetic choices to
> be made how to express, may be the fastest if you guys just augment it
> however you see fit.
> 
> If not I can submit a patch tomorrow.

I'm fine with that change. It should simple enough.
-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2024-08-09  0:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15 12:48 [PATCH v6 0/9] fs: multigrain timestamp redux Jeff Layton
2024-07-15 12:48 ` [PATCH v6 1/9] fs: add infrastructure for multigrain timestamps Jeff Layton
2024-07-17 10:40   ` Jan Kara
2024-08-08 22:09   ` Mateusz Guzik
2024-08-09  0:00     ` Jeff Layton [this message]
2024-08-08 23:43   ` Mateusz Guzik
2024-08-09  0:29     ` Jeff Layton
2024-07-15 12:48 ` [PATCH v6 2/9] fs: tracepoints around multigrain timestamp events Jeff Layton
2024-07-15 18:29   ` Darrick J. Wong
2024-07-17 10:41   ` Jan Kara
2024-07-15 12:48 ` [PATCH v6 3/9] fs: add percpu counters for significant " Jeff Layton
2024-07-15 18:32   ` Darrick J. Wong
2024-07-15 19:53     ` Jeff Layton
2024-07-15 20:03       ` Darrick J. Wong
2024-07-17 10:45       ` Jan Kara
2024-07-15 12:48 ` [PATCH v6 4/9] fs: have setattr_copy handle multigrain timestamps appropriately Jeff Layton
2024-07-17 11:24   ` Jan Kara
2024-07-15 12:48 ` [PATCH v6 5/9] Documentation: add a new file documenting multigrain timestamps Jeff Layton
2024-07-15 18:45   ` Darrick J. Wong
2024-07-17  6:00   ` Randy Dunlap
2024-07-17 11:31   ` Jan Kara
2024-07-17 12:02     ` Jeff Layton
2024-07-15 12:48 ` [PATCH v6 6/9] xfs: switch to " Jeff Layton
2024-07-15 18:47   ` Darrick J. Wong
2024-07-15 12:48 ` [PATCH v6 7/9] ext4: " Jeff Layton
2024-07-17 11:32   ` Jan Kara
2024-07-15 12:48 ` [PATCH v6 8/9] btrfs: convert " Jeff Layton
2024-07-15 12:49 ` [PATCH v6 9/9] tmpfs: add support for " Jeff Layton
2024-07-17 11:34   ` Jan Kara
2024-07-16  7:37 ` [PATCH v6 0/9] fs: multigrain timestamp redux Christian Brauner
2024-07-16 12:45   ` Jeff Layton
2024-07-22 15:30     ` 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=796973ee97c0b16761b41f510b852725da07eed7.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    --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).