Re: [f2fs-dev] [PATCH v2 00/89] fs: new accessors for inode->i_ctime
Hello: This series was applied to jaegeuk/f2fs.git (dev) by Christian Brauner : On Wed, 5 Jul 2023 14:58:09 -0400 you wrote: > v2: > - prepend patches to add missing ctime updates > - add simple_rename_timestamp helper function > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_* > - drop individual inode_ctime_set_{sec,nsec} helpers > > I've been working on a patchset to change how the inode->i_ctime is > accessed in order to give us conditional, high-res timestamps for the > ctime and mtime. struct timespec64 has unused bits in it that we can use > to implement this. In order to do that however, we need to wrap all > accesses of inode->i_ctime to ensure that bits used as flags are > appropriately handled. > > [...] Here is the summary with links: - [f2fs-dev,v2,07/92] fs: add ctime accessors infrastructure https://git.kernel.org/jaegeuk/f2fs/c/9b6304c1d537 - [f2fs-dev,v2,08/92] fs: new helper: simple_rename_timestamp https://git.kernel.org/jaegeuk/f2fs/c/0c4767923ed6 - [f2fs-dev,v2,92/92] fs: rename i_ctime field to __i_ctime https://git.kernel.org/jaegeuk/f2fs/c/13bc24457850 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
On Mon, 2023-07-10 at 14:35 +0200, Christian Brauner wrote: > On Fri, Jul 07, 2023 at 08:42:31AM -0400, Jeff Layton wrote: > > On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote: > > > v2: > > > - prepend patches to add missing ctime updates > > > - add simple_rename_timestamp helper function > > > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_* > > > - drop individual inode_ctime_set_{sec,nsec} helpers > > > > > > > After review by Jan and others, and Jan's ext4 rework, the diff on top > > of the series I posted a couple of days ago is below. I don't really > > want to spam everyone with another ~100 patch v3 series, but I can if > > you think that's best. > > > > Christian, what would you like me to do here? > > I picked up the series from the list and folded the fixups you posted > here into the respective fs conversion patches. I hope that helps you > avoid a resend. You should have received a separate "thank you" mail for > all of this. > > To each patch that I folded one of the fixlets from below into I added a > git note that records a link to your mail here and the respective patch > hunk from this mail that I folded into the patch. git.kernel.org will > show notes by default. For example, > https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs.ctime=8b0e3c2e99004609a16ba145bcbdfdddb78e220e > should show you the note I added. You can also fetch them via > git fetch $remote refs/notes/*:refs/notes/* > (You probably know that ofc but jic.) if you're interested. > > Based on v6.5-rc1 as of today. > Many thanks!!! I'll get to work rebasing the multigrain timestamp series on top of that. > Btw, both b4 and patchwork somehow treat the series in weird was. > IOW, based on the message id of the cover letter I was able to pull most > messages except for: > > [07/92] fs: add ctime accessors infrastructure > [08/92] fs: new helper: simple_rename_timestamp > [92/92] fs: rename i_ctime field to __i_ctime > > which I pulled in separately. Not sure what the cause of > > this is. Good to know. I ended up doing the send in two phases: one for the cover letter and infrastructure patches that went to everyone, and one for the per- subsystem patches that went do individual maintainers and lists. I suspect that screwed up the message IDs somehow. Hopefully I won't need to do a posting like that again soon, but I'll pay closer attention to the message id handling next time. Thanks again! -- Jeff Layton
Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
On Fri, Jul 07, 2023 at 08:42:31AM -0400, Jeff Layton wrote: > On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote: > > v2: > > - prepend patches to add missing ctime updates > > - add simple_rename_timestamp helper function > > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_* > > - drop individual inode_ctime_set_{sec,nsec} helpers > > > > After review by Jan and others, and Jan's ext4 rework, the diff on top > of the series I posted a couple of days ago is below. I don't really > want to spam everyone with another ~100 patch v3 series, but I can if > you think that's best. > > Christian, what would you like me to do here? I picked up the series from the list and folded the fixups you posted here into the respective fs conversion patches. I hope that helps you avoid a resend. You should have received a separate "thank you" mail for all of this. To each patch that I folded one of the fixlets from below into I added a git note that records a link to your mail here and the respective patch hunk from this mail that I folded into the patch. git.kernel.org will show notes by default. For example, https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs.ctime=8b0e3c2e99004609a16ba145bcbdfdddb78e220e should show you the note I added. You can also fetch them via git fetch $remote refs/notes/*:refs/notes/* (You probably know that ofc but jic.) if you're interested. Based on v6.5-rc1 as of today. Btw, both b4 and patchwork somehow treat the series in weird was. IOW, based on the message id of the cover letter I was able to pull most messages except for: [07/92] fs: add ctime accessors infrastructure [08/92] fs: new helper: simple_rename_timestamp [92/92] fs: rename i_ctime field to __i_ctime which I pulled in separately. Not sure what the cause of this is.
Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote: > v2: > - prepend patches to add missing ctime updates > - add simple_rename_timestamp helper function > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_* > - drop individual inode_ctime_set_{sec,nsec} helpers > After review by Jan and others, and Jan's ext4 rework, the diff on top of the series I posted a couple of days ago is below. I don't really want to spam everyone with another ~100 patch v3 series, but I can if you think that's best. Christian, what would you like me to do here? diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index bcdb1a0beccf..5f6e93714f5a 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -699,8 +699,7 @@ void ceph_fill_file_time(struct inode *inode, int issued, if (ci->i_version == 0 || timespec64_compare(ctime, ) > 0) { dout("ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n", -inode_get_ctime(inode).tv_sec, -inode_get_ctime(inode).tv_nsec, +ictime.tv_sec, ictime.tv_nsec, ctime->tv_sec, ctime->tv_nsec); inode_set_ctime_to_ts(inode, *ctime); } diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 806374d866d1..567c0d305ea4 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -175,10 +175,7 @@ static void *erofs_read_inode(struct erofs_buf *buf, vi->chunkbits = sb->s_blocksize_bits + (vi->chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK); } - inode->i_mtime.tv_sec = inode_get_ctime(inode).tv_sec; - inode->i_atime.tv_sec = inode_get_ctime(inode).tv_sec; - inode->i_mtime.tv_nsec = inode_get_ctime(inode).tv_nsec; - inode->i_atime.tv_nsec = inode_get_ctime(inode).tv_nsec; + inode->i_mtime = inode->i_atime = inode_get_ctime(inode); inode->i_flags &= ~S_DAX; if (test_opt(>opt, DAX_ALWAYS) && S_ISREG(inode->i_mode) && diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index c007de6ac1c7..1b9f587f6cca 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -1351,7 +1351,7 @@ static int exfat_rename(struct mnt_idmap *idmap, exfat_warn(sb, "abnormal access to an inode dropped"); WARN_ON(new_inode->i_nlink == 0); } - EXFAT_I(new_inode)->i_crtime = inode_set_ctime_current(new_inode); + EXFAT_I(new_inode)->i_crtime = current_time(new_inode); } unlock: diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index d502b930431b..d63543187359 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -868,64 +868,63 @@ struct ext4_inode { * affected filesystem before 2242. */ -static inline __le32 ext4_encode_extra_time(struct timespec64 *time) +static inline __le32 ext4_encode_extra_time(struct timespec64 ts) { - u32 extra =((time->tv_sec - (s32)time->tv_sec) >> 32) & EXT4_EPOCH_MASK; - return cpu_to_le32(extra | (time->tv_nsec << EXT4_EPOCH_BITS)); + u32 extra = ((ts.tv_sec - (s32)ts.tv_sec) >> 32) & EXT4_EPOCH_MASK; + return cpu_to_le32(extra | (ts.tv_nsec << EXT4_EPOCH_BITS)); } -static inline void ext4_decode_extra_time(struct timespec64 *time, - __le32 extra) +static inline struct timespec64 ext4_decode_extra_time(__le32 base, + __le32 extra) { + struct timespec64 ts = { .tv_sec = le32_to_cpu(base) }; + if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK))) - time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32; - time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; + ts.tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32; + ts.tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; + return ts; } -#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ +#define EXT4_INODE_SET_XTIME_VAL(xtime, inode, raw_inode, ts) \ do { \ - if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {\ - (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \ - (raw_inode)->xtime ## _extra = \ - ext4_encode_extra_time(&(inode)->xtime); \ - } \ - else\ - (raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (inode)->xtime.tv_sec, S32_MIN, S32_MAX));\ + if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) { \ + (raw_inode)->xtime = cpu_to_le32((ts).tv_sec); \ + (raw_inode)->xtime ## _extra =
Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
On Thu, 2023-07-06 at 10:16 -0500, Eric W. Biederman wrote: > Jeff Layton writes: > > > On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote: > > > v2: > > > - prepend patches to add missing ctime updates > > > - add simple_rename_timestamp helper function > > > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_* > > > - drop individual inode_ctime_set_{sec,nsec} helpers > > > > > > I've been working on a patchset to change how the inode->i_ctime is > > > accessed in order to give us conditional, high-res timestamps for the > > > ctime and mtime. struct timespec64 has unused bits in it that we can use > > > to implement this. In order to do that however, we need to wrap all > > > accesses of inode->i_ctime to ensure that bits used as flags are > > > appropriately handled. > > > > > > The patchset starts with reposts of some missing ctime updates that I > > > spotted in the tree. It then adds a new helper function for updating the > > > timestamp after a successful rename, and new ctime accessor > > > infrastructure. > > > > > > The bulk of the patchset is individual conversions of different > > > subsysteme to use the new infrastructure. Finally, the patchset renames > > > the i_ctime field to __i_ctime to help ensure that I didn't miss > > > anything. > > > > > > This should apply cleanly to linux-next as of this morning. > > > > > > Most of this conversion was done via 5 different coccinelle scripts, run > > > in succession, with a large swath of by-hand conversions to clean up the > > > remainder. > > > > > > > A couple of other things I should note: > > > > If you sent me an Acked-by or Reviewed-by in the previous set, then I > > tried to keep it on the patch here, since the respun patches are mostly > > just renaming stuff from v1. Let me know if I've missed any. > > > > I've also pushed the pile to my tree as this tag: > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/tag/?h=ctime.20230705 > > > > In case that's easier to work with. > > Are there any preliminary patches showing what you want your introduced > accessors to turn into? It is hard to judge the sanity of the > introduction of wrappers without seeing what the wrappers are ultimately > going to do. > > Eric I have a draft version of the multigrain patches on top of the wrapper conversion I've already posted in my "mgctime-experimental" branch: https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/log/?h=mgctime-experimental The rationale is best explained in this changelog: https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/commit/?h=mgctime-experimental=face437a144d3375afb7f70c233b0644b4edccba The idea will be to enable this on a per-fs basis. -- Jeff Layton
Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
Jeff Layton writes: > On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote: >> v2: >> - prepend patches to add missing ctime updates >> - add simple_rename_timestamp helper function >> - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_* >> - drop individual inode_ctime_set_{sec,nsec} helpers >> >> I've been working on a patchset to change how the inode->i_ctime is >> accessed in order to give us conditional, high-res timestamps for the >> ctime and mtime. struct timespec64 has unused bits in it that we can use >> to implement this. In order to do that however, we need to wrap all >> accesses of inode->i_ctime to ensure that bits used as flags are >> appropriately handled. >> >> The patchset starts with reposts of some missing ctime updates that I >> spotted in the tree. It then adds a new helper function for updating the >> timestamp after a successful rename, and new ctime accessor >> infrastructure. >> >> The bulk of the patchset is individual conversions of different >> subsysteme to use the new infrastructure. Finally, the patchset renames >> the i_ctime field to __i_ctime to help ensure that I didn't miss >> anything. >> >> This should apply cleanly to linux-next as of this morning. >> >> Most of this conversion was done via 5 different coccinelle scripts, run >> in succession, with a large swath of by-hand conversions to clean up the >> remainder. >> > > A couple of other things I should note: > > If you sent me an Acked-by or Reviewed-by in the previous set, then I > tried to keep it on the patch here, since the respun patches are mostly > just renaming stuff from v1. Let me know if I've missed any. > > I've also pushed the pile to my tree as this tag: > > > https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/tag/?h=ctime.20230705 > > In case that's easier to work with. Are there any preliminary patches showing what you want your introduced accessors to turn into? It is hard to judge the sanity of the introduction of wrappers without seeing what the wrappers are ultimately going to do. Eric
Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
On Wed, 2023-07-05 at 14:58 -0400, Jeff Layton wrote: > v2: > - prepend patches to add missing ctime updates > - add simple_rename_timestamp helper function > - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_* > - drop individual inode_ctime_set_{sec,nsec} helpers > > I've been working on a patchset to change how the inode->i_ctime is > accessed in order to give us conditional, high-res timestamps for the > ctime and mtime. struct timespec64 has unused bits in it that we can use > to implement this. In order to do that however, we need to wrap all > accesses of inode->i_ctime to ensure that bits used as flags are > appropriately handled. > > The patchset starts with reposts of some missing ctime updates that I > spotted in the tree. It then adds a new helper function for updating the > timestamp after a successful rename, and new ctime accessor > infrastructure. > > The bulk of the patchset is individual conversions of different > subsysteme to use the new infrastructure. Finally, the patchset renames > the i_ctime field to __i_ctime to help ensure that I didn't miss > anything. > > This should apply cleanly to linux-next as of this morning. > > Most of this conversion was done via 5 different coccinelle scripts, run > in succession, with a large swath of by-hand conversions to clean up the > remainder. > A couple of other things I should note: If you sent me an Acked-by or Reviewed-by in the previous set, then I tried to keep it on the patch here, since the respun patches are mostly just renaming stuff from v1. Let me know if I've missed any. I've also pushed the pile to my tree as this tag: https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/tag/?h=ctime.20230705 In case that's easier to work with. Cheers, -- Jeff Layton
[PATCH v2 00/89] fs: new accessors for inode->i_ctime
v2: - prepend patches to add missing ctime updates - add simple_rename_timestamp helper function - rename ctime accessor functions as inode_get_ctime/inode_set_ctime_* - drop individual inode_ctime_set_{sec,nsec} helpers I've been working on a patchset to change how the inode->i_ctime is accessed in order to give us conditional, high-res timestamps for the ctime and mtime. struct timespec64 has unused bits in it that we can use to implement this. In order to do that however, we need to wrap all accesses of inode->i_ctime to ensure that bits used as flags are appropriately handled. The patchset starts with reposts of some missing ctime updates that I spotted in the tree. It then adds a new helper function for updating the timestamp after a successful rename, and new ctime accessor infrastructure. The bulk of the patchset is individual conversions of different subsysteme to use the new infrastructure. Finally, the patchset renames the i_ctime field to __i_ctime to help ensure that I didn't miss anything. This should apply cleanly to linux-next as of this morning. Most of this conversion was done via 5 different coccinelle scripts, run in succession, with a large swath of by-hand conversions to clean up the remainder. The coccinelle scripts that were used are below: :: cocci/ctime1.cocci :: // convert as much to use inode_set_ctime_current as possible @@ identifier timei; struct inode *inode; expression E1, E2; @@ ( - inode->i_ctime = E1 = E2 = current_time(timei) + E1 = E2 = inode_set_ctime_current(inode) | - inode->i_ctime = E1 = current_time(timei) + E1 = inode_set_ctime_current(inode) | - E1 = inode->i_ctime = current_time(timei) + E1 = inode_set_ctime_current(inode) | - inode->i_ctime = current_time(timei) + inode_set_ctime_current(inode) ) @@ struct inode *inode; expression E1, E2, E3; @@ ( - E1 = current_time(inode) + E1 = inode_set_ctime_current(inode) | - E1 = current_time(E3) + E1 = inode_set_ctime_current(inode) ) ... ( - inode->i_ctime = E1; | - E2 = inode->i_ctime = E1; + E2 = E1; ) :: cocci/ctime2.cocci :: // get the places that set individual timespec64 fields @@ struct inode *inode; expression val, val2; @@ - inode->i_ctime.tv_sec = val + inode_set_ctime(inode, val, val2) ... - inode->i_ctime.tv_nsec = val2; // get places that just set the tv_sec @@ struct inode *inode; expression sec, E1, E2, E3; @@ ( - E3 = inode->i_ctime.tv_sec = sec + E3 = inode_set_ctime(inode, sec, 0).tv_sec | - inode->i_ctime.tv_sec = sec + inode_set_ctime(inode, sec, 0) ) <... ( - inode->i_ctime.tv_nsec = 0; | - E1 = inode->i_ctime.tv_nsec = 0 + E1 = 0 | - inode->i_ctime.tv_nsec = E1 = 0 + E1 = 0 | - inode->i_ctime.tv_nsec = E1 = E2 = 0 + E1 = E2 = 0 ) ...> :: cocci/ctime3.cocci :: // convert places that set i_ctime to a timespec64 directly @@ struct inode *inode; expression ts, E1, E2; @@ ( - inode->i_ctime = E1 = E2 = ts + E1 = E2 = inode_set_ctime_to_ts(inode, ts) | - inode->i_ctime = E1 = ts + E1 = inode_set_ctime_to_ts(inode, ts) | - inode->i_ctime = ts + inode_set_ctime_to_ts(inode, ts) ) :: cocci/ctime4.cocci :: // catch places that set the i_ctime in an inode embedded in another structure @@ expression E1, E2, E3; @@ ( - E3.i_ctime = E1 = E2 = current_time() + E1 = E2 = inode_set_ctime_current() | - E3.i_ctime = E1 = current_time() + E1 = inode_set_ctime_current() | - E1 = E3.i_ctime = current_time() + E1 = inode_set_ctime_current() | - E3.i_ctime = current_time() + inode_set_ctime_current() ) :: cocci/ctime5.cocci :: // convert the remaining i_ctime accesses @@ struct inode *inode; @@ - inode->i_ctime + inode_get_ctime(inode) Jeff Layton (92): ibmvmc: update ctime in conjunction with mtime on write bfs: update ctime in addition to mtime when adding entries efivarfs: update ctime when mtime changes on a write exfat: ensure that ctime is updated whenever the mtime is apparmor: update ctime whenever the mtime changes on an inode cifs: update the ctime on a partial page write fs: add ctime accessors infrastructure fs: new helper: simple_rename_timestamp btrfs: convert to simple_rename_timestamp ubifs: convert to simple_rename_timestamp shmem: convert to simple_rename_timestamp exfat: convert to simple_rename_timestamp ntfs3: convert to simple_rename_timestamp reiserfs: convert to simple_rename_timestamp spufs: convert to ctime accessor functions s390: convert to ctime accessor functions binderfs: convert to ctime accessor functions infiniband: convert to ctime accessor functions ibm: convert to ctime accessor functions usb: convert to ctime accessor functions 9p: convert to ctime accessor functions adfs: convert to ctime accessor functions affs: convert to ctime accessor functions afs: convert to ctime accessor functions fs: convert to ctime accessor functions autofs: convert to ctime accessor functions befs: convert to ctime