Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove pointless empty list check when reading delayed dir indexes
@ 2023-08-13 15:03 fdmanana
  2023-08-18 16:16 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: fdmanana @ 2023-08-13 15:03 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

At btrfs_readdir_delayed_dir_index(), called when reading a directory, we
have this check for an empty list to return immediately, but it's not
needed since list_for_each_entry_safe(), called immediately after, is
prepared to deal with an empty list, it simply does nothing. So remove
the empty list check.

Besides shorter source code, it also slightly reduces the binary text
size:

  Before this change:

    $ size fs/btrfs/btrfs.ko
       text	   data	    bss	    dec	    hex	filename
    1609408	 167269	  16864	1793541	 1b5e05	fs/btrfs/btrfs.ko

  After this change:

    $ size fs/btrfs/btrfs.ko
       text	   data	    bss	    dec	    hex	filename
    1609392	 167269	  16864	1793525	 1b5df5	fs/btrfs/btrfs.ko

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/delayed-inode.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 6d51db066503..85dcf0024137 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1736,9 +1736,6 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
 	int over = 0;
 	unsigned char d_type;
 
-	if (list_empty(ins_list))
-		return 0;
-
 	/*
 	 * Changing the data of the delayed item is impossible. So
 	 * we needn't lock them. And we have held i_mutex of the
-- 
2.34.1


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

* Re: [PATCH] btrfs: remove pointless empty list check when reading delayed dir indexes
  2023-08-13 15:03 [PATCH] btrfs: remove pointless empty list check when reading delayed dir indexes fdmanana
@ 2023-08-18 16:16 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2023-08-18 16:16 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Sun, Aug 13, 2023 at 04:03:28PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> At btrfs_readdir_delayed_dir_index(), called when reading a directory, we
> have this check for an empty list to return immediately, but it's not
> needed since list_for_each_entry_safe(), called immediately after, is
> prepared to deal with an empty list, it simply does nothing. So remove
> the empty list check.
> 
> Besides shorter source code, it also slightly reduces the binary text
> size:
> 
>   Before this change:
> 
>     $ size fs/btrfs/btrfs.ko
>        text	   data	    bss	    dec	    hex	filename
>     1609408	 167269	  16864	1793541	 1b5e05	fs/btrfs/btrfs.ko
> 
>   After this change:
> 
>     $ size fs/btrfs/btrfs.ko
>        text	   data	    bss	    dec	    hex	filename
>     1609392	 167269	  16864	1793525	 1b5df5	fs/btrfs/btrfs.ko
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

That one has also been in misc-next for some time, thanks.

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

end of thread, other threads:[~2023-08-18 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-13 15:03 [PATCH] btrfs: remove pointless empty list check when reading delayed dir indexes fdmanana
2023-08-18 16:16 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox