From: "Yury Norov (NVIDIA)" <yury.norov@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Linus Walleij <linus.walleij@linaro.org>,
Nicolas Frattaroli <nicolas.frattaroli@collabora.com>,
Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>,
Yue Hu <zbestahu@gmail.com>,
Jeffle Xu <jefflexu@linux.alibaba.com>,
Sandeep Dhavale <dhavale@google.com>,
Hongbo Li <lihongbo22@huawei.com>,
Jaegeuk Kim <jaegeuk@kernel.org>, Tony Luck <tony.luck@intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Dave Martin <Dave.Martin@arm.com>,
James Morse <james.morse@arm.com>,
Babu Moger <babu.moger@amd.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>,
Suren Baghdasaryan <surenb@google.com>,
Jinjiang Tu <tujinjiang@huawei.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Andrei Vagin <avagin@gmail.com>,
linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-fsdevel@vger.kernel.org
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
"Yury Norov \(NVIDIA\)" <yury.norov@gmail.com>
Subject: [f2fs-dev] [PATCH 19/21] fs: don't use GENMASK()
Date: Sat, 25 Oct 2025 12:40:18 -0400 [thread overview]
Message-ID: <20251025164023.308884-20-yury.norov@gmail.com> (raw)
In-Reply-To: <20251025164023.308884-1-yury.norov@gmail.com>
GENMASK(high, low) notation is confusing. FIRST/LAST_BITS() are
more appropriate.
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
---
fs/erofs/internal.h | 2 +-
fs/f2fs/data.c | 2 +-
fs/f2fs/inode.c | 2 +-
fs/f2fs/segment.c | 2 +-
fs/f2fs/super.c | 2 +-
fs/proc/task_mmu.c | 2 +-
fs/resctrl/pseudo_lock.c | 2 +-
include/linux/f2fs_fs.h | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index f7f622836198..6e0f03092c52 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -250,7 +250,7 @@ static inline u64 erofs_nid_to_ino64(struct erofs_sb_info *sbi, erofs_nid_t nid)
* Note: on-disk NIDs remain unchanged as they are primarily used for
* compatibility with non-LFS 32-bit applications.
*/
- return ((nid << 1) & GENMASK_ULL(63, 32)) | (nid & GENMASK(30, 0)) |
+ return ((nid << 1) & LAST_BITS_ULL(32)) | (nid & FIRST_BITS(31)) |
((nid >> EROFS_DIRENT_NID_METABOX_BIT) << 31);
}
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 775aa4f63aa3..ef08464e003f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -416,7 +416,7 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr)
static blk_opf_t f2fs_io_flags(struct f2fs_io_info *fio)
{
- unsigned int temp_mask = GENMASK(NR_TEMP_TYPE - 1, 0);
+ unsigned int temp_mask = FIRST_BITS(NR_TEMP_TYPE);
unsigned int fua_flag, meta_flag, io_flag;
blk_opf_t op_flags = 0;
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 8c4eafe9ffac..42a43f558136 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -524,7 +524,7 @@ static int do_read_inode(struct inode *inode)
fi->i_compress_level = compress_flag >>
COMPRESS_LEVEL_OFFSET;
fi->i_compress_flag = compress_flag &
- GENMASK(COMPRESS_LEVEL_OFFSET - 1, 0);
+ FIRST_BITS(COMPRESS_LEVEL_OFFSET);
fi->i_cluster_size = BIT(fi->i_log_cluster_size);
set_inode_flag(inode, FI_COMPRESSED_FILE);
}
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index b45eace879d7..64433d3b67d4 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -5425,7 +5425,7 @@ static int do_fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
wp_block = zbd->start_blk + (zone.wp >> log_sectors_per_block);
wp_segno = GET_SEGNO(sbi, wp_block);
wp_blkoff = wp_block - START_BLOCK(sbi, wp_segno);
- wp_sector_off = zone.wp & GENMASK(log_sectors_per_block - 1, 0);
+ wp_sector_off = zone.wp & FIRST_BITS(log_sectors_per_block);
if (cs->segno == wp_segno && cs->next_blkoff == wp_blkoff &&
wp_sector_off == 0)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index db7afb806411..96621fd45cdc 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4501,7 +4501,7 @@ static void save_stop_reason(struct f2fs_sb_info *sbi, unsigned char reason)
unsigned long flags;
spin_lock_irqsave(&sbi->error_lock, flags);
- if (sbi->stop_reason[reason] < GENMASK(BITS_PER_BYTE - 1, 0))
+ if (sbi->stop_reason[reason] < FIRST_BITS(BITS_PER_BYTE))
sbi->stop_reason[reason]++;
spin_unlock_irqrestore(&sbi->error_lock, flags);
}
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index fc35a0543f01..71de487b244c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1845,7 +1845,7 @@ struct pagemapread {
#define PM_ENTRY_BYTES sizeof(pagemap_entry_t)
#define PM_PFRAME_BITS 55
-#define PM_PFRAME_MASK GENMASK_ULL(PM_PFRAME_BITS - 1, 0)
+#define PM_PFRAME_MASK FIRST_BITS_ULL(PM_PFRAME_BITS)
#define PM_SOFT_DIRTY BIT_ULL(55)
#define PM_MMAP_EXCLUSIVE BIT_ULL(56)
#define PM_UFFD_WP BIT_ULL(57)
diff --git a/fs/resctrl/pseudo_lock.c b/fs/resctrl/pseudo_lock.c
index 87bbc2605de1..45703bbd3bca 100644
--- a/fs/resctrl/pseudo_lock.c
+++ b/fs/resctrl/pseudo_lock.c
@@ -30,7 +30,7 @@
*/
static unsigned int pseudo_lock_major;
-static unsigned long pseudo_lock_minor_avail = GENMASK(MINORBITS, 0);
+static unsigned long pseudo_lock_minor_avail = FIRST_BITS(MINORBITS + 1);
static char *pseudo_lock_devnode(const struct device *dev, umode_t *mode)
{
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 6afb4a13b81d..9996356b79e0 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -356,7 +356,7 @@ enum {
OFFSET_BIT_SHIFT
};
-#define OFFSET_BIT_MASK GENMASK(OFFSET_BIT_SHIFT - 1, 0)
+#define OFFSET_BIT_MASK FIRST_BITS(OFFSET_BIT_SHIFT)
struct f2fs_node {
/* can be one of three types: inode, direct, and indirect types */
--
2.43.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next parent reply other threads:[~2025-10-25 16:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251025164023.308884-1-yury.norov@gmail.com>
2025-10-25 16:40 ` Yury Norov (NVIDIA) [this message]
[not found] <20251025162858.305236-1-yury.norov@gmail.com>
2025-10-25 16:33 ` [f2fs-dev] [PATCH 19/21] fs: don't use GENMASK() Yury Norov (NVIDIA)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251025164023.308884-20-yury.norov@gmail.com \
--to=yury.norov@gmail.com \
--cc=Dave.Martin@arm.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@gmail.com \
--cc=babu.moger@amd.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=chao@kernel.org \
--cc=david@redhat.com \
--cc=dhavale@google.com \
--cc=jaegeuk@kernel.org \
--cc=james.morse@arm.com \
--cc=jefflexu@linux.alibaba.com \
--cc=lihongbo22@huawei.com \
--cc=linus.walleij@linaro.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=lorenzo.stoakes@oracle.com \
--cc=nicolas.frattaroli@collabora.com \
--cc=reinette.chatre@intel.com \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=tony.luck@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=tujinjiang@huawei.com \
--cc=vbabka@suse.cz \
--cc=xiang@kernel.org \
--cc=zbestahu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).