linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: Kara <jack@suse.cz>,
	"Tigran A. Aivazian" <aivazian.tigran@gmail.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org,
	"damien.lemoal" <damien.lemoal@opensource.wdc.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 15/79] bfs: switch to new ctime accessors
Date: Mon, 3 Jul 2023 12:57:53 +0200	[thread overview]
Message-ID: <20230703-tauschen-kriegen-b0acf3b1f11f@brauner> (raw)
In-Reply-To: <a05703b82a903f82efe32b9b358fc03b71fe7460.camel@kernel.org>

On Mon, Jul 03, 2023 at 06:46:33AM -0400, Jeff Layton wrote:
> On Mon, 2023-07-03 at 12:12 +0200, Christian Brauner wrote:
> > On Fri, Jun 23, 2023 at 02:33:26PM +0200, Christian Brauner wrote:
> > > On Thu, Jun 22, 2023 at 04:57:47PM +0200, Jan Kara wrote:
> > > > On Thu 22-06-23 08:51:58, Jeff Layton wrote:
> > > > > On Thu, 2023-06-22 at 14:30 +0200, Jan Kara wrote:
> > > > > > On Wed 21-06-23 12:57:19, Jeff Layton wrote:
> > > > > > > On Wed, 2023-06-21 at 18:48 +0200, Jan Kara wrote:
> > > > > > > > On Wed 21-06-23 10:45:28, Jeff Layton wrote:
> > > > > > > > > In later patches, we're going to change how the ctime.tv_nsec field is
> > > > > > > > > utilized. Switch to using accessor functions instead of raw accesses of
> > > > > > > > > inode->i_ctime.
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > > > > > > 
> > > > > > > > ...
> > > > > > > > 
> > > > > > > > > diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
> > > > > > > > > index 1926bec2c850..c964316be32b 100644
> > > > > > > > > --- a/fs/bfs/inode.c
> > > > > > > > > +++ b/fs/bfs/inode.c
> > > > > > > > > @@ -82,10 +82,10 @@ struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
> > > > > > > > >  	inode->i_blocks = BFS_FILEBLOCKS(di);
> > > > > > > > >  	inode->i_atime.tv_sec =  le32_to_cpu(di->i_atime);
> > > > > > > > >  	inode->i_mtime.tv_sec =  le32_to_cpu(di->i_mtime);
> > > > > > > > > -	inode->i_ctime.tv_sec =  le32_to_cpu(di->i_ctime);
> > > > > > > > > +	inode_ctime_set_sec(inode, le32_to_cpu(di->i_ctime));
> > > > > > > > >  	inode->i_atime.tv_nsec = 0;
> > > > > > > > >  	inode->i_mtime.tv_nsec = 0;
> > > > > > > > > -	inode->i_ctime.tv_nsec = 0;
> > > > > > > > > +	inode_ctime_set_nsec(inode, 0);
> > > > > > > > 
> > > > > > > > So I'm somewhat wondering here - in other filesystem you construct
> > > > > > > > timespec64 and then use inode_ctime_set(). Here you use
> > > > > > > > inode_ctime_set_sec() + inode_ctime_set_nsec(). What's the benefit? It
> > > > > > > > seems these two functions are not used that much some maybe we could just
> > > > > > > > live with just inode_ctime_set() and constructing timespec64 when needed?
> > > > > > > > 
> > > > > > > > 								Honza
> > > > > > > 
> > > > > > > The main advantage is that by using that, I didn't need to do quite so
> > > > > > > much of this conversion by hand. My coccinelle skills are pretty
> > > > > > > primitive. I went with whatever conversion was going to give minimal
> > > > > > > changes, to the existing accesses for the most part.
> > > > > > > 
> > > > > > > We could certainly do it the way you suggest, it just means having to
> > > > > > > re-touch a lot of this code by hand, or someone with better coccinelle
> > > > > > > chops suggesting a way to declare a temporary variables in place.
> > > > > > 
> > > > > > Well, maybe temporary variables aren't that convenient but we could provide
> > > > > > function setting ctime from sec & nsec value without having to declare
> > > > > > temporary timespec64? Attached is a semantic patch that should deal with
> > > > > > that - at least it seems to handle all the cases I've found.
> > > > > > 
> > > > > 
> > > > > Ok, let me try respinning this with your cocci script and see how it
> > > > > looks.
> > > > > 
> > > > > Damien also suggested in a reply to the zonefs patch a preference for
> > > > > the naming style you have above. Should I also rename these like?
> > > > > 
> > > > >     inode_ctime_peek -> inode_get_ctime
> > > > >     inode_ctime_set -> inode_set_ctime
> > > > > 
> > > > > This would be the time to change it if that's preferred.
> > > > 
> > > > I don't really care much so whatever you decide is better :)
> > > 
> > > I have a mild preference for inode_{get,set}_ctime().
> > 
> > Jeff, did you plan on sending a v2 with this renamed or do you want me
> > to pick this up now?
> 
> I'm working on a new set that I'll send out in a few days. Sorry it has
> taken a while, I spent quite a bit of time trying to improve my
> coccinelle chops for this.

