linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: dsterba@suse.cz, Johannes Thumshirn <jthumshirn@suse.de>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/4] btrfs: Refactor retval handling of btrfs_lookup_file_extent in btrfs_get_extent
Date: Tue, 8 Jan 2019 09:43:55 +0200	[thread overview]
Message-ID: <0ea43625-e55e-24d0-4a8e-44f1799b48a6@suse.com> (raw)
In-Reply-To: <20190107184613.GB23615@twin.jikos.cz>



On 7.01.19 г. 20:46 ч., David Sterba wrote:
> On Mon, Jan 07, 2019 at 04:22:01PM +0100, Johannes Thumshirn wrote:
>> On 02/01/2019 18:43, Nikolay Borisov wrote:
>>> On 2.01.19 г. 19:05 ч., David Sterba wrote:
>>>> This is repeating code and could be simplified ... to the original code.
>>>
>>> It does and this is intentional. What I've  strived to do is make the
>>> idea of the code obvious and not try to reduce the total line of code.
>>> It is a massive improvement given the code which modifies extent_end
>>> triggers only in case ret is > 0. I discussed this with Johannes and he
>>> agreed with my assessment.
>>>
>>>> I'm not sure this patch is an improvement.
>>
>> I think it really helps when trying to understand the code.
>>
>> This is why the patch was created in the first place, I asked Nik about
>> something and we went over the code together.
> 
> I've tried to read the new version again with fresh eyes and still don't
> see any improvement in readability. Not that the whole function is easy
> to follow, quite the opposite, but I'd rather see continued refactoring
> that untangles the gotos.
> 
> The return codes of btrfs_lookup_file_extent follow the common
> btrfs_search_slot pattern < 0 error, 0 found, > 0 not found. And in the
> last case there's an adjustment needed. Read the item type, check and
> branch if necessary. No surprises there.

Actually there is a surprise, this surprise is due to the fact that it's
not explicitly clear the adjustments happens when > 0 is returned. With
my patch it's clear which code gets executed only  when the respective
extent item wasn't found.

> 
> The amount of duplicated code is also not something trivial like
> a variable asisgnment, there are arguments passed etc.

The amount of duplication are 3 lines of linear code, I think this is
just being overly nitpicky given the (IMO) upside of this change.

> 

  reply	other threads:[~2019-01-08  7:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17  8:35 [PATCH 0/4] Misc cleanups of btrfs_get_extent Nikolay Borisov
2018-12-17  8:35 ` [PATCH 1/4] btrfs: Rename found_type to extent_type Nikolay Borisov
2018-12-17  8:54   ` Johannes Thumshirn
2018-12-17  9:05   ` Qu Wenruo
2018-12-17  8:36 ` [PATCH 2/4] btrfs: Consolidate retval checking of core btree functions Nikolay Borisov
2018-12-17  8:55   ` Johannes Thumshirn
2018-12-17  8:57     ` Nikolay Borisov
2018-12-17  9:09   ` Qu Wenruo
2018-12-17  9:23     ` Nikolay Borisov
2018-12-17  9:49   ` [PATCH v2 " Nikolay Borisov
2018-12-17 11:00     ` Qu Wenruo
2018-12-17  8:36 ` [PATCH 3/4] btrfs: Refactor retval handling of btrfs_lookup_file_extent in btrfs_get_extent Nikolay Borisov
2018-12-17  9:07   ` Johannes Thumshirn
2019-01-02 17:05   ` David Sterba
2019-01-02 17:43     ` Nikolay Borisov
2019-01-07 15:22       ` Johannes Thumshirn
2019-01-07 18:46         ` David Sterba
2019-01-08  7:43           ` Nikolay Borisov [this message]
2018-12-17  8:36 ` [PATCH 4/4] btrfs: Remove not_found_em label from btrfs_get_extent Nikolay Borisov
2018-12-17  9:08   ` Johannes Thumshirn
2019-01-02 17:08 ` [PATCH 0/4] Misc cleanups of btrfs_get_extent 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=0ea43625-e55e-24d0-4a8e-44f1799b48a6@suse.com \
    --to=nborisov@suse.com \
    --cc=dsterba@suse.cz \
    --cc=jthumshirn@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).