public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/8] btrfs: simplify error check condition at btrfs_dirty_inode()
Date: Sat, 23 Sep 2023 07:30:03 +0930	[thread overview]
Message-ID: <34127e44-7bc7-420d-8acf-ec0ab6598ddb@gmx.com> (raw)
In-Reply-To: <5d46b47eaa1ab5c82ad17cb4e3d59ddf9857ff4e.1695333082.git.fdmanana@suse.com>



On 2023/9/22 20:07, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> The following condition at btrfs_dirty_inode() is redundant:
>
>    if (ret && (ret == -ENOSPC || ret == -EDQUOT))
>
> The first check for a non-zero 'ret' value is pointless, we can simplify
> this to simply:
>
>    if (ret == -ENOSPC || ret == -EDQUOT)
>
> Not only this makes it easier to read, it also slightly reduces the text
> size of the btrfs kernel module:
>
>    $ size fs/btrfs/btrfs.ko.before
>       text	   data	    bss	    dec	    hex	filename
>    1641400	 168265	  16864	1826529	 1bdee1	fs/btrfs/btrfs.ko.before
>
>    $ size fs/btrfs/btrfs.ko.after
>       text	   data	    bss	    dec	    hex	filename
>    1641224	 168181	  16864	1826269	 1bdddd	fs/btrfs/btrfs.ko.after
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

A little surprised that compiler didn't optimize it out.

Thanks,
Qu
> ---
>   fs/btrfs/inode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 514d2e8a4f52..f16dfeabeaf0 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -6011,7 +6011,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode)
>   		return PTR_ERR(trans);
>
>   	ret = btrfs_update_inode(trans, root, inode);
> -	if (ret && (ret == -ENOSPC || ret == -EDQUOT)) {
> +	if (ret == -ENOSPC || ret == -EDQUOT) {
>   		/* whoops, lets try again with the full transaction */
>   		btrfs_end_transaction(trans);
>   		trans = btrfs_start_transaction(root, 1);

  reply	other threads:[~2023-09-22 22:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 10:37 [PATCH 0/8] btrfs: some cleanups around inode update and helpers fdmanana
2023-09-22 10:37 ` [PATCH 1/8] btrfs: simplify error check condition at btrfs_dirty_inode() fdmanana
2023-09-22 22:00   ` Qu Wenruo [this message]
2023-09-22 10:37 ` [PATCH 2/8] btrfs: remove noline from btrfs_update_inode() fdmanana
2023-09-22 22:00   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 3/8] btrfs: remove redundant root argument from btrfs_update_inode_fallback() fdmanana
2023-09-22 10:37 ` [PATCH 4/8] btrfs: remove redundant root argument from btrfs_update_inode() fdmanana
2023-09-22 22:04   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 5/8] btrfs: remove redundant root argument from btrfs_update_inode_item() fdmanana
2023-09-22 22:06   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 6/8] btrfs: remove redundant root argument from btrfs_delayed_update_inode() fdmanana
2023-09-22 22:08   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 7/8] btrfs: remove redundant root argument from maybe_insert_hole() fdmanana
2023-09-22 22:09   ` Qu Wenruo
2023-09-22 10:37 ` [PATCH 8/8] btrfs: remove redundant root argument from fixup_inode_link_count() fdmanana
2023-09-22 22:11   ` Qu Wenruo
2023-09-22 13:48 ` [PATCH 0/8] btrfs: some cleanups around inode update and helpers David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34127e44-7bc7-420d-8acf-ec0ab6598ddb@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox