Skip to content

Commit c7c707c

Browse files
jdmfrhsiangkao
authored andcommitted
erofs: avoid some unnecessary #ifdefs
They can either be removed or replaced with IS_ENABLED(). Signed-off-by: Ferry Meng <mengferry@linux.alibaba.com> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
1 parent bc804a8 commit c7c707c

3 files changed

Lines changed: 14 additions & 24 deletions

File tree

fs/erofs/data.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,10 @@ int erofs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
365365
u64 start, u64 len)
366366
{
367367
if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) {
368-
#ifdef CONFIG_EROFS_FS_ZIP
368+
if (!IS_ENABLED(CONFIG_EROFS_FS_ZIP))
369+
return -EOPNOTSUPP;
369370
return iomap_fiemap(inode, fieinfo, start, len,
370371
&z_erofs_iomap_report_ops);
371-
#else
372-
return -EOPNOTSUPP;
373-
#endif
374372
}
375373
return iomap_fiemap(inode, fieinfo, start, len, &erofs_iomap_ops);
376374
}
@@ -428,10 +426,9 @@ static ssize_t erofs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
428426
if (!iov_iter_count(to))
429427
return 0;
430428

431-
#ifdef CONFIG_FS_DAX
432-
if (IS_DAX(inode))
429+
if (IS_ENABLED(CONFIG_FS_DAX) && IS_DAX(inode))
433430
return dax_iomap_rw(iocb, to, &erofs_iomap_ops);
434-
#endif
431+
435432
if ((iocb->ki_flags & IOCB_DIRECT) && inode->i_sb->s_bdev) {
436433
struct erofs_iomap_iter_ctx iter_ctx = {
437434
.realinode = inode,
@@ -491,12 +488,11 @@ static loff_t erofs_file_llseek(struct file *file, loff_t offset, int whence)
491488
struct inode *inode = file->f_mapping->host;
492489
const struct iomap_ops *ops = &erofs_iomap_ops;
493490

494-
if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout))
495-
#ifdef CONFIG_EROFS_FS_ZIP
491+
if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) {
492+
if (!IS_ENABLED(CONFIG_EROFS_FS_ZIP))
493+
return generic_file_llseek(file, offset, whence);
496494
ops = &z_erofs_iomap_report_ops;
497-
#else
498-
return generic_file_llseek(file, offset, whence);
499-
#endif
495+
}
500496

501497
if (whence == SEEK_HOLE)
502498
offset = iomap_seek_hole(inode, offset, ops);

fs/erofs/super.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,10 @@ static void erofs_default_options(struct erofs_sb_info *sbi)
381381
sbi->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND;
382382
sbi->sync_decompress = EROFS_SYNC_DECOMPRESS_AUTO;
383383
#endif
384-
#ifdef CONFIG_EROFS_FS_XATTR
385-
set_opt(&sbi->opt, XATTR_USER);
386-
#endif
387-
#ifdef CONFIG_EROFS_FS_POSIX_ACL
388-
set_opt(&sbi->opt, POSIX_ACL);
389-
#endif
384+
if (IS_ENABLED(CONFIG_EROFS_FS_XATTR))
385+
set_opt(&sbi->opt, XATTR_USER);
386+
if (IS_ENABLED(CONFIG_EROFS_FS_POSIX_ACL))
387+
set_opt(&sbi->opt, POSIX_ACL);
390388
}
391389

392390
enum {
@@ -1125,11 +1123,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
11251123

11261124
static void erofs_evict_inode(struct inode *inode)
11271125
{
1128-
#ifdef CONFIG_FS_DAX
11291126
if (IS_DAX(inode))
11301127
dax_break_layout_final(inode);
1131-
#endif
1132-
11331128
erofs_ishare_free_inode(inode);
11341129
truncate_inode_pages_final(&inode->i_data);
11351130
clear_inode(inode);

fs/erofs/sysfs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,10 @@ static ssize_t erofs_attr_store(struct kobject *kobj, struct attribute *attr,
168168
return ret;
169169
if (t != (unsigned int)t)
170170
return -ERANGE;
171-
#ifdef CONFIG_EROFS_FS_ZIP
172-
if (!strcmp(a->attr.name, "sync_decompress") &&
171+
if (IS_ENABLED(CONFIG_EROFS_FS_ZIP) &&
172+
!strcmp(a->attr.name, "sync_decompress") &&
173173
(t > EROFS_SYNC_DECOMPRESS_FORCE_OFF))
174174
return -EINVAL;
175-
#endif
176175
*(unsigned int *)ptr = t;
177176
return len;
178177
case attr_pointer_bool:

0 commit comments

Comments
 (0)