mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04: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
3 changed files with 16 additions and 14 deletions
|
@ -312,7 +312,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,
|
||||||
dir->i_size++;
|
dir->i_size++;
|
||||||
if (S_ISDIR(inode->i_mode))
|
if (S_ISDIR(inode->i_mode))
|
||||||
hfsplus_subfolders_inc(dir);
|
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);
|
hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
|
||||||
|
|
||||||
hfs_find_exit(&fd);
|
hfs_find_exit(&fd);
|
||||||
|
@ -417,7 +417,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)
|
||||||
dir->i_size--;
|
dir->i_size--;
|
||||||
if (type == HFSPLUS_FOLDER)
|
if (type == HFSPLUS_FOLDER)
|
||||||
hfsplus_subfolders_dec(dir);
|
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);
|
hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
|
||||||
|
|
||||||
if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) {
|
if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) {
|
||||||
|
@ -494,7 +494,7 @@ int hfsplus_rename_cat(u32 cnid,
|
||||||
dst_dir->i_size++;
|
dst_dir->i_size++;
|
||||||
if (type == HFSPLUS_FOLDER)
|
if (type == HFSPLUS_FOLDER)
|
||||||
hfsplus_subfolders_inc(dst_dir);
|
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 */
|
/* finally remove the old entry */
|
||||||
err = hfsplus_cat_build_key(sb, src_fd.search_key,
|
err = hfsplus_cat_build_key(sb, src_fd.search_key,
|
||||||
|
@ -511,7 +511,7 @@ int hfsplus_rename_cat(u32 cnid,
|
||||||
src_dir->i_size--;
|
src_dir->i_size--;
|
||||||
if (type == HFSPLUS_FOLDER)
|
if (type == HFSPLUS_FOLDER)
|
||||||
hfsplus_subfolders_dec(src_dir);
|
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 */
|
/* remove old thread entry */
|
||||||
hfsplus_cat_build_key_with_cnid(sb, src_fd.search_key, cnid);
|
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);
|
inc_nlink(inode);
|
||||||
hfsplus_instantiate(dst_dentry, inode, cnid);
|
hfsplus_instantiate(dst_dentry, inode, cnid);
|
||||||
ihold(inode);
|
ihold(inode);
|
||||||
inode->i_ctime = current_time(inode);
|
inode_set_ctime_current(inode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
sbi->file_count++;
|
sbi->file_count++;
|
||||||
hfsplus_mark_mdb_dirty(dst_dir->i_sb);
|
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);
|
hfsplus_delete_inode(inode);
|
||||||
} else
|
} else
|
||||||
sbi->file_count--;
|
sbi->file_count--;
|
||||||
inode->i_ctime = current_time(inode);
|
inode_set_ctime_current(inode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&sbi->vh_mutex);
|
mutex_unlock(&sbi->vh_mutex);
|
||||||
|
@ -426,7 +426,7 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
if (res)
|
if (res)
|
||||||
goto out;
|
goto out;
|
||||||
clear_nlink(inode);
|
clear_nlink(inode);
|
||||||
inode->i_ctime = current_time(inode);
|
inode_set_ctime_current(inode);
|
||||||
hfsplus_delete_inode(inode);
|
hfsplus_delete_inode(inode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -267,7 +267,7 @@ static int hfsplus_setattr(struct mnt_idmap *idmap,
|
||||||
}
|
}
|
||||||
truncate_setsize(inode, attr->ia_size);
|
truncate_setsize(inode, attr->ia_size);
|
||||||
hfsplus_file_truncate(inode);
|
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);
|
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->i_ino = sbi->next_cnid++;
|
||||||
inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
|
inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
|
||||||
set_nlink(inode, 1);
|
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);
|
hip = HFSPLUS_I(inode);
|
||||||
INIT_LIST_HEAD(&hip->open_dir_list);
|
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_size = 2 + be32_to_cpu(folder->valence);
|
||||||
inode->i_atime = hfsp_mt2ut(folder->access_date);
|
inode->i_atime = hfsp_mt2ut(folder->access_date);
|
||||||
inode->i_mtime = hfsp_mt2ut(folder->content_mod_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)->create_date = folder->create_date;
|
||||||
HFSPLUS_I(inode)->fs_blocks = 0;
|
HFSPLUS_I(inode)->fs_blocks = 0;
|
||||||
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
|
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_atime = hfsp_mt2ut(file->access_date);
|
||||||
inode->i_mtime = hfsp_mt2ut(file->content_mod_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;
|
HFSPLUS_I(inode)->create_date = file->create_date;
|
||||||
} else {
|
} else {
|
||||||
pr_err("bad catalog entry used to create inode\n");
|
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);
|
hfsplus_cat_set_perms(inode, &folder->permissions);
|
||||||
folder->access_date = hfsp_ut2mt(inode->i_atime);
|
folder->access_date = hfsp_ut2mt(inode->i_atime);
|
||||||
folder->content_mod_date = hfsp_ut2mt(inode->i_mtime);
|
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);
|
folder->valence = cpu_to_be32(inode->i_size - 2);
|
||||||
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
|
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
|
||||||
folder->subfolders =
|
folder->subfolders =
|
||||||
|
@ -644,7 +646,7 @@ int hfsplus_cat_write_inode(struct inode *inode)
|
||||||
file->flags &= cpu_to_be16(~HFSPLUS_FILE_LOCKED);
|
file->flags &= cpu_to_be16(~HFSPLUS_FILE_LOCKED);
|
||||||
file->access_date = hfsp_ut2mt(inode->i_atime);
|
file->access_date = hfsp_ut2mt(inode->i_atime);
|
||||||
file->content_mod_date = hfsp_ut2mt(inode->i_mtime);
|
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,
|
hfs_bnode_write(fd.bnode, &entry, fd.entryoffset,
|
||||||
sizeof(struct hfsplus_cat_file));
|
sizeof(struct hfsplus_cat_file));
|
||||||
}
|
}
|
||||||
|
@ -700,7 +702,7 @@ int hfsplus_fileattr_set(struct mnt_idmap *idmap,
|
||||||
else
|
else
|
||||||
hip->userflags &= ~HFSPLUS_FLG_NODUMP;
|
hip->userflags &= ~HFSPLUS_FLG_NODUMP;
|
||||||
|
|
||||||
inode->i_ctime = current_time(inode);
|
inode_set_ctime_current(inode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue