aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-03-26 03:52:32 -0400
committerRichard Weinberger <richard@nod.at>2019-05-07 15:58:32 -0400
commite3d73dead4988f3eb8483b28087f3ec0ff9d1398 (patch)
treea0168b7ebd40d75ff7a4374c46021eb8d7e06284
parenteea2c05d927b031034e222110a4fc34914d97ca4 (diff)
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: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--fs/ubifs/dir.c2
-rw-r--r--fs/ubifs/file.c16
-rw-r--r--fs/ubifs/super.c16
-rw-r--r--fs/ubifs/ubifs.h2
4 files changed, 15 insertions, 21 deletions
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index d2f5a50f5d83..80c062c03857 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1653,9 +1653,7 @@ const struct inode_operations ubifs_dir_inode_operations = {
1653#ifdef CONFIG_UBIFS_FS_XATTR 1653#ifdef CONFIG_UBIFS_FS_XATTR
1654 .listxattr = ubifs_listxattr, 1654 .listxattr = ubifs_listxattr,
1655#endif 1655#endif
1656#ifdef CONFIG_UBIFS_ATIME_SUPPORT
1657 .update_time = ubifs_update_time, 1656 .update_time = ubifs_update_time,
1658#endif
1659 .tmpfile = ubifs_tmpfile, 1657 .tmpfile = ubifs_tmpfile,
1660}; 1658};
1661 1659
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 5d2ffb1a45fc..512e7d9c60cd 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1375,7 +1375,6 @@ static inline int mctime_update_needed(const struct inode *inode,
1375 return 0; 1375 return 0;
1376} 1376}
1377 1377
1378#ifdef CONFIG_UBIFS_ATIME_SUPPORT
1379/** 1378/**
1380 * ubifs_update_time - update time of inode. 1379 * ubifs_update_time - update time of inode.
1381 * @inode: inode to update 1380 * @inode: inode to update
@@ -1392,6 +1391,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
1392 int iflags = I_DIRTY_TIME; 1391 int iflags = I_DIRTY_TIME;
1393 int err, release; 1392 int err, release;
1394 1393
1394 if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
1395 return generic_update_time(inode, time, flags);
1396
1395 err = ubifs_budget_space(c, &req); 1397 err = ubifs_budget_space(c, &req);
1396 if (err) 1398 if (err)
1397 return err; 1399 return err;
@@ -1414,7 +1416,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
1414 ubifs_release_budget(c, &req); 1416 ubifs_release_budget(c, &req);
1415 return 0; 1417 return 0;
1416} 1418}
1417#endif
1418 1419
1419/** 1420/**
1420 * update_mctime - update mtime and ctime of an inode. 1421 * 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 if (err) 1624 if (err)
1624 return err; 1625 return err;
1625 vma->vm_ops = &ubifs_file_vm_ops; 1626 vma->vm_ops = &ubifs_file_vm_ops;
1626#ifdef CONFIG_UBIFS_ATIME_SUPPORT 1627
1627 file_accessed(file); 1628 if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
1628#endif 1629 file_accessed(file);
1630
1629 return 0; 1631 return 0;
1630} 1632}
1631 1633
@@ -1663,9 +1665,7 @@ const struct inode_operations ubifs_file_inode_operations = {
1663#ifdef CONFIG_UBIFS_FS_XATTR 1665#ifdef CONFIG_UBIFS_FS_XATTR
1664 .listxattr = ubifs_listxattr, 1666 .listxattr = ubifs_listxattr,
1665#endif 1667#endif
1666#ifdef CONFIG_UBIFS_ATIME_SUPPORT
1667 .update_time = ubifs_update_time, 1668 .update_time = ubifs_update_time,
1668#endif
1669}; 1669};
1670 1670
1671const struct inode_operations ubifs_symlink_inode_operations = { 1671const struct inode_operations ubifs_symlink_inode_operations = {
@@ -1675,9 +1675,7 @@ const struct inode_operations ubifs_symlink_inode_operations = {
1675#ifdef CONFIG_UBIFS_FS_XATTR 1675#ifdef CONFIG_UBIFS_FS_XATTR
1676 .listxattr = ubifs_listxattr, 1676 .listxattr = ubifs_listxattr,
1677#endif 1677#endif
1678#ifdef CONFIG_UBIFS_ATIME_SUPPORT
1679 .update_time = ubifs_update_time, 1678 .update_time = ubifs_update_time,
1680#endif
1681}; 1679};
1682 1680
1683const struct file_operations ubifs_file_operations = { 1681const struct file_operations ubifs_file_operations = {
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index d0c1228635f0..ed026ad6f455 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -129,9 +129,10 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
129 goto out_ino; 129 goto out_ino;
130 130
131 inode->i_flags |= S_NOCMTIME; 131 inode->i_flags |= S_NOCMTIME;
132#ifndef CONFIG_UBIFS_ATIME_SUPPORT 132
133 inode->i_flags |= S_NOATIME; 133 if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
134#endif 134 inode->i_flags |= S_NOATIME;
135
135 set_nlink(inode, le32_to_cpu(ino->nlink)); 136 set_nlink(inode, le32_to_cpu(ino->nlink));
136 i_uid_write(inode, le32_to_cpu(ino->uid)); 137 i_uid_write(inode, le32_to_cpu(ino->uid));
137 i_gid_write(inode, le32_to_cpu(ino->gid)); 138 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 goto out_deact; 2249 goto out_deact;
2249 /* We do not support atime */ 2250 /* We do not support atime */
2250 sb->s_flags |= SB_ACTIVE; 2251 sb->s_flags |= SB_ACTIVE;
2251#ifndef CONFIG_UBIFS_ATIME_SUPPORT 2252 if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
2252 sb->s_flags |= SB_NOATIME; 2253 ubifs_msg(c, "full atime support is enabled.");
2253#else 2254 else
2254 ubifs_msg(c, "full atime support is enabled."); 2255 sb->s_flags |= SB_NOATIME;
2255#endif
2256 } 2256 }
2257 2257
2258 /* 'fill_super()' opens ubi again so we must close it here */ 2258 /* 'fill_super()' opens ubi again so we must close it here */
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index cf4b10f24b6d..379b9f791ff6 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1999,9 +1999,7 @@ int ubifs_calc_dark(const struct ubifs_info *c, int spc);
1999/* file.c */ 1999/* file.c */
2000int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync); 2000int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync);
2001int ubifs_setattr(struct dentry *dentry, struct iattr *attr); 2001int ubifs_setattr(struct dentry *dentry, struct iattr *attr);
2002#ifdef CONFIG_UBIFS_ATIME_SUPPORT
2003int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags); 2002int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags);
2004#endif
2005 2003
2006/* dir.c */ 2004/* dir.c */
2007struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir, 2005struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,