From: Jeff Layton <jlayton@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: jk@ozlabs.org, arnd@arndb.de, mpe@ellerman.id.au,
npiggin@gmail.com, christophe.leroy@csgroup.eu,
hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com,
borntraeger@linux.ibm.com, svens@linux.ibm.com,
gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com,
maco@android.com, joel@joelfernandes.org, brauner@kernel.org,
cmllamas@google.com, surenb@google.com,
dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca,
leon@kernel.org, bwarrum@linux.ibm.com, rituagar@linux.ibm.com,
ericvh@kernel.org, lucho@ionkov.net, asmadeus@codewreck.org,
linux_oss@crudebyte.com, dsterba@suse.com, dhowells@redhat.com,
marc.dionne@auristor.com, viro@zeniv.linux.org.uk,
raven@themaw.net, luisbg@kernel.org, salah.triki@gmail.com,
aivazian.tigran@gmail.com, ebiederm@xmission.com,
keescook@chromium.org, clm@fb.com, josef@toxicpanda.com,
xiubli@redhat.com, idryomov@gmail.com, jaharkes@cs.cmu.edu,
coda@cs.cmu.edu, jlbec@evilplan.org, hch@lst.de,
nico@fluxnic.net, rafael@kernel.org, code@tyhicks.com,
ardb@kernel.org, xiang@kernel.org, chao@kernel.org,
huyue2@coolpad.com, jefflexu@linux.alibaba.com,
linkinjeon@kernel.org, sj1557.seo@samsung.com, jack@suse.com,
tytso@mit.edu, adilger.kernel@dilger.ca, jaegeuk@kernel.org,
hirofumi@mail.parknet.co.jp, miklos@szeredi.hu,
rpeterso@redhat.com, agruenba@redhat.com, richard@nod.at,
anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net,
mikulas@artax.karlin.mff.cuni.cz, mike.kravetz@oracle.com,
muchun.song@linux.dev, dwmw2@infradead.org, shaggy@kernel.org,
tj@kernel.org, trond.myklebust@hammerspace.com, anna@kernel.org,
chuck.lever@oracle.com, neilb@suse.de, kolga@netapp.com,
Dai.Ngo@oracle.com, tom@talpey.com, konishi.ryusuke@gmail.com,
anton@tuxera.com, almaz.alexandrovich@paragon-software.com,
mark@fasheh.com, joseph.qi@linux.alibaba.com, me@bobcopeland.com,
hubcap@omnibond.com, martin@omnibond.com, amir73il@gmail.com,
mcgrof@kernel.org, yzaikin@google.com, tony.luck@intel.com,
gpiccoli@igalia.com, al@alarsen.net, sfrench@samba.org,
pc@manguebit.com, lsahlber@redhat.com, sprasad@microsoft.com,
senozhatsky@chromium.org, phillip@squashfs.org.uk,
rostedt@goodmis.org, mhiramat@kernel.org, dushistov@mail.ru,
hdegoede@redhat.com, djwong@kernel.org, dlemoal@kernel.org,
naohiro.aota@wdc.com, jth@kernel.org, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev,
song@kernel.org, yhs@fb.com, john.fastabend@gmail.com,
kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
jolsa@kernel.org, hughd@google.com, akpm@linux-foundation.org,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, john.johansen@canonical.com,
paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com,
stephen.smalley.work@gmail.com, eparis@parisplace.org,
jgross@suse.com, stern@rowland.harvard.edu, lrh2000@pku.edu.cn,
sebastian.reichel@collabora.com,
wsa+renesas@sang-engineering.com, quic_ugoswami@quicinc.com,
quic_linyyuan@quicinc.com, john@keeping.me.uk, error27@gmail.com,
quic_uaggarwa@quicinc.com, hayama@lineo.co.jp, jomajm@gmail.com,
axboe@kernel.dk, dhavale@google.com, dchinner@redhat.com,
hannes@cmpxchg.org, zhangpeng362@huawei.com, slava@dubeyko.com,
gargaditya08@live.com, penguin-kernel@I-love.SAKURA.ne.jp,
yifeliu@cs.stonybrook.edu, madkar@cs.stonybrook.edu,
ezk@cs.stonybrook.edu, yuzhe@nfschina.com, willy@infradead.org,
okanatov@gmail.com, jeffxu@chromium.org, linux@treblig.org,
mirimmad17@gmail.com, yijiangshan@kylinos.cn,
yang.yang29@zte.com.cn, xu.xin16@zte.com.cn,
chengzhihao1@huawei.com, shr@devkernel.io,
Liam.Howlett@Oracle.com, adobriyan@gmail.com,
chi.minghao@zte.com.cn, roberto.sassu@huawei.com,
linuszeng@tencent.com, bvanassche@acm.org, zohar@linux.ibm.com,
yi.zhang@huawei.com, trix@redhat.com, fmdefrancesco@gmail.com,
ebiggers@google.com, princekumarmaurya06@gmail.com,
chenzhongjin@huawei.com, riel@surriel.com,
shaozhengchao@huawei.com, jingyuwang_vip@163.com,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-usb@vger.kernel.org, v9fs@lists.linux.dev,
linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org,
autofs@vger.kernel.org, linux-mm@kvack.org,
linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org,
codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org,
linux-efi@vger.kernel.org, linux-erofs@lists.ozlabs.org,
linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
linux-um@lists.infradead.org, linux-mtd@lists.infradead.org,
jfs-discussion@lists.sourceforge.net, linux-nfs@vger.kernel.org,
linux-nilfs@vger.kernel.org,
linux-ntfs-dev@lists.sourceforge.net, ntfs3@lists.linux.dev,
ocfs2-devel@lists.linux.dev,
linux-karma-devel@lists.sourceforge.net,
devel@lists.orangefs.org, linux-unionfs@vger.kernel.org,
linux-hardening@vger.kernel.org, reiserfs-devel@vger.kernel.org,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
linux-trace-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
bpf@vger.kernel.org, netdev@vger.kernel.org,
apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
selinux@vger.kernel.org
Subject: Re: [PATCH v2 00/89] fs: new accessors for inode->i_ctime
Date: Fri, 07 Jul 2023 08:42:31 -0400 [thread overview]
Message-ID: <5e40891f6423feb5b68f025e31f26e9a50ae9390.camel@kernel.org> (raw)
In-Reply-To: <20230705185812.579118-1-jlayton@kernel.org>
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, &ictime) > 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(&sbi->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 = ext4_encode_extra_time(ts); \
+ } else \
+ (raw_inode)->xtime = cpu_to_le32(clamp_t(int32_t, (ts).tv_sec, S32_MIN, S32_MAX)); \
} while (0)
+#define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \
+ EXT4_INODE_SET_XTIME_VAL(xtime, inode, raw_inode, (inode)->xtime)
+
+#define EXT4_INODE_SET_CTIME(inode, raw_inode) \
+ EXT4_INODE_SET_XTIME_VAL(i_ctime, inode, raw_inode, inode_get_ctime(inode))
+
#define EXT4_EINODE_SET_XTIME(xtime, einode, raw_inode) \
-do { \
- if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
- (raw_inode)->xtime = cpu_to_le32((einode)->xtime.tv_sec); \
- if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
- (raw_inode)->xtime ## _extra = \
- ext4_encode_extra_time(&(einode)->xtime); \
-} while (0)
+ EXT4_INODE_SET_XTIME_VAL(xtime, &((einode)->vfs_inode), raw_inode, (einode)->xtime)
+
+#define EXT4_INODE_GET_XTIME_VAL(xtime, inode, raw_inode) \
+ (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra) ? \
+ ext4_decode_extra_time((raw_inode)->xtime, \
+ (raw_inode)->xtime ## _extra) : \
+ (struct timespec64) { \
+ .tv_sec = (signed)le32_to_cpu((raw_inode)->xtime) \
+ })
#define EXT4_INODE_GET_XTIME(xtime, inode, raw_inode) \
do { \
- (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \
- if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) { \
- ext4_decode_extra_time(&(inode)->xtime, \
- raw_inode->xtime ## _extra); \
- } \
- else \
- (inode)->xtime.tv_nsec = 0; \
+ (inode)->xtime = EXT4_INODE_GET_XTIME_VAL(xtime, inode, raw_inode); \
} while (0)
+#define EXT4_INODE_GET_CTIME(inode, raw_inode) \
+do { \
+ inode_set_ctime_to_ts(inode, \
+ EXT4_INODE_GET_XTIME_VAL(i_ctime, inode, raw_inode)); \
+} while (0)
#define EXT4_EINODE_GET_XTIME(xtime, einode, raw_inode) \
do { \
- if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime)) \
- (einode)->xtime.tv_sec = \
- (signed)le32_to_cpu((raw_inode)->xtime); \
- else \
- (einode)->xtime.tv_sec = 0; \
- if (EXT4_FITS_IN_INODE(raw_inode, einode, xtime ## _extra)) \
- ext4_decode_extra_time(&(einode)->xtime, \
- raw_inode->xtime ## _extra); \
- else \
- (einode)->xtime.tv_nsec = 0; \
+ (einode)->xtime = EXT4_INODE_GET_XTIME_VAL(xtime, &(einode->vfs_inode), raw_inode); \
} while (0)
#define i_disk_version osd1.linux1.l_i_version
@@ -3823,27 +3822,6 @@ static inline int ext4_buffer_uptodate(struct buffer_head *bh)
return buffer_uptodate(bh);
}
-static inline void ext4_inode_set_ctime(struct inode *inode, struct ext4_inode *raw_inode)
-{
- struct timespec64 ctime = inode_get_ctime(inode);
-
- if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), i_ctime_extra)) {
- raw_inode->i_ctime = cpu_to_le32(ctime.tv_sec);
- raw_inode->i_ctime_extra = ext4_encode_extra_time(&ctime);
- } else {
- raw_inode->i_ctime = cpu_to_le32(clamp_t(int32_t, ctime.tv_sec, S32_MIN, S32_MAX));
- }
-}
-
-static inline void ext4_inode_get_ctime(struct inode *inode, const struct ext4_inode *raw_inode)
-{
- struct timespec64 ctime = { .tv_sec = (signed)le32_to_cpu(raw_inode->i_ctime) };
-
- if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), i_ctime_extra))
- ext4_decode_extra_time(&ctime, raw_inode->i_ctime_extra);
- inode_set_ctime(inode, ctime.tv_sec, ctime.tv_nsec);
-}
-
#endif /* __KERNEL__ */
#define EFSBADCRC EBADMSG /* Bad CRC detected */
diff --git a/fs/ext4/inode-test.c b/fs/ext4/inode-test.c
index 7935ea6cf92c..f0c0fd507fbc 100644
--- a/fs/ext4/inode-test.c
+++ b/fs/ext4/inode-test.c
@@ -245,9 +245,9 @@ static void inode_test_xtimestamp_decoding(struct kunit *test)
struct timestamp_expectation *test_param =
(struct timestamp_expectation *)(test->param_value);
- timestamp.tv_sec = get_32bit_time(test_param);
- ext4_decode_extra_time(×tamp,
- cpu_to_le32(test_param->extra_bits));
+ timestamp = ext4_decode_extra_time(
+ cpu_to_le32(get_32bit_time(test_param)),
+ cpu_to_le32(test_param->extra_bits));
KUNIT_EXPECT_EQ_MSG(test,
test_param->expected.tv_sec,
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index bbc57954dfd3..c6a837b90af4 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4249,7 +4249,7 @@ static int ext4_fill_raw_inode(struct inode *inode, struct ext4_inode *raw_inode
}
raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
- ext4_inode_set_ctime(inode, raw_inode);
+ EXT4_INODE_SET_CTIME(inode, raw_inode);
EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
@@ -4858,7 +4858,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
}
}
- ext4_inode_get_ctime(inode, raw_inode);
+ EXT4_INODE_GET_CTIME(inode, raw_inode);
EXT4_INODE_GET_XTIME(i_mtime, inode, raw_inode);
EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode);
EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
@@ -4981,7 +4981,7 @@ static void __ext4_update_other_inode_time(struct super_block *sb,
spin_unlock(&inode->i_lock);
spin_lock(&ei->i_raw_lock);
- ext4_inode_get_ctime(inode, raw_inode);
+ EXT4_INODE_SET_CTIME(inode, raw_inode);
EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
ext4_inode_csum_set(inode, raw_inode, ei);
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 2be40ff8a74f..cdd39b6020f3 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1407,9 +1407,7 @@ static int fat_read_root(struct inode *inode)
MSDOS_I(inode)->mmu_private = inode->i_size;
fat_save_attrs(inode, ATTR_DIR);
- inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode_set_ctime(inode,
- 0, 0).tv_sec;
- inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = 0;
+ inode->i_mtime = inode->i_atime = inode_set_ctime(inode, 0, 0);
set_nlink(inode, fat_subdirs(inode)+2);
return 0;
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 36babb78b510..f4eb8d6f5989 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -15,8 +15,7 @@ static void hpfs_update_directory_times(struct inode *dir)
if (t == dir->i_mtime.tv_sec &&
t == inode_get_ctime(dir).tv_sec)
return;
- dir->i_mtime.tv_sec = inode_set_ctime(dir, t, 0).tv_sec;
- dir->i_mtime.tv_nsec = 0;
+ dir->i_mtime = inode_set_ctime(dir, t, 0);
hpfs_write_inode_nolock(dir);
}
@@ -59,11 +58,8 @@ static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
result->i_ino = fno;
hpfs_i(result)->i_parent_dir = dir->i_ino;
hpfs_i(result)->i_dno = dno;
- inode_set_ctime(result,
- result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
- 0);
- result->i_mtime.tv_nsec = 0;
- result->i_atime.tv_nsec = 0;
+ result->i_mtime = result->i_atime =
+ inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
hpfs_i(result)->i_ea_size = 0;
result->i_mode |= S_IFDIR;
result->i_op = &hpfs_dir_iops;
@@ -168,11 +164,8 @@ static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir,
result->i_fop = &hpfs_file_ops;
set_nlink(result, 1);
hpfs_i(result)->i_parent_dir = dir->i_ino;
- inode_set_ctime(result,
- result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
- 0);
- result->i_mtime.tv_nsec = 0;
- result->i_atime.tv_nsec = 0;
+ result->i_mtime = result->i_atime =
+ inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
hpfs_i(result)->i_ea_size = 0;
if (dee.read_only)
result->i_mode &= ~0222;
@@ -252,11 +245,8 @@ static int hpfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
hpfs_init_inode(result);
result->i_ino = fno;
hpfs_i(result)->i_parent_dir = dir->i_ino;
- inode_set_ctime(result,
- result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
- 0);
- result->i_mtime.tv_nsec = 0;
- result->i_atime.tv_nsec = 0;
+ result->i_mtime = result->i_atime =
+ inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
hpfs_i(result)->i_ea_size = 0;
result->i_uid = current_fsuid();
result->i_gid = current_fsgid();
@@ -329,11 +319,8 @@ static int hpfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
result->i_ino = fno;
hpfs_init_inode(result);
hpfs_i(result)->i_parent_dir = dir->i_ino;
- inode_set_ctime(result,
- result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
- 0);
- result->i_mtime.tv_nsec = 0;
- result->i_atime.tv_nsec = 0;
+ result->i_mtime = result->i_atime =
+ inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
hpfs_i(result)->i_ea_size = 0;
result->i_mode = S_IFLNK | 0777;
result->i_uid = current_fsuid();
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 98a78200cff1..2ee21286ac8f 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1422,13 +1422,8 @@ static int isofs_read_inode(struct inode *inode, int relocated)
inode->i_ino, de->flags[-high_sierra]);
}
#endif
-
- inode->i_mtime.tv_sec =
- inode->i_atime.tv_sec = inode_set_ctime(inode,
- iso_date(de->date, high_sierra),
- 0).tv_sec;
- inode->i_mtime.tv_nsec =
- inode->i_atime.tv_nsec = 0;
+ inode->i_mtime = inode->i_atime =
+ inode_set_ctime(inode, iso_date(de->date, high_sierra), 0);
ei->i_first_extent = (isonum_733(de->extent) +
isonum_711(de->ext_attr_length));
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 3715a3940bd4..8a4fc9420b36 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -501,11 +501,7 @@ static struct inode *V1_minix_iget(struct inode *inode)
i_gid_write(inode, raw_inode->i_gid);
set_nlink(inode, raw_inode->i_nlinks);
inode->i_size = raw_inode->i_size;
- inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode_set_ctime(inode,
- raw_inode->i_time,
- 0).tv_sec;
- inode->i_mtime.tv_nsec = 0;
- inode->i_atime.tv_nsec = 0;
+ inode->i_mtime = inode->i_atime = inode_set_ctime(inode, raw_inode->i_time, 0);
inode->i_blocks = 0;
for (i = 0; i < 9; i++)
minix_inode->u.i1_data[i] = raw_inode->i_zone[i];
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 7acd3e3fe790..7e7876aae01c 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -255,7 +255,7 @@ static void ovl_file_accessed(struct file *file)
if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) ||
!timespec64_equal(&ctime, &uctime))) {
inode->i_mtime = upperinode->i_mtime;
- inode_set_ctime_to_ts(inode, inode_get_ctime(upperinode));
+ inode_set_ctime_to_ts(inode, uctime);
}
touch_atime(&file->f_path);
diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index 961b9d342e0e..d89739655f9e 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -322,8 +322,7 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos)
set_nlink(i, 1); /* Hard to decide.. */
i->i_size = be32_to_cpu(ri.size);
- i->i_mtime.tv_sec = i->i_atime.tv_sec = inode_set_ctime(i, 0, 0).tv_sec;
- i->i_mtime.tv_nsec = i->i_atime.tv_nsec = 0;
+ i->i_mtime = i->i_atime = inode_set_ctime(i, 0, 0);
/* set up mode and ops */
mode = romfs_modemap[nextfh & ROMFH_TYPE];
diff --git a/fs/smb/client/fscache.h b/fs/smb/client/fscache.h
index a228964bc2ce..84f3b09367d2 100644
--- a/fs/smb/client/fscache.h
+++ b/fs/smb/client/fscache.h
@@ -56,7 +56,7 @@ void cifs_fscache_fill_coherency(struct inode *inode,
cd->last_write_time_sec = cpu_to_le64(cifsi->netfs.inode.i_mtime.tv_sec);
cd->last_write_time_nsec = cpu_to_le32(cifsi->netfs.inode.i_mtime.tv_nsec);
cd->last_change_time_sec = cpu_to_le64(ctime.tv_sec);
- cd->last_change_time_nsec = cpu_to_le64(ctime.tv_nsec);
+ cd->last_change_time_nsec = cpu_to_le32(ctime.tv_nsec);
}
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2023-07-07 12:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 18:58 [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
2023-07-05 18:58 ` [PATCH v2 07/92] fs: add ctime accessors infrastructure Jeff Layton
2023-07-05 23:12 ` Damien Le Moal
2023-07-05 18:58 ` [PATCH v2 08/92] fs: new helper: simple_rename_timestamp Jeff Layton
2023-07-05 23:19 ` Damien Le Moal
2023-07-06 0:04 ` Jeff Layton
2023-07-06 21:02 ` [apparmor] " Seth Arnold
2023-07-07 10:50 ` Jeff Layton
2023-07-06 10:27 ` Jan Kara
2023-08-30 0:19 ` Al Viro
2023-08-30 0:48 ` Jeff Layton
2023-07-05 18:58 ` [PATCH v2 92/92] fs: rename i_ctime field to __i_ctime Jeff Layton
2023-07-05 23:19 ` Damien Le Moal
2023-07-06 14:58 ` Jan Kara
2023-07-05 21:57 ` [PATCH v2 00/89] fs: new accessors for inode->i_ctime Jeff Layton
2023-07-06 15:16 ` Eric W. Biederman
2023-07-06 16:14 ` Jeff Layton
2023-07-07 12:42 ` Jeff Layton [this message]
2023-07-10 12:35 ` Christian Brauner
2023-07-10 13:32 ` Jeff Layton
2023-07-10 12:18 ` [PATCH v2 00/92] " Christian Brauner
2023-09-04 18:11 ` [f2fs-dev] [PATCH v2 00/89] " patchwork-bot+f2fs
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=5e40891f6423feb5b68f025e31f26e9a50ae9390.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=Liam.Howlett@Oracle.com \
--cc=adilger.kernel@dilger.ca \
--cc=adobriyan@gmail.com \
--cc=agordeev@linux.ibm.com \
--cc=agruenba@redhat.com \
--cc=aivazian.tigran@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=al@alarsen.net \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=amir73il@gmail.com \
--cc=andrii@kernel.org \
--cc=anna@kernel.org \
--cc=anton.ivanov@cambridgegreys.com \
--cc=anton@tuxera.com \
--cc=apparmor@lists.ubuntu.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=arve@android.com \
--cc=asmadeus@codewreck.org \
--cc=ast@kernel.org \
--cc=autofs@vger.kernel.org \
--cc=axboe@kernel.dk \
--cc=borntraeger@linux.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=bvanassche@acm.org \
--cc=bwarrum@linux.ibm.com \
--cc=ceph-devel@vger.kernel.org \
--cc=chao@kernel.org \
--cc=chengzhihao1@huawei.com \
--cc=chenzhongjin@huawei.com \
--cc=chi.minghao@zte.com.cn \
--cc=christophe.leroy@csgroup.eu \
--cc=chuck.lever@oracle.com \
--cc=clm@fb.com \
--cc=cluster-devel@redhat.com \
--cc=cmllamas@google.com \
--cc=coda@cs.cmu.edu \
--cc=codalist@coda.cs.cmu.edu \
--cc=code@tyhicks.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dchinner@redhat.com \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=devel@lists.orangefs.org \
--cc=dhavale@google.com \
--cc=dhowells@redhat.com \
--cc=djwong@kernel.org \
--cc=dlemoal@kernel.org \
--cc=dsterba@suse.com \
--cc=dushistov@mail.ru \
--cc=dwmw2@infradead.org \
--cc=ebiederm@xmission.com \
--cc=ebiggers@google.com \
--cc=ecryptfs@vger.kernel.org \
--cc=edumazet@google.com \
--cc=eparis@parisplace.org \
--cc=ericvh@kernel.org \
--cc=error27@gmail.com \
--cc=ezk@cs.stonybrook.edu \
--cc=fmdefrancesco@gmail.com \
--cc=gargaditya08@live.com \
--cc=gor@linux.ibm.com \
--cc=gpiccoli@igalia.com \
--cc=gregkh@linuxfoundation.org \
--cc=hannes@cmpxchg.org \
--cc=haoluo@google.com \
--cc=hayama@lineo.co.jp \
--cc=hca@linux.ibm.com \
--cc=hch@lst.de \
--cc=hdegoede@redhat.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=hubcap@omnibond.com \
--cc=hughd@google.com \
--cc=huyue2@coolpad.com \
--cc=idryomov@gmail.com \
--cc=jack@suse.com \
--cc=jaegeuk@kernel.org \
--cc=jaharkes@cs.cmu.edu \
--cc=jefflexu@linux.alibaba.com \
--cc=jeffxu@chromium.org \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=jgg@ziepe.ca \
--cc=jgross@suse.com \
--cc=jingyuwang_vip@163.com \
--cc=jk@ozlabs.org \
--cc=jlbec@evilplan.org \
--cc=jmorris@namei.org \
--cc=joel@joelfernandes.org \
--cc=johannes@sipsolutions.net \
--cc=john.fastabend@gmail.com \
--cc=john.johansen@canonical.com \
--cc=john@keeping.me.uk \
--cc=jolsa@kernel.org \
--cc=jomajm@gmail.com \
--cc=josef@toxicpanda.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=jth@kernel.org \
--cc=keescook@chromium.org \
--cc=kolga@netapp.com \
--cc=konishi.ryusuke@gmail.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linkinjeon@kernel.org \
--cc=linuszeng@tencent.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-karma-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
--cc=linux-ntfs-dev@lists.sourceforge.net \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=linux@treblig.org \
--cc=linux_oss@crudebyte.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lrh2000@pku.edu.cn \
--cc=lsahlber@redhat.com \
--cc=lucho@ionkov.net \
--cc=luisbg@kernel.org \
--cc=maco@android.com \
--cc=madkar@cs.stonybrook.edu \
--cc=marc.dionne@auristor.com \
--cc=mark@fasheh.com \
--cc=martin.lau@linux.dev \
--cc=martin@omnibond.com \
--cc=mcgrof@kernel.org \
--cc=me@bobcopeland.com \
--cc=mhiramat@kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=miklos@szeredi.hu \
--cc=mikulas@artax.karlin.mff.cuni.cz \
--cc=mirimmad17@gmail.com \
--cc=mpe@ellerman.id.au \
--cc=muchun.song@linux.dev \
--cc=naohiro.aota@wdc.com \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=nico@fluxnic.net \
--cc=npiggin@gmail.com \
--cc=ntfs3@lists.linux.dev \
--cc=ocfs2-devel@lists.linux.dev \
--cc=okanatov@gmail.com \
--cc=pabeni@redhat.com \
--cc=paul@paul-moore.com \
--cc=pc@manguebit.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=phillip@squashfs.org.uk \
--cc=princekumarmaurya06@gmail.com \
--cc=quic_linyyuan@quicinc.com \
--cc=quic_uaggarwa@quicinc.com \
--cc=quic_ugoswami@quicinc.com \
--cc=rafael@kernel.org \
--cc=raven@themaw.net \
--cc=reiserfs-devel@vger.kernel.org \
--cc=richard@nod.at \
--cc=riel@surriel.com \
--cc=rituagar@linux.ibm.com \
--cc=roberto.sassu@huawei.com \
--cc=rostedt@goodmis.org \
--cc=rpeterso@redhat.com \
--cc=salah.triki@gmail.com \
--cc=samba-technical@lists.samba.org \
--cc=sdf@google.com \
--cc=sebastian.reichel@collabora.com \
--cc=selinux@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=serge@hallyn.com \
--cc=sfrench@samba.org \
--cc=shaggy@kernel.org \
--cc=shaozhengchao@huawei.com \
--cc=shr@devkernel.io \
--cc=sj1557.seo@samsung.com \
--cc=slava@dubeyko.com \
--cc=song@kernel.org \
--cc=sprasad@microsoft.com \
--cc=stephen.smalley.work@gmail.com \
--cc=stern@rowland.harvard.edu \
--cc=surenb@google.com \
--cc=svens@linux.ibm.com \
--cc=tj@kernel.org \
--cc=tkjos@android.com \
--cc=tom@talpey.com \
--cc=tony.luck@intel.com \
--cc=trix@redhat.com \
--cc=trond.myklebust@hammerspace.com \
--cc=tytso@mit.edu \
--cc=v9fs@lists.linux.dev \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=xiang@kernel.org \
--cc=xiubli@redhat.com \
--cc=xu.xin16@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
--cc=yhs@fb.com \
--cc=yi.zhang@huawei.com \
--cc=yifeliu@cs.stonybrook.edu \
--cc=yijiangshan@kylinos.cn \
--cc=yuzhe@nfschina.com \
--cc=yzaikin@google.com \
--cc=zhangpeng362@huawei.com \
--cc=zohar@linux.ibm.com \
/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).