mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
hfsplus: convert to ctime accessor functions
In later patches, we're going to change how the inode's ctime field is used. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz> Message-Id: <20230705190309.579783-47-jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
7305586a79
commit
101fa821ab
@ -312,7 +312,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,
|
||||
dir->i_size++;
|
||||
if (S_ISDIR(inode->i_mode))
|
||||
hfsplus_subfolders_inc(dir);
|
||||
dir->i_mtime = dir->i_ctime = current_time(dir);
|
||||
dir->i_mtime = inode_set_ctime_current(dir);
|
||||
hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
|
||||
|
||||
hfs_find_exit(&fd);
|
||||
@ -417,7 +417,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)
|
||||
dir->i_size--;
|
||||
if (type == HFSPLUS_FOLDER)
|
||||
hfsplus_subfolders_dec(dir);
|
||||
dir->i_mtime = dir->i_ctime = current_time(dir);
|
||||
dir->i_mtime = inode_set_ctime_current(dir);
|
||||
hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
|
||||
|
||||
if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) {
|
||||
@ -494,7 +494,7 @@ int hfsplus_rename_cat(u32 cnid,
|
||||
dst_dir->i_size++;
|
||||
if (type == HFSPLUS_FOLDER)
|
||||
hfsplus_subfolders_inc(dst_dir);
|
||||
dst_dir->i_mtime = dst_dir->i_ctime = current_time(dst_dir);
|
||||
dst_dir->i_mtime = inode_set_ctime_current(dst_dir);
|
||||
|
||||
/* finally remove the old entry */
|
||||
err = hfsplus_cat_build_key(sb, src_fd.search_key,
|
||||
@ -511,7 +511,7 @@ int hfsplus_rename_cat(u32 cnid,
|
||||
src_dir->i_size--;
|
||||
if (type == HFSPLUS_FOLDER)
|
||||
hfsplus_subfolders_dec(src_dir);
|
||||
src_dir->i_mtime = src_dir->i_ctime = current_time(src_dir);
|
||||
src_dir->i_mtime = inode_set_ctime_current(src_dir);
|
||||
|
||||
/* remove old thread entry */
|
||||
hfsplus_cat_build_key_with_cnid(sb, src_fd.search_key, cnid);
|
||||
|
@ -346,7 +346,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
|
||||
inc_nlink(inode);
|
||||
hfsplus_instantiate(dst_dentry, inode, cnid);
|
||||
ihold(inode);
|
||||
inode->i_ctime = current_time(inode);
|
||||
inode_set_ctime_current(inode);
|
||||
mark_inode_dirty(inode);
|
||||
sbi->file_count++;
|
||||
hfsplus_mark_mdb_dirty(dst_dir->i_sb);
|
||||
@ -405,7 +405,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
|
||||
hfsplus_delete_inode(inode);
|
||||
} else
|
||||
sbi->file_count--;
|
||||
inode->i_ctime = current_time(inode);
|
||||
inode_set_ctime_current(inode);
|
||||
mark_inode_dirty(inode);
|
||||
out:
|
||||
mutex_unlock(&sbi->vh_mutex);
|
||||
@ -426,7 +426,7 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
if (res)
|
||||
goto out;
|
||||
clear_nlink(inode);
|
||||
inode->i_ctime = current_time(inode);
|
||||
inode_set_ctime_current(inode);
|
||||
hfsplus_delete_inode(inode);
|
||||
mark_inode_dirty(inode);
|
||||
out:
|
||||
|
@ -267,7 +267,7 @@ static int hfsplus_setattr(struct mnt_idmap *idmap,
|
||||
}
|
||||
truncate_setsize(inode, attr->ia_size);
|
||||
hfsplus_file_truncate(inode);
|
||||
inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
inode->i_mtime = inode_set_ctime_current(inode);
|
||||
}
|
||||
|
||||
setattr_copy(&nop_mnt_idmap, inode, attr);
|
||||
@ -392,7 +392,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
|
||||
inode->i_ino = sbi->next_cnid++;
|
||||
inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
|
||||
set_nlink(inode, 1);
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
|
||||
inode->i_mtime = inode->i_atime = inode_set_ctime_current(inode);
|
||||
|
||||
hip = HFSPLUS_I(inode);
|
||||
INIT_LIST_HEAD(&hip->open_dir_list);
|
||||
@ -523,7 +523,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
|
||||
inode->i_size = 2 + be32_to_cpu(folder->valence);
|
||||
inode->i_atime = hfsp_mt2ut(folder->access_date);
|
||||
inode->i_mtime = hfsp_mt2ut(folder->content_mod_date);
|
||||
inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date);
|
||||
inode_set_ctime_to_ts(inode,
|
||||
hfsp_mt2ut(folder->attribute_mod_date));
|
||||
HFSPLUS_I(inode)->create_date = folder->create_date;
|
||||
HFSPLUS_I(inode)->fs_blocks = 0;
|
||||
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
|
||||
@ -564,7 +565,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
|
||||
}
|
||||
inode->i_atime = hfsp_mt2ut(file->access_date);
|
||||
inode->i_mtime = hfsp_mt2ut(file->content_mod_date);
|
||||
inode->i_ctime = hfsp_mt2ut(file->attribute_mod_date);
|
||||
inode_set_ctime_to_ts(inode,
|
||||
hfsp_mt2ut(file->attribute_mod_date));
|
||||
HFSPLUS_I(inode)->create_date = file->create_date;
|
||||
} else {
|
||||
pr_err("bad catalog entry used to create inode\n");
|
||||
@ -609,7 +611,7 @@ int hfsplus_cat_write_inode(struct inode *inode)
|
||||
hfsplus_cat_set_perms(inode, &folder->permissions);
|
||||
folder->access_date = hfsp_ut2mt(inode->i_atime);
|
||||
folder->content_mod_date = hfsp_ut2mt(inode->i_mtime);
|
||||
folder->attribute_mod_date = hfsp_ut2mt(inode->i_ctime);
|
||||
folder->attribute_mod_date = hfsp_ut2mt(inode_get_ctime(inode));
|
||||
folder->valence = cpu_to_be32(inode->i_size - 2);
|
||||
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
|
||||
folder->subfolders =
|
||||
@ -644,7 +646,7 @@ int hfsplus_cat_write_inode(struct inode *inode)
|
||||
file->flags &= cpu_to_be16(~HFSPLUS_FILE_LOCKED);
|
||||
file->access_date = hfsp_ut2mt(inode->i_atime);
|
||||
file->content_mod_date = hfsp_ut2mt(inode->i_mtime);
|
||||
file->attribute_mod_date = hfsp_ut2mt(inode->i_ctime);
|
||||
file->attribute_mod_date = hfsp_ut2mt(inode_get_ctime(inode));
|
||||
hfs_bnode_write(fd.bnode, &entry, fd.entryoffset,
|
||||
sizeof(struct hfsplus_cat_file));
|
||||
}
|
||||
@ -700,7 +702,7 @@ int hfsplus_fileattr_set(struct mnt_idmap *idmap,
|
||||
else
|
||||
hip->userflags &= ~HFSPLUS_FLG_NODUMP;
|
||||
|
||||
inode->i_ctime = current_time(inode);
|
||||
inode_set_ctime_current(inode);
|
||||
mark_inode_dirty(inode);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user