Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfs: widen inode hash/lookup functions to u64

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.

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20260304-iino-u64-v3-1-2257ad83d372@kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jeff Layton and committed by
Christian Brauner
96fefcab 6de23f81

+40 -42
+1 -1
fs/f2fs/node.c
··· 1997 1997 return ret; 1998 1998 } 1999 1999 2000 - static int f2fs_match_ino(struct inode *inode, unsigned long ino, void *data) 2000 + static int f2fs_match_ino(struct inode *inode, u64 ino, void *data) 2001 2001 { 2002 2002 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 2003 2003 bool clean;
+18 -18
fs/inode.c
··· 672 672 } 673 673 } 674 674 675 - static unsigned long hash(struct super_block *sb, unsigned long hashval) 675 + static unsigned long hash(struct super_block *sb, u64 hashval) 676 676 { 677 677 unsigned long tmp; 678 678 ··· 685 685 /** 686 686 * __insert_inode_hash - hash an inode 687 687 * @inode: unhashed inode 688 - * @hashval: unsigned long value used to locate this object in the 688 + * @hashval: u64 value used to locate this object in the 689 689 * inode_hashtable. 690 690 * 691 691 * Add an inode to the inode hash for this superblock. 692 692 */ 693 - void __insert_inode_hash(struct inode *inode, unsigned long hashval) 693 + void __insert_inode_hash(struct inode *inode, u64 hashval) 694 694 { 695 695 struct hlist_head *b = inode_hashtable + hash(inode->i_sb, hashval); 696 696 ··· 1087 1087 * iget_locked for details. 1088 1088 */ 1089 1089 static struct inode *find_inode_fast(struct super_block *sb, 1090 - struct hlist_head *head, unsigned long ino, 1090 + struct hlist_head *head, u64 ino, 1091 1091 bool hash_locked, bool *isnew) 1092 1092 { 1093 1093 struct inode *inode = NULL; ··· 1301 1301 * Note that both @test and @set are called with the inode_hash_lock held, so 1302 1302 * they can't sleep. 1303 1303 */ 1304 - struct inode *inode_insert5(struct inode *inode, unsigned long hashval, 1304 + struct inode *inode_insert5(struct inode *inode, u64 hashval, 1305 1305 int (*test)(struct inode *, void *), 1306 1306 int (*set)(struct inode *, void *), void *data) 1307 1307 { ··· 1378 1378 * Note that both @test and @set are called with the inode_hash_lock held, so 1379 1379 * they can't sleep. 1380 1380 */ 1381 - struct inode *iget5_locked(struct super_block *sb, unsigned long hashval, 1381 + struct inode *iget5_locked(struct super_block *sb, u64 hashval, 1382 1382 int (*test)(struct inode *, void *), 1383 1383 int (*set)(struct inode *, void *), void *data) 1384 1384 { ··· 1408 1408 * This is equivalent to iget5_locked, except the @test callback must 1409 1409 * tolerate the inode not being stable, including being mid-teardown. 1410 1410 */ 1411 - struct inode *iget5_locked_rcu(struct super_block *sb, unsigned long hashval, 1411 + struct inode *iget5_locked_rcu(struct super_block *sb, u64 hashval, 1412 1412 int (*test)(struct inode *, void *), 1413 1413 int (*set)(struct inode *, void *), void *data) 1414 1414 { ··· 1455 1455 * hashed, and with the I_NEW flag set. The file system gets to fill it in 1456 1456 * before unlocking it via unlock_new_inode(). 1457 1457 */ 1458 - struct inode *iget_locked(struct super_block *sb, unsigned long ino) 1458 + struct inode *iget_locked(struct super_block *sb, u64 ino) 1459 1459 { 1460 1460 struct hlist_head *head = inode_hashtable + hash(sb, ino); 1461 1461 struct inode *inode; ··· 1527 1527 * 1528 1528 * Returns 1 if the inode number is unique, 0 if it is not. 1529 1529 */ 1530 - static int test_inode_iunique(struct super_block *sb, unsigned long ino) 1530 + static int test_inode_iunique(struct super_block *sb, u64 ino) 1531 1531 { 1532 1532 struct hlist_head *b = inode_hashtable + hash(sb, ino); 1533 1533 struct inode *inode; ··· 1616 1616 * 1617 1617 * Note2: @test is called with the inode_hash_lock held, so can't sleep. 1618 1618 */ 1619 - struct inode *ilookup5_nowait(struct super_block *sb, unsigned long hashval, 1619 + struct inode *ilookup5_nowait(struct super_block *sb, u64 hashval, 1620 1620 int (*test)(struct inode *, void *), void *data, bool *isnew) 1621 1621 { 1622 1622 struct hlist_head *head = inode_hashtable + hash(sb, hashval); ··· 1647 1647 * 1648 1648 * Note: @test is called with the inode_hash_lock held, so can't sleep. 1649 1649 */ 1650 - struct inode *ilookup5(struct super_block *sb, unsigned long hashval, 1650 + struct inode *ilookup5(struct super_block *sb, u64 hashval, 1651 1651 int (*test)(struct inode *, void *), void *data) 1652 1652 { 1653 1653 struct inode *inode; ··· 1677 1677 * Search for the inode @ino in the inode cache, and if the inode is in the 1678 1678 * cache, the inode is returned with an incremented reference count. 1679 1679 */ 1680 - struct inode *ilookup(struct super_block *sb, unsigned long ino) 1680 + struct inode *ilookup(struct super_block *sb, u64 ino) 1681 1681 { 1682 1682 struct hlist_head *head = inode_hashtable + hash(sb, ino); 1683 1683 struct inode *inode; ··· 1726 1726 * very carefully implemented. 1727 1727 */ 1728 1728 struct inode *find_inode_nowait(struct super_block *sb, 1729 - unsigned long hashval, 1730 - int (*match)(struct inode *, unsigned long, 1729 + u64 hashval, 1730 + int (*match)(struct inode *, u64, 1731 1731 void *), 1732 1732 void *data) 1733 1733 { ··· 1773 1773 * 1774 1774 * The caller must hold the RCU read lock. 1775 1775 */ 1776 - struct inode *find_inode_rcu(struct super_block *sb, unsigned long hashval, 1776 + struct inode *find_inode_rcu(struct super_block *sb, u64 hashval, 1777 1777 int (*test)(struct inode *, void *), void *data) 1778 1778 { 1779 1779 struct hlist_head *head = inode_hashtable + hash(sb, hashval); ··· 1812 1812 * The caller must hold the RCU read lock. 1813 1813 */ 1814 1814 struct inode *find_inode_by_ino_rcu(struct super_block *sb, 1815 - unsigned long ino) 1815 + u64 ino) 1816 1816 { 1817 1817 struct hlist_head *head = inode_hashtable + hash(sb, ino); 1818 1818 struct inode *inode; ··· 1833 1833 int insert_inode_locked(struct inode *inode) 1834 1834 { 1835 1835 struct super_block *sb = inode->i_sb; 1836 - ino_t ino = inode->i_ino; 1836 + u64 ino = inode->i_ino; 1837 1837 struct hlist_head *head = inode_hashtable + hash(sb, ino); 1838 1838 bool isnew; 1839 1839 ··· 1884 1884 } 1885 1885 EXPORT_SYMBOL(insert_inode_locked); 1886 1886 1887 - int insert_inode_locked4(struct inode *inode, unsigned long hashval, 1887 + int insert_inode_locked4(struct inode *inode, u64 hashval, 1888 1888 int (*test)(struct inode *, void *), void *data) 1889 1889 { 1890 1890 struct inode *old;
+21 -23
include/linux/fs.h
··· 2934 2934 } 2935 2935 extern void d_mark_dontcache(struct inode *inode); 2936 2936 2937 - extern struct inode *ilookup5_nowait(struct super_block *sb, 2938 - unsigned long hashval, int (*test)(struct inode *, void *), 2939 - void *data, bool *isnew); 2940 - extern struct inode *ilookup5(struct super_block *sb, unsigned long hashval, 2941 - int (*test)(struct inode *, void *), void *data); 2942 - extern struct inode *ilookup(struct super_block *sb, unsigned long ino); 2937 + struct inode *ilookup5_nowait(struct super_block *sb, u64 hashval, 2938 + int (*test)(struct inode *, void *), void *data, 2939 + bool *isnew); 2940 + struct inode *ilookup5(struct super_block *sb, u64 hashval, 2941 + int (*test)(struct inode *, void *), void *data); 2942 + struct inode *ilookup(struct super_block *sb, u64 ino); 2943 2943 2944 - extern struct inode *inode_insert5(struct inode *inode, unsigned long hashval, 2945 - int (*test)(struct inode *, void *), 2946 - int (*set)(struct inode *, void *), 2947 - void *data); 2948 - struct inode *iget5_locked(struct super_block *, unsigned long, 2944 + struct inode *inode_insert5(struct inode *inode, u64 hashval, 2945 + int (*test)(struct inode *, void *), 2946 + int (*set)(struct inode *, void *), void *data); 2947 + struct inode *iget5_locked(struct super_block *, u64, 2949 2948 int (*test)(struct inode *, void *), 2950 2949 int (*set)(struct inode *, void *), void *); 2951 - struct inode *iget5_locked_rcu(struct super_block *, unsigned long, 2950 + struct inode *iget5_locked_rcu(struct super_block *, u64, 2952 2951 int (*test)(struct inode *, void *), 2953 2952 int (*set)(struct inode *, void *), void *); 2954 - extern struct inode * iget_locked(struct super_block *, unsigned long); 2955 - extern struct inode *find_inode_nowait(struct super_block *, 2956 - unsigned long, 2957 - int (*match)(struct inode *, 2958 - unsigned long, void *), 2959 - void *data); 2960 - extern struct inode *find_inode_rcu(struct super_block *, unsigned long, 2961 - int (*)(struct inode *, void *), void *); 2962 - extern struct inode *find_inode_by_ino_rcu(struct super_block *, unsigned long); 2963 - extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); 2953 + struct inode *iget_locked(struct super_block *, u64); 2954 + struct inode *find_inode_nowait(struct super_block *, u64, 2955 + int (*match)(struct inode *, u64, void *), 2956 + void *data); 2957 + struct inode *find_inode_rcu(struct super_block *, u64, 2958 + int (*)(struct inode *, void *), void *); 2959 + struct inode *find_inode_by_ino_rcu(struct super_block *, u64); 2960 + int insert_inode_locked4(struct inode *, u64, 2961 + int (*test)(struct inode *, void *), void *); 2964 2962 extern int insert_inode_locked(struct inode *); 2965 2963 #ifdef CONFIG_DEBUG_LOCK_ALLOC 2966 2964 extern void lockdep_annotate_inode_mutex_key(struct inode *inode); ··· 3013 3015 */ 3014 3016 #define alloc_inode_sb(_sb, _cache, _gfp) kmem_cache_alloc_lru(_cache, &_sb->s_inode_lru, _gfp) 3015 3017 3016 - extern void __insert_inode_hash(struct inode *, unsigned long hashval); 3018 + void __insert_inode_hash(struct inode *, u64 hashval); 3017 3019 static inline void insert_inode_hash(struct inode *inode) 3018 3020 { 3019 3021 __insert_inode_hash(inode, inode->i_ino);