nilfs2: convert to new timestamp accessors
authorJeff Layton <jlayton@kernel.org>
Wed, 4 Oct 2023 18:52:38 +0000 (14:52 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 18 Oct 2023 12:08:24 +0000 (14:08 +0200)
Convert to using the new inode timestamp accessor functions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20231004185347.80880-51-jlayton@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/nilfs2/dir.c
fs/nilfs2/inode.c

index bce734b68f08e592e993b7a7723b9ab84af60e1b..de2073c476516dcbbf39ac5a79331a7480d0b0dc 100644 (file)
@@ -429,7 +429,7 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
        nilfs_set_de_type(de, inode);
        nilfs_commit_chunk(page, mapping, from, to);
        nilfs_put_page(page);
-       dir->i_mtime = inode_set_ctime_current(dir);
+       inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 }
 
 /*
@@ -519,7 +519,7 @@ got_it:
        de->inode = cpu_to_le64(inode->i_ino);
        nilfs_set_de_type(de, inode);
        nilfs_commit_chunk(page, page->mapping, from, to);
-       dir->i_mtime = inode_set_ctime_current(dir);
+       inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
        nilfs_mark_inode_dirty(dir);
        /* OFFSET_CACHE */
 out_put:
@@ -567,7 +567,7 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
                pde->rec_len = nilfs_rec_len_to_disk(to - from);
        dir->inode = 0;
        nilfs_commit_chunk(page, mapping, from, to);
-       inode->i_mtime = inode_set_ctime_current(inode);
+       inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
 out:
        nilfs_put_page(page);
        return err;
index 1a8bd599347610d1e0e32489fb0dd764b474030d..f861f3a0bf5cf244c40a70b0d111d0b153a42ee9 100644 (file)
@@ -366,7 +366,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
        atomic64_inc(&root->inodes_count);
        inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
        inode->i_ino = ino;
-       inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
+       simple_inode_init_ts(inode);
 
        if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) {
                err = nilfs_bmap_read(ii->i_bmap, NULL);
@@ -449,12 +449,12 @@ int nilfs_read_inode_common(struct inode *inode,
        i_gid_write(inode, le32_to_cpu(raw_inode->i_gid));
        set_nlink(inode, le16_to_cpu(raw_inode->i_links_count));
        inode->i_size = le64_to_cpu(raw_inode->i_size);
-       inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
+       inode_set_atime(inode, le64_to_cpu(raw_inode->i_mtime),
+                       le32_to_cpu(raw_inode->i_mtime_nsec));
        inode_set_ctime(inode, le64_to_cpu(raw_inode->i_ctime),
                        le32_to_cpu(raw_inode->i_ctime_nsec));
-       inode->i_mtime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
-       inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
-       inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
+       inode_set_mtime(inode, le64_to_cpu(raw_inode->i_mtime),
+                       le32_to_cpu(raw_inode->i_mtime_nsec));
        if (nilfs_is_metadata_file_inode(inode) && !S_ISREG(inode->i_mode))
                return -EIO; /* this inode is for metadata and corrupted */
        if (inode->i_nlink == 0)
@@ -768,10 +768,10 @@ void nilfs_write_inode_common(struct inode *inode,
        raw_inode->i_gid = cpu_to_le32(i_gid_read(inode));
        raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
        raw_inode->i_size = cpu_to_le64(inode->i_size);
-       raw_inode->i_ctime = cpu_to_le64(inode_get_ctime(inode).tv_sec);
-       raw_inode->i_mtime = cpu_to_le64(inode->i_mtime.tv_sec);
-       raw_inode->i_ctime_nsec = cpu_to_le32(inode_get_ctime(inode).tv_nsec);
-       raw_inode->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
+       raw_inode->i_ctime = cpu_to_le64(inode_get_ctime_sec(inode));
+       raw_inode->i_mtime = cpu_to_le64(inode_get_mtime_sec(inode));
+       raw_inode->i_ctime_nsec = cpu_to_le32(inode_get_ctime_nsec(inode));
+       raw_inode->i_mtime_nsec = cpu_to_le32(inode_get_mtime_nsec(inode));
        raw_inode->i_blocks = cpu_to_le64(inode->i_blocks);
 
        raw_inode->i_flags = cpu_to_le32(ii->i_flags);
@@ -875,7 +875,7 @@ void nilfs_truncate(struct inode *inode)
 
        nilfs_truncate_bmap(ii, blkoff);
 
-       inode->i_mtime = inode_set_ctime_current(inode);
+       inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
        if (IS_SYNC(inode))
                nilfs_set_transaction_flag(NILFS_TI_SYNC);