Re: [PATCH v8 02/12] fs: add infrastructure for multigrain timestamps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 01-10-24 09:34:18, Jeff Layton wrote:
> On Tue, 2024-10-01 at 15:20 +0200, Jan Kara wrote:
> > > diff --git a/fs/stat.c b/fs/stat.c
> > > index 41e598376d7e..381926fb405f 100644
> > > --- a/fs/stat.c
> > > +++ b/fs/stat.c
> > > @@ -26,6 +26,35 @@
> > >  #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
> > 						 ^^ of
> > 
> > > + * in @stat. When fetching the value, flag it as QUERIED (if not already)
> > > + * so the next write will record a distinct timestamp.
> > > + */
> > > +void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode)
> > > +{
> > 
> > Given how things worked out in the end, it seems this function doesn't need
> > to handle mtime at all and we can move mtime handling back to shared generic
> > code?
> > 
> 
> I don't think we can. The mtime is effectively derived from the ctime.
> 
> If I query only the mtime, I think it's reasonable to expect that it
> will change if there is another write, even if I don't query the ctime.
> We won't get that unless we can also set the flag in the ctime when
> only the mtime is requested.

Aha, right. I already forgot about this :). Can you please add to the
comment the above explanation so that we remember next time somebody wants
to "clean this up" like me ;)? Thanks!

Also feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux