Commit e3d73dea authored by Sascha Hauer's avatar Sascha Hauer Committed by Richard Weinberger

ubifs: Remove ifdefs around CONFIG_UBIFS_ATIME_SUPPORT

ifdefs reduce readability and compile coverage. This removes the ifdefs
around CONFIG_UBIFS_ATIME_SUPPORT by replacing them with IS_ENABLED()
where applicable. The fs layer would fall back to generic_update_time()
when .update_time doesn't exist. We do this fallback explicitly now.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent eea2c05d
...@@ -1653,9 +1653,7 @@ const struct inode_operations ubifs_dir_inode_operations = { ...@@ -1653,9 +1653,7 @@ const struct inode_operations ubifs_dir_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR #ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr, .listxattr = ubifs_listxattr,
#endif #endif
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
.update_time = ubifs_update_time, .update_time = ubifs_update_time,
#endif
.tmpfile = ubifs_tmpfile, .tmpfile = ubifs_tmpfile,
}; };
......
...@@ -1375,7 +1375,6 @@ static inline int mctime_update_needed(const struct inode *inode, ...@@ -1375,7 +1375,6 @@ static inline int mctime_update_needed(const struct inode *inode,
return 0; return 0;
} }
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
/** /**
* ubifs_update_time - update time of inode. * ubifs_update_time - update time of inode.
* @inode: inode to update * @inode: inode to update
...@@ -1392,6 +1391,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time, ...@@ -1392,6 +1391,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
int iflags = I_DIRTY_TIME; int iflags = I_DIRTY_TIME;
int err, release; int err, release;
if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
return generic_update_time(inode, time, flags);
err = ubifs_budget_space(c, &req); err = ubifs_budget_space(c, &req);
if (err) if (err)
return err; return err;
...@@ -1414,7 +1416,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time, ...@@ -1414,7 +1416,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
ubifs_release_budget(c, &req); ubifs_release_budget(c, &req);
return 0; return 0;
} }
#endif
/** /**
* update_mctime - update mtime and ctime of an inode. * update_mctime - update mtime and ctime of an inode.
...@@ -1623,9 +1624,10 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1623,9 +1624,10 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
if (err) if (err)
return err; return err;
vma->vm_ops = &ubifs_file_vm_ops; vma->vm_ops = &ubifs_file_vm_ops;
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
file_accessed(file); if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
#endif file_accessed(file);
return 0; return 0;
} }
...@@ -1663,9 +1665,7 @@ const struct inode_operations ubifs_file_inode_operations = { ...@@ -1663,9 +1665,7 @@ const struct inode_operations ubifs_file_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR #ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr, .listxattr = ubifs_listxattr,
#endif #endif
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
.update_time = ubifs_update_time, .update_time = ubifs_update_time,
#endif
}; };
const struct inode_operations ubifs_symlink_inode_operations = { const struct inode_operations ubifs_symlink_inode_operations = {
...@@ -1675,9 +1675,7 @@ const struct inode_operations ubifs_symlink_inode_operations = { ...@@ -1675,9 +1675,7 @@ const struct inode_operations ubifs_symlink_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR #ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr, .listxattr = ubifs_listxattr,
#endif #endif
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
.update_time = ubifs_update_time, .update_time = ubifs_update_time,
#endif
}; };
const struct file_operations ubifs_file_operations = { const struct file_operations ubifs_file_operations = {
......
...@@ -129,9 +129,10 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum) ...@@ -129,9 +129,10 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
goto out_ino; goto out_ino;
inode->i_flags |= S_NOCMTIME; inode->i_flags |= S_NOCMTIME;
#ifndef CONFIG_UBIFS_ATIME_SUPPORT
inode->i_flags |= S_NOATIME; if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
#endif inode->i_flags |= S_NOATIME;
set_nlink(inode, le32_to_cpu(ino->nlink)); set_nlink(inode, le32_to_cpu(ino->nlink));
i_uid_write(inode, le32_to_cpu(ino->uid)); i_uid_write(inode, le32_to_cpu(ino->uid));
i_gid_write(inode, le32_to_cpu(ino->gid)); i_gid_write(inode, le32_to_cpu(ino->gid));
...@@ -2248,11 +2249,10 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, ...@@ -2248,11 +2249,10 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
goto out_deact; goto out_deact;
/* We do not support atime */ /* We do not support atime */
sb->s_flags |= SB_ACTIVE; sb->s_flags |= SB_ACTIVE;
#ifndef CONFIG_UBIFS_ATIME_SUPPORT if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
sb->s_flags |= SB_NOATIME; ubifs_msg(c, "full atime support is enabled.");
#else else
ubifs_msg(c, "full atime support is enabled."); sb->s_flags |= SB_NOATIME;
#endif
} }
/* 'fill_super()' opens ubi again so we must close it here */ /* 'fill_super()' opens ubi again so we must close it here */
......
...@@ -1999,9 +1999,7 @@ int ubifs_calc_dark(const struct ubifs_info *c, int spc); ...@@ -1999,9 +1999,7 @@ int ubifs_calc_dark(const struct ubifs_info *c, int spc);
/* file.c */ /* file.c */
int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync); int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync);
int ubifs_setattr(struct dentry *dentry, struct iattr *attr); int ubifs_setattr(struct dentry *dentry, struct iattr *attr);
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags); int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags);
#endif
/* dir.c */ /* dir.c */
struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir, struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment