From nobody Sat Feb 7 15:10:46 2026 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B03441400C for ; Mon, 2 Feb 2026 03:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.132 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770001766; cv=none; b=odVxMAXDIifmA6maRYL2jdeFtabeGQP8c7VMF725wQ+mPu9eO/NeYgsasgl468lq2ZJB2VtyFBp1EDWF7GWs+KiYanei1oiqWqJFNcWzxJ9HeXGf9JQTqcCIv3EoHE70Gl70ON92CgJJW98WUixPatN7yAhJcCj+8prBE7JH6QE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770001766; c=relaxed/simple; bh=Sk0USq0k+vhoQJG/yagXB/xhKCbmDz3OQN4klycB4BE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=lt9rOTzXRoH95peIxq1CzArZGYe5lY0pvBSl3POtMUtHakZvrvGojuQSE45M74XauI58fgjSvfHo5mL2PmWKJFfDOXtiFdubJiXY9JRLQK/i9quLsR+ITlopttk9VNmA+aPYdPSVUtzR0QcooE1l9SctZPMWKxCVHRzGF8MOKCQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=Czp+UbJ9; arc=none smtp.client-ip=115.124.30.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="Czp+UbJ9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1770001755; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=iu2YtxTaLi2FjHAaBCEL14zATKdSAWbY2pM9NLCsNHs=; b=Czp+UbJ9DG6QyX6WR7PFKwIPN4H5FSEiDiZ6gJJ1qHZN3s26iwTB1b9Q94cKDOmWFEq4QRNZ5E0DVFfE7NmwzxYvQNdbCZTFfh1NEhxlKd1uUKEZr8PckMagsKm21eu3+V/qt10Ztx0UjVbrbT7MFSwOMl9LE3zUB0zxR595ius= Received: from localhost(mailfrom:mengferry@linux.alibaba.com fp:SMTPD_---0WyIUhNW_1770001751 cluster:ay36) by smtp.aliyun-inc.com; Mon, 02 Feb 2026 11:09:14 +0800 From: Ferry Meng To: linux-erofs@lists.ozlabs.org Cc: LKML , Ferry Meng Subject: [PATCH] erofs: avoid some unnecessary #ifdefs Date: Mon, 2 Feb 2026 11:09:09 +0800 Message-Id: <20260202030909.128365-1-mengferry@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" They can either be removed or replaced with IS_ENABLED(). Signed-off-by: Ferry Meng Reviewed-by: Gao Xiang --- fs/erofs/data.c | 20 ++++++++------------ fs/erofs/super.c | 13 ++++--------- fs/erofs/sysfs.c | 5 ++--- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 3a4eb0dececd..a2c796db4510 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -365,12 +365,10 @@ int erofs_fiemap(struct inode *inode, struct fiemap_e= xtent_info *fieinfo, u64 start, u64 len) { if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) { -#ifdef CONFIG_EROFS_FS_ZIP + if (!IS_ENABLED(CONFIG_EROFS_FS_ZIP)) + return -EOPNOTSUPP; return iomap_fiemap(inode, fieinfo, start, len, &z_erofs_iomap_report_ops); -#else - return -EOPNOTSUPP; -#endif } return iomap_fiemap(inode, fieinfo, start, len, &erofs_iomap_ops); } @@ -428,10 +426,9 @@ static ssize_t erofs_file_read_iter(struct kiocb *iocb= , struct iov_iter *to) if (!iov_iter_count(to)) return 0; =20 -#ifdef CONFIG_FS_DAX - if (IS_DAX(inode)) + if (IS_ENABLED(CONFIG_FS_DAX) && IS_DAX(inode)) return dax_iomap_rw(iocb, to, &erofs_iomap_ops); -#endif + if ((iocb->ki_flags & IOCB_DIRECT) && inode->i_sb->s_bdev) { struct erofs_iomap_iter_ctx iter_ctx =3D { .realinode =3D inode, @@ -491,12 +488,11 @@ static loff_t erofs_file_llseek(struct file *file, lo= ff_t offset, int whence) struct inode *inode =3D file->f_mapping->host; const struct iomap_ops *ops =3D &erofs_iomap_ops; =20 - if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) -#ifdef CONFIG_EROFS_FS_ZIP + if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) { + if (!IS_ENABLED(CONFIG_EROFS_FS_ZIP)) + return generic_file_llseek(file, offset, whence); ops =3D &z_erofs_iomap_report_ops; -#else - return generic_file_llseek(file, offset, whence); -#endif + } =20 if (whence =3D=3D SEEK_HOLE) offset =3D iomap_seek_hole(inode, offset, ops); diff --git a/fs/erofs/super.c b/fs/erofs/super.c index e52c2b528f86..7827e61424b7 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -381,12 +381,10 @@ static void erofs_default_options(struct erofs_sb_inf= o *sbi) sbi->opt.cache_strategy =3D EROFS_ZIP_CACHE_READAROUND; sbi->sync_decompress =3D EROFS_SYNC_DECOMPRESS_AUTO; #endif -#ifdef CONFIG_EROFS_FS_XATTR - set_opt(&sbi->opt, XATTR_USER); -#endif -#ifdef CONFIG_EROFS_FS_POSIX_ACL - set_opt(&sbi->opt, POSIX_ACL); -#endif + if (IS_ENABLED(CONFIG_EROFS_FS_XATTR)) + set_opt(&sbi->opt, XATTR_USER); + if (IS_ENABLED(CONFIG_EROFS_FS_POSIX_ACL)) + set_opt(&sbi->opt, POSIX_ACL); } =20 enum { @@ -1125,11 +1123,8 @@ static int erofs_show_options(struct seq_file *seq, = struct dentry *root) =20 static void erofs_evict_inode(struct inode *inode) { -#ifdef CONFIG_FS_DAX if (IS_DAX(inode)) dax_break_layout_final(inode); -#endif - erofs_ishare_free_inode(inode); truncate_inode_pages_final(&inode->i_data); clear_inode(inode); diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c index 3a9a5fa000ae..6734483a440f 100644 --- a/fs/erofs/sysfs.c +++ b/fs/erofs/sysfs.c @@ -168,11 +168,10 @@ static ssize_t erofs_attr_store(struct kobject *kobj,= struct attribute *attr, return ret; if (t !=3D (unsigned int)t) return -ERANGE; -#ifdef CONFIG_EROFS_FS_ZIP - if (!strcmp(a->attr.name, "sync_decompress") && + if (IS_ENABLED(CONFIG_EROFS_FS_ZIP) && + !strcmp(a->attr.name, "sync_decompress") && (t > EROFS_SYNC_DECOMPRESS_FORCE_OFF)) return -EINVAL; -#endif *(unsigned int *)ptr =3D t; return len; case attr_pointer_bool: --=20 2.43.5