Re: [PATCH v2 002/110] vfs: widen inode hash/lookup functions to u64

2026-03-03 Thread Jan Kara
On Mon 02-03-26 15:23:46, Jeff Layton wrote:
> Change the inode hash/lookup VFS API functions to accept u64 parameters
> instead of unsigned long for inode numbers and hash values. This is
> preparation for widening i_ino itself to u64, which will allow
> filesystems to store full 64-bit inode numbers on 32-bit architectures.
> 
> Since unsigned long implicitly widens to u64 on all architectures, this
> change is backward-compatible with all existing callers.
> 
> In dump_mapping(), change the local ino variable to kino_t and use the
> PRIino format macro, since this variable holds an i_ino value. In
> init_special_inode(), also switch to PRIino.
> 
> Signed-off-by: Jeff Layton 

Looks good. Feel free to add:

Reviewed-by: Jan Kara 

Honza
-- 
Jan Kara 
SUSE Labs, CR


[PATCH v2 002/110] vfs: widen inode hash/lookup functions to u64

2026-03-03 Thread Jeff Layton
Change the inode hash/lookup VFS API functions to accept u64 parameters
instead of unsigned long for inode numbers and hash values. This is
preparation for widening i_ino itself to u64, which will allow
filesystems to store full 64-bit inode numbers on 32-bit architectures.

Since unsigned long implicitly widens to u64 on all architectures, this
change is backward-compatible with all existing callers.

In dump_mapping(), change the local ino variable to kino_t and use the
PRIino format macro, since this variable holds an i_ino value. In
init_special_inode(), also switch to PRIino.

Signed-off-by: Jeff Layton 
---
 fs/inode.c | 49 -
 include/linux/fs.h | 26 +-
 2 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index 
cc12b68e021b2c97cc88a46ddc736334ecb8edfa..24ab9fa10baf7c885244f23bfccd731efe4a14cc
 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -672,7 +672,7 @@ static inline void inode_sb_list_del(struct inode *inode)
}
 }
 
-static unsigned long hash(struct super_block *sb, unsigned long hashval)
+static unsigned long hash(struct super_block *sb, u64 hashval)
 {
unsigned long tmp;
 
@@ -685,12 +685,12 @@ static unsigned long hash(struct super_block *sb, 
unsigned long hashval)
 /**
  * __insert_inode_hash - hash an inode
  * @inode: unhashed inode
- * @hashval: unsigned long value used to locate this object in the
+ * @hashval: u64 value used to locate this object in the
  * inode_hashtable.
  *
  * Add an inode to the inode hash for this superblock.
  */
-void __insert_inode_hash(struct inode *inode, unsigned long hashval)
+void __insert_inode_hash(struct inode *inode, u64 hashval)
 {
struct hlist_head *b = inode_hashtable + hash(inode->i_sb, hashval);
 
@@ -726,7 +726,7 @@ void dump_mapping(const struct address_space *mapping)
struct dentry *dentry_ptr;
struct dentry dentry;
char fname[64] = {};
-   unsigned long ino;
+   kino_t ino;
 
/*
 * If mapping is an invalid pointer, we don't want to crash
@@ -750,14 +750,14 @@ void dump_mapping(const struct address_space *mapping)
}
 
if (!dentry_first) {
-   pr_warn("aops:%ps ino:%lx\n", a_ops, ino);
+   pr_warn("aops:%ps ino:%" PRIino "x\n", a_ops, ino);
return;
}
 
dentry_ptr = container_of(dentry_first, struct dentry, d_u.d_alias);
if (get_kernel_nofault(dentry, dentry_ptr) ||
!dentry.d_parent || !dentry.d_name.name) {
-   pr_warn("aops:%ps ino:%lx invalid dentry:%px\n",
+   pr_warn("aops:%ps ino:%" PRIino "x invalid dentry:%px\n",
a_ops, ino, dentry_ptr);
return;
}
@@ -768,7 +768,7 @@ void dump_mapping(const struct address_space *mapping)
 * Even if strncpy_from_kernel_nofault() succeeded,
 * the fname could be unreliable
 */
-   pr_warn("aops:%ps ino:%lx dentry name(?):\"%s\"\n",
+   pr_warn("aops:%ps ino:%" PRIino "x dentry name(?):\"%s\"\n",
a_ops, ino, fname);
 }
 
@@ -1087,7 +1087,7 @@ static struct inode *find_inode(struct super_block *sb,
  * iget_locked for details.
  */
 static struct inode *find_inode_fast(struct super_block *sb,
-   struct hlist_head *head, unsigned long ino,
+   struct hlist_head *head, u64 ino,
bool hash_locked, bool *isnew)
 {
struct inode *inode = NULL;
@@ -1301,7 +1301,7 @@ EXPORT_SYMBOL(unlock_two_nondirectories);
  * Note that both @test and @set are called with the inode_hash_lock held, so
  * they can't sleep.
  */
-struct inode *inode_insert5(struct inode *inode, unsigned long hashval,
+struct inode *inode_insert5(struct inode *inode, u64 hashval,
int (*test)(struct inode *, void *),
int (*set)(struct inode *, void *), void *data)
 {
@@ -1378,7 +1378,7 @@ EXPORT_SYMBOL(inode_insert5);
  * Note that both @test and @set are called with the inode_hash_lock held, so
  * they can't sleep.
  */
-struct inode *iget5_locked(struct super_block *sb, unsigned long hashval,
+struct inode *iget5_locked(struct super_block *sb, u64 hashval,
int (*test)(struct inode *, void *),
int (*set)(struct inode *, void *), void *data)
 {
@@ -1408,7 +1408,7 @@ EXPORT_SYMBOL(iget5_locked);
  * This is equivalent to iget5_locked, except the @test callback must
  * tolerate the inode not being stable, including being mid-teardown.
  */
-struct inode *iget5_locked_rcu(struct super_block *sb, unsigned long hashval,
+struct inode *iget5_locked_rcu(struct super_block *sb, u64 hashval,
int (*test)(struct inode *, void *),
int (*set)(struct inode *, void *), void *data)
 {
@@ -1455,7 +1455,7 @@ EXPORT_SYMBOL_GP