linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.com>
Cc: dsterba@suse.cz, Chris Mason <clm@fb.com>,
	Josef Bacik <jbacik@fb.com>,
	linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] btrfs/volumes: Improve unlocking of a mutex in __btrfs_balance()
Date: Mon, 6 Nov 2017 16:08:08 +0100	[thread overview]
Message-ID: <26ba6f26-7132-282b-7b90-3b691a704e4c@users.sourceforge.net> (raw)
In-Reply-To: <20171106142450.GF28789@twin.jikos.cz>

>> @@ -3682,7 +3678,7 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
>>  		counting = false;
>>  		goto again;
>>  	}
>> -error:
>> +free_path:
>>  	btrfs_free_path(path);
>>  	if (enospc_errors) {
>>  		btrfs_info(fs_info, "%d enospc errors during balance",
>> @@ -3692,6 +3688,10 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
>>  	}
>>  
>>  	return ret;
>> +
>> +unlock:
>> +	mutex_unlock(&fs_info->delete_unused_bgs_mutex);
>> +	goto free_path;
>>  }
> 
> This is also an anti-pattern,

I got an other software development opinion for this use case.


> the label followed by a goto jumping back to the exit/cleanup block,
> right at the end of a function.

I find that this way can be useful for efficient exception handling.


> I've sent some patches in the past to clean that up

Interesting …


> and don't want to reintroduce it.

Would you like to reconsider this view if the object code size
could be reduced a bit for the affected function implementation?

Regards,
Markus

      reply	other threads:[~2017-11-06 15:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-06  8:04 [PATCH] btrfs/volumes: Improve unlocking of a mutex in __btrfs_balance() SF Markus Elfring
2017-11-06 14:24 ` David Sterba
2017-11-06 15:08   ` SF Markus Elfring [this message]

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=26ba6f26-7132-282b-7b90-3b691a704e4c@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=jbacik@fb.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).