linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove the inode cache check at btrfs_is_free_space_inode()
@ 2022-07-06 10:14 fdmanana
  2022-07-07  0:50 ` Boris Burkov
  2022-07-07 16:26 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: fdmanana @ 2022-07-06 10:14 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

The inode cache feature was removed in kernel 5.11, and we no longer have
any code that reads from or writes to inode caches. We may still mount a
filesystem that has inode caches, but they are ignored.

Remove the check for an inode cache from btrfs_is_free_space_inode(),
since we no longer have code to trigger reads from an inode cache or
writes to an inode cache. The check at send.c is still needed, because
in case we find a filesystem with an inode cache, we must ignore it.
Also leave the checks at tree-checker.c, as they are sanity checks.

This eliminates a dead branch and reduces the amount of code since it's
in an inline function.

Before:

$ size fs/btrfs/btrfs.ko
   text	   data	    bss	    dec	    hex	filename
1620662	 189240	  29032	1838934	 1c0f56	fs/btrfs/btrfs.ko

After:

$ size fs/btrfs/btrfs.ko
   text	   data	    bss	    dec	    hex	filename
1620502	 189240	  29032	1838774	 1c0eb6	fs/btrfs/btrfs.ko

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/btrfs_inode.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 33811e896623..b467264bd1bb 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -305,8 +305,7 @@ static inline bool btrfs_is_free_space_inode(struct btrfs_inode *inode)
 	if (root == root->fs_info->tree_root &&
 	    btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
 		return true;
-	if (inode->location.objectid == BTRFS_FREE_INO_OBJECTID)
-		return true;
+
 	return false;
 }
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: remove the inode cache check at btrfs_is_free_space_inode()
  2022-07-06 10:14 [PATCH] btrfs: remove the inode cache check at btrfs_is_free_space_inode() fdmanana
@ 2022-07-07  0:50 ` Boris Burkov
  2022-07-07 16:26 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Burkov @ 2022-07-07  0:50 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Wed, Jul 06, 2022 at 11:14:23AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> The inode cache feature was removed in kernel 5.11, and we no longer have
> any code that reads from or writes to inode caches. We may still mount a
> filesystem that has inode caches, but they are ignored.
> 
> Remove the check for an inode cache from btrfs_is_free_space_inode(),
> since we no longer have code to trigger reads from an inode cache or
> writes to an inode cache. The check at send.c is still needed, because
> in case we find a filesystem with an inode cache, we must ignore it.
> Also leave the checks at tree-checker.c, as they are sanity checks.
> 
> This eliminates a dead branch and reduces the amount of code since it's
> in an inline function.
> 
> Before:
> 
> $ size fs/btrfs/btrfs.ko
>    text	   data	    bss	    dec	    hex	filename
> 1620662	 189240	  29032	1838934	 1c0f56	fs/btrfs/btrfs.ko
> 
> After:
> 
> $ size fs/btrfs/btrfs.ko
>    text	   data	    bss	    dec	    hex	filename
> 1620502	 189240	  29032	1838774	 1c0eb6	fs/btrfs/btrfs.ko
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  fs/btrfs/btrfs_inode.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> index 33811e896623..b467264bd1bb 100644
> --- a/fs/btrfs/btrfs_inode.h
> +++ b/fs/btrfs/btrfs_inode.h
> @@ -305,8 +305,7 @@ static inline bool btrfs_is_free_space_inode(struct btrfs_inode *inode)
>  	if (root == root->fs_info->tree_root &&
>  	    btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
>  		return true;
> -	if (inode->location.objectid == BTRFS_FREE_INO_OBJECTID)
> -		return true;
> +
>  	return false;
>  }
>  
> -- 
> 2.35.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: remove the inode cache check at btrfs_is_free_space_inode()
  2022-07-06 10:14 [PATCH] btrfs: remove the inode cache check at btrfs_is_free_space_inode() fdmanana
  2022-07-07  0:50 ` Boris Burkov
@ 2022-07-07 16:26 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-07-07 16:26 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Wed, Jul 06, 2022 at 11:14:23AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> The inode cache feature was removed in kernel 5.11, and we no longer have
> any code that reads from or writes to inode caches. We may still mount a
> filesystem that has inode caches, but they are ignored.
> 
> Remove the check for an inode cache from btrfs_is_free_space_inode(),
> since we no longer have code to trigger reads from an inode cache or
> writes to an inode cache. The check at send.c is still needed, because
> in case we find a filesystem with an inode cache, we must ignore it.
> Also leave the checks at tree-checker.c, as they are sanity checks.
> 
> This eliminates a dead branch and reduces the amount of code since it's
> in an inline function.
> 
> Before:
> 
> $ size fs/btrfs/btrfs.ko
>    text	   data	    bss	    dec	    hex	filename
> 1620662	 189240	  29032	1838934	 1c0f56	fs/btrfs/btrfs.ko
> 
> After:
> 
> $ size fs/btrfs/btrfs.ko
>    text	   data	    bss	    dec	    hex	filename
> 1620502	 189240	  29032	1838774	 1c0eb6	fs/btrfs/btrfs.ko
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Added to misc-next, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-07 16:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 10:14 [PATCH] btrfs: remove the inode cache check at btrfs_is_free_space_inode() fdmanana
2022-07-07  0:50 ` Boris Burkov
2022-07-07 16:26 ` David Sterba

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).