Absolutely no problem of course. I just wanted to check that I didn't
pointlessly delay you by not taking care of this.

Thanks!

  reply	other threads:[~2023-07-03 10:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230621144507.55591-1-jlayton@kernel.org>
     [not found] ` <20230621144735.55953-1-jlayton@kernel.org>
2023-06-21 14:45   ` [PATCH 10/79] affs: switch to new ctime accessors Jeff Layton
2023-06-21 16:39     ` Jan Kara
2023-06-22 11:37     ` David Sterba
2023-06-21 14:45   ` [PATCH 12/79] fs: " Jeff Layton
2023-06-21 16:42     ` Jan Kara
2023-06-21 14:45   ` [PATCH 27/79] exfat: " Jeff Layton
2023-06-21 14:45   ` [PATCH 33/79] fuse: " Jeff Layton
2023-06-21 14:45   ` [PATCH 35/79] hfs: " Jeff Layton
2023-06-21 14:45   ` [PATCH 36/79] hfsplus: " Jeff Layton
2023-06-21 14:45   ` [PATCH 40/79] isofs: " Jeff Layton
2023-06-21 14:46   ` [PATCH 55/79] proc: " Jeff Layton
2023-06-30 22:13     ` Luis Chamberlain
2023-06-21 14:46   ` [PATCH 69/79] vboxsf: " Jeff Layton
2023-06-21 14:46   ` [PATCH 71/79] zonefs: " Jeff Layton
2023-06-22  0:48     ` Damien Le Moal
     [not found]   ` <20230621144735.55953-14-jlayton@kernel.org>
     [not found]     ` <20230621164808.5lhujni7qb36hhtk@quack3>
     [not found]       ` <646b7283ede4945b335ad16aea5ff60e1361241e.camel@kernel.org>
     [not found]         ` <20230622123050.thpf7qdnmidq3thj@quack3>
     [not found]           ` <d316dca7c248693575dae3d8032e9e3332bbae7a.camel@kernel.org>
     [not found]             ` <20230622145747.lokguccxtrrpgb3b@quack3>
     [not found]               ` <20230623-kaffee-volumen-014cfa91a2ee@brauner>
2023-07-03 10:12                 ` [PATCH 15/79] bfs: " Christian Brauner
2023-07-03 10:46                   ` Jeff Layton
2023-07-03 10:57                     ` Christian Brauner [this message]
     [not found] ` <20230621152141.5961cf5f@gandalf.local.home>
     [not found]   ` <2a5a069572b46b59dd16fe8d54e549a9b5bbb6eb.camel@kernel.org>
2023-06-23 12:41     ` [PATCH 00/79] fs: new accessors for inode->i_ctime Christian Brauner
2023-06-30 22:11   ` Luis Chamberlain
     [not found] ` <20230621144507.55591-2-jlayton@kernel.org>
     [not found]   ` <99b3c749-23d9-6f09-fb75-6a84f3d1b066@kernel.org>
2023-06-22 10:14     ` [PATCH 01/79] fs: add ctime accessors infrastructure Jeff Layton
2023-06-30 22:12   ` Luis Chamberlain
2023-07-12 15:31   ` Randy Dunlap
2023-07-12 15:34     ` 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=20230703-tauschen-kriegen-b0acf3b1f11f@brauner \
    --to=brauner@kernel.org \
    --cc=aivazian.tigran@gmail.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).