* [PATCH] btrfs: remove 32bit compat code for VFS inode number
@ 2026-04-14 20:12 David Sterba
2026-04-15 0:06 ` Qu Wenruo
0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2026-04-14 20:12 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Commit 0b2600f81cefcd ("treewide: change inode->i_ino from unsigned long
to u64") sets the inode number type to u64 unconditionally, so we can
use it directly as there's no difference on 32bit and 64bit platform. We
used to have a copy of the number in our btrfs_inode.
The size of btrfs_inode on 32bit platform is about 688 bytes (after the
change).
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/btrfs_inode.h | 31 -------------------------------
fs/btrfs/verity.c | 4 ++--
2 files changed, 2 insertions(+), 33 deletions(-)
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 55c272fe5d92a0..3481c91fec7cfb 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -128,15 +128,6 @@ struct btrfs_inode {
/* which subvolume this inode belongs to */
struct btrfs_root *root;
-#if BITS_PER_LONG == 32
- /*
- * The objectid of the corresponding BTRFS_INODE_ITEM_KEY.
- * On 64 bits platforms we can get it from vfs_inode.i_ino, which is an
- * unsigned long and therefore 64 bits on such platforms.
- */
- u64 objectid;
-#endif
-
/* Cached value of inode property 'compression'. */
u8 prop_compress;
@@ -372,30 +363,11 @@ static inline unsigned long btrfs_inode_hash(u64 objectid,
return (unsigned long)h;
}
-#if BITS_PER_LONG == 32
-
-/*
- * On 32 bit systems the i_ino of struct inode is 32 bits (unsigned long), so
- * we use the inode's location objectid which is a u64 to avoid truncation.
- */
-static inline u64 btrfs_ino(const struct btrfs_inode *inode)
-{
- u64 ino = inode->objectid;
-
- if (test_bit(BTRFS_INODE_ROOT_STUB, &inode->runtime_flags))
- ino = inode->vfs_inode.i_ino;
- return ino;
-}
-
-#else
-
static inline u64 btrfs_ino(const struct btrfs_inode *inode)
{
return inode->vfs_inode.i_ino;
}
-#endif
-
static inline void btrfs_get_inode_key(const struct btrfs_inode *inode,
struct btrfs_key *key)
{
@@ -406,9 +378,6 @@ static inline void btrfs_get_inode_key(const struct btrfs_inode *inode,
static inline void btrfs_set_inode_number(struct btrfs_inode *inode, u64 ino)
{
-#if BITS_PER_LONG == 32
- inode->objectid = ino;
-#endif
inode->vfs_inode.i_ino = ino;
}
diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c
index 0062b3a5578199..983365a7354168 100644
--- a/fs/btrfs/verity.c
+++ b/fs/btrfs/verity.c
@@ -458,7 +458,7 @@ static int rollback_verity(struct btrfs_inode *inode)
if (ret) {
btrfs_handle_fs_error(root->fs_info, ret,
"failed to drop verity items in rollback %llu",
- (u64)inode->vfs_inode.i_ino);
+ inode->vfs_inode.i_ino);
goto out;
}
@@ -472,7 +472,7 @@ static int rollback_verity(struct btrfs_inode *inode)
trans = NULL;
btrfs_handle_fs_error(root->fs_info, ret,
"failed to start transaction in verity rollback %llu",
- (u64)inode->vfs_inode.i_ino);
+ inode->vfs_inode.i_ino);
goto out;
}
inode->ro_flags &= ~BTRFS_INODE_RO_VERITY;
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: remove 32bit compat code for VFS inode number
2026-04-14 20:12 [PATCH] btrfs: remove 32bit compat code for VFS inode number David Sterba
@ 2026-04-15 0:06 ` Qu Wenruo
2026-04-27 15:12 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2026-04-15 0:06 UTC (permalink / raw)
To: David Sterba, linux-btrfs
在 2026/4/15 05:42, David Sterba 写道:
> Commit 0b2600f81cefcd ("treewide: change inode->i_ino from unsigned long
> to u64") sets the inode number type to u64 unconditionally, so we can
> use it directly as there's no difference on 32bit and 64bit platform. We
> used to have a copy of the number in our btrfs_inode.
>
> The size of btrfs_inode on 32bit platform is about 688 bytes (after the
> change).
>
> Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
But that treewide patch is not yet in our for-next, we can only merge it
after our for-next is rebased.
Thanks,
Qu
> ---
> fs/btrfs/btrfs_inode.h | 31 -------------------------------
> fs/btrfs/verity.c | 4 ++--
> 2 files changed, 2 insertions(+), 33 deletions(-)
>
> diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> index 55c272fe5d92a0..3481c91fec7cfb 100644
> --- a/fs/btrfs/btrfs_inode.h
> +++ b/fs/btrfs/btrfs_inode.h
> @@ -128,15 +128,6 @@ struct btrfs_inode {
> /* which subvolume this inode belongs to */
> struct btrfs_root *root;
>
> -#if BITS_PER_LONG == 32
> - /*
> - * The objectid of the corresponding BTRFS_INODE_ITEM_KEY.
> - * On 64 bits platforms we can get it from vfs_inode.i_ino, which is an
> - * unsigned long and therefore 64 bits on such platforms.
> - */
> - u64 objectid;
> -#endif
> -
> /* Cached value of inode property 'compression'. */
> u8 prop_compress;
>
> @@ -372,30 +363,11 @@ static inline unsigned long btrfs_inode_hash(u64 objectid,
> return (unsigned long)h;
> }
>
> -#if BITS_PER_LONG == 32
> -
> -/*
> - * On 32 bit systems the i_ino of struct inode is 32 bits (unsigned long), so
> - * we use the inode's location objectid which is a u64 to avoid truncation.
> - */
> -static inline u64 btrfs_ino(const struct btrfs_inode *inode)
> -{
> - u64 ino = inode->objectid;
> -
> - if (test_bit(BTRFS_INODE_ROOT_STUB, &inode->runtime_flags))
> - ino = inode->vfs_inode.i_ino;
> - return ino;
> -}
> -
> -#else
> -
> static inline u64 btrfs_ino(const struct btrfs_inode *inode)
> {
> return inode->vfs_inode.i_ino;
> }
>
> -#endif
> -
> static inline void btrfs_get_inode_key(const struct btrfs_inode *inode,
> struct btrfs_key *key)
> {
> @@ -406,9 +378,6 @@ static inline void btrfs_get_inode_key(const struct btrfs_inode *inode,
>
> static inline void btrfs_set_inode_number(struct btrfs_inode *inode, u64 ino)
> {
> -#if BITS_PER_LONG == 32
> - inode->objectid = ino;
> -#endif
> inode->vfs_inode.i_ino = ino;
> }
>
> diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c
> index 0062b3a5578199..983365a7354168 100644
> --- a/fs/btrfs/verity.c
> +++ b/fs/btrfs/verity.c
> @@ -458,7 +458,7 @@ static int rollback_verity(struct btrfs_inode *inode)
> if (ret) {
> btrfs_handle_fs_error(root->fs_info, ret,
> "failed to drop verity items in rollback %llu",
> - (u64)inode->vfs_inode.i_ino);
> + inode->vfs_inode.i_ino);
> goto out;
> }
>
> @@ -472,7 +472,7 @@ static int rollback_verity(struct btrfs_inode *inode)
> trans = NULL;
> btrfs_handle_fs_error(root->fs_info, ret,
> "failed to start transaction in verity rollback %llu",
> - (u64)inode->vfs_inode.i_ino);
> + inode->vfs_inode.i_ino);
> goto out;
> }
> inode->ro_flags &= ~BTRFS_INODE_RO_VERITY;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: remove 32bit compat code for VFS inode number
2026-04-15 0:06 ` Qu Wenruo
@ 2026-04-27 15:12 ` David Sterba
0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2026-04-27 15:12 UTC (permalink / raw)
To: Qu Wenruo; +Cc: David Sterba, linux-btrfs
On Wed, Apr 15, 2026 at 09:36:21AM +0930, Qu Wenruo wrote:
>
>
> 在 2026/4/15 05:42, David Sterba 写道:
> > Commit 0b2600f81cefcd ("treewide: change inode->i_ino from unsigned long
> > to u64") sets the inode number type to u64 unconditionally, so we can
> > use it directly as there's no difference on 32bit and 64bit platform. We
> > used to have a copy of the number in our btrfs_inode.
> >
> > The size of btrfs_inode on 32bit platform is about 688 bytes (after the
> > change).
> >
> > Signed-off-by: David Sterba <dsterba@suse.com>
>
> Reviewed-by: Qu Wenruo <wqu@suse.com>
>
> But that treewide patch is not yet in our for-next, we can only merge it
> after our for-next is rebased.
Done.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-27 15:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14 20:12 [PATCH] btrfs: remove 32bit compat code for VFS inode number David Sterba
2026-04-15 0:06 ` Qu Wenruo
2026-04-27 15:12 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox