* [PATCH 03/21] select: rename BITS() to FDS_BITS()
[not found] <20251025162858.305236-1-yury.norov@gmail.com>
@ 2025-10-25 16:28 ` Yury Norov (NVIDIA)
0 siblings, 0 replies; 4+ messages in thread
From: Yury Norov (NVIDIA) @ 2025-10-25 16:28 UTC (permalink / raw)
To: Linus Torvalds, Linus Walleij, Nicolas Frattaroli, Alexander Viro,
Christian Brauner, Jan Kara, linux-fsdevel, linux-kernel
Cc: Yury Norov (NVIDIA), Rasmus Villemoes
In preparation for adding generic BITS() macro, rename the local one.
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
---
fs/select.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/select.c b/fs/select.c
index 082cf60c7e23..ad5bfb4907ea 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -412,7 +412,7 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset)
#define FDS_OUT(fds, n) (fds->out + n)
#define FDS_EX(fds, n) (fds->ex + n)
-#define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n))
+#define FDS_BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n))
static int max_select_fd(unsigned long n, fd_set_bits *fds)
{
@@ -428,7 +428,7 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
open_fds = fdt->open_fds + n;
max = 0;
if (set) {
- set &= BITS(fds, n);
+ set &= FDS_BITS(fds, n);
if (set) {
if (!(set & ~*open_fds))
goto get_max;
@@ -438,7 +438,7 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
while (n) {
open_fds--;
n--;
- set = BITS(fds, n);
+ set = FDS_BITS(fds, n);
if (!set)
continue;
if (set & ~*open_fds)
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 03/21] select: rename BITS() to FDS_BITS()
[not found] <20251025164023.308884-1-yury.norov@gmail.com>
@ 2025-10-25 16:40 ` Yury Norov (NVIDIA)
2025-10-30 9:42 ` Jan Kara
2025-10-25 16:40 ` [PATCH 19/21] fs: don't use GENMASK() Yury Norov (NVIDIA)
1 sibling, 1 reply; 4+ messages in thread
From: Yury Norov (NVIDIA) @ 2025-10-25 16:40 UTC (permalink / raw)
To: Linus Torvalds, Linus Walleij, Nicolas Frattaroli, Alexander Viro,
Christian Brauner, Jan Kara, linux-fsdevel, linux-kernel
Cc: Yury Norov (NVIDIA), Rasmus Villemoes
In preparation for adding generic BITS() macro, rename the local one.
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
---
fs/select.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/select.c b/fs/select.c
index 082cf60c7e23..ad5bfb4907ea 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -412,7 +412,7 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset)
#define FDS_OUT(fds, n) (fds->out + n)
#define FDS_EX(fds, n) (fds->ex + n)
-#define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n))
+#define FDS_BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n))
static int max_select_fd(unsigned long n, fd_set_bits *fds)
{
@@ -428,7 +428,7 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
open_fds = fdt->open_fds + n;
max = 0;
if (set) {
- set &= BITS(fds, n);
+ set &= FDS_BITS(fds, n);
if (set) {
if (!(set & ~*open_fds))
goto get_max;
@@ -438,7 +438,7 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
while (n) {
open_fds--;
n--;
- set = BITS(fds, n);
+ set = FDS_BITS(fds, n);
if (!set)
continue;
if (set & ~*open_fds)
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 19/21] fs: don't use GENMASK()
[not found] <20251025164023.308884-1-yury.norov@gmail.com>
2025-10-25 16:40 ` [PATCH 03/21] select: rename BITS() to FDS_BITS() Yury Norov (NVIDIA)
@ 2025-10-25 16:40 ` Yury Norov (NVIDIA)
1 sibling, 0 replies; 4+ messages in thread
From: Yury Norov (NVIDIA) @ 2025-10-25 16:40 UTC (permalink / raw)
To: Linus Torvalds, Linus Walleij, Nicolas Frattaroli, Gao Xiang,
Chao Yu, Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li,
Jaegeuk Kim, Tony Luck, Reinette Chatre, Dave Martin, James Morse,
Babu Moger, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Vlastimil Babka, Suren Baghdasaryan, Jinjiang Tu, Baolin Wang,
Ryan Roberts, Andrei Vagin, linux-erofs, linux-kernel,
linux-f2fs-devel, linux-fsdevel
Cc: Yury Norov (NVIDIA), Rasmus Villemoes
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 03/21] select: rename BITS() to FDS_BITS()
2025-10-25 16:40 ` [PATCH 03/21] select: rename BITS() to FDS_BITS() Yury Norov (NVIDIA)
@ 2025-10-30 9:42 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2025-10-30 9:42 UTC (permalink / raw)
To: Yury Norov (NVIDIA)
Cc: Linus Torvalds, Linus Walleij, Nicolas Frattaroli, Alexander Viro,
Christian Brauner, Jan Kara, linux-fsdevel, linux-kernel,
Rasmus Villemoes
On Sat 25-10-25 12:40:02, Yury Norov (NVIDIA) wrote:
> In preparation for adding generic BITS() macro, rename the local one.
>
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Looks fine. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/select.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/select.c b/fs/select.c
> index 082cf60c7e23..ad5bfb4907ea 100644
> --- a/fs/select.c
> +++ b/fs/select.c
> @@ -412,7 +412,7 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset)
> #define FDS_OUT(fds, n) (fds->out + n)
> #define FDS_EX(fds, n) (fds->ex + n)
>
> -#define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n))
> +#define FDS_BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n))
>
> static int max_select_fd(unsigned long n, fd_set_bits *fds)
> {
> @@ -428,7 +428,7 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
> open_fds = fdt->open_fds + n;
> max = 0;
> if (set) {
> - set &= BITS(fds, n);
> + set &= FDS_BITS(fds, n);
> if (set) {
> if (!(set & ~*open_fds))
> goto get_max;
> @@ -438,7 +438,7 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
> while (n) {
> open_fds--;
> n--;
> - set = BITS(fds, n);
> + set = FDS_BITS(fds, n);
> if (!set)
> continue;
> if (set & ~*open_fds)
> --
> 2.43.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-30 9:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20251025164023.308884-1-yury.norov@gmail.com>
2025-10-25 16:40 ` [PATCH 03/21] select: rename BITS() to FDS_BITS() Yury Norov (NVIDIA)
2025-10-30 9:42 ` Jan Kara
2025-10-25 16:40 ` [PATCH 19/21] fs: don't use GENMASK() Yury Norov (NVIDIA)
[not found] <20251025162858.305236-1-yury.norov@gmail.com>
2025-10-25 16:28 ` [PATCH 03/21] select: rename BITS() to FDS_BITS() Yury Norov (NVIDIA)
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).