linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/6] btrfs: rename btrfs_find_device_by_path()
Date: Fri, 18 Jan 2019 18:05:18 +0100	[thread overview]
Message-ID: <20190118170517.GB2900@twin.jikos.cz> (raw)
In-Reply-To: <30537913-7f91-9bea-81ce-c9e40b467412@oracle.com>

On Fri, Jan 18, 2019 at 02:13:19PM +0800, Anand Jain wrote:
> On 01/17/2019 11:54 PM, David Sterba wrote:
> > On Thu, Jan 17, 2019 at 11:32:30PM +0800, Anand Jain wrote:
> >> btrfs_find_device_by_path() is a helper function, drop the btrfs prefix
> >> and the suffix _path is too generic, in fact as it reads superblock to
> >> find the btrfs_device, so rename it to find_device_by_superblock()
> > 
> > The function takes a path so it's search by path, as the name says, I
> > don't think that needs to change.
> 
>   Sorry I didn't mention about my motivation to rename..
>   find device by matching the device_path (without reading its
>   superblock) is done by btrfs_free_stale_devices() and its helper
>   device_path_matched() in the patch [1] which is in next-dev.
> 
>   [1]
>   btrfs: refactor btrfs_free_stale_devices() to get return value
> 
>   So a reader can think why not use btrfs_find_device_by_path() here,
>   unless fn is read to find out it matches the device by taking
>   the devid from the superblock.

That would be really unfortunate to conflate a simple short helper that
really wraps strcmp with a function doing a lot of other things. With
source code at hand we don't have to speculate from a function name what
it does, we go and read it if not sure.

>   Its not a big deal though.. I am ok to keep this as it is.. or... more
>   below..
> 
> > And even this is a helper, the
> > btrfs_ prefix is useful in case there's something stuck inside the
> > block layer functions that get called later so it's obvious on the
> > stack.
> 
>   Makes sense.
> 
>   Or.
>   I think its a good idea to collapse this relatively small function into
>   its only parent, btrfs_find_device_by_devspec().

Devspec is either device id or the path, so the _devspec is a switch to
two ways how to find the device and merging the the helper code does not
seem to improve code.

Sorry I really fail to see the point of this patch and the code issues
it's supposed to resolve.

  reply	other threads:[~2019-01-18 17:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 15:32 [PATCH 0/6] btrfs: find_device cleanups Anand Jain
2019-01-17 15:32 ` [PATCH 1/6] btrfs: merge btrfs_find_device_missing_or_by_path() into parent Anand Jain
2019-01-17 15:57   ` David Sterba
2019-01-17 15:32 ` [PATCH 2/6] btrfs: cleanup btrfs_find_device_by_devspec() Anand Jain
2019-01-17 15:57   ` David Sterba
2019-01-17 15:32 ` [PATCH 3/6] btrfs: rename btrfs_find_device_by_path() Anand Jain
2019-01-17 15:54   ` David Sterba
2019-01-18  6:13     ` Anand Jain
2019-01-18 17:05       ` David Sterba [this message]
2019-01-17 15:32 ` [PATCH 4/6] btrfs: refactor btrfs_find_device() take fs_devices as argument Anand Jain
2019-01-17 15:58   ` David Sterba
2019-01-17 15:32 ` [PATCH 5/6] btrfs: merge btrfs_find_device() and find_device() Anand Jain
2019-01-17 15:51   ` David Sterba
2019-01-19  6:48   ` [PATCH 5/6 v2] " Anand Jain
2019-01-23  5:28     ` Anand Jain
2019-01-28 18:44     ` David Sterba
2019-01-17 15:32 ` [PATCH 6/6] btrfs: refactor btrfs_find_device() return error code Anand Jain
2019-01-17 15:49   ` David Sterba
2019-01-18  6:13     ` Anand Jain
2019-01-18 17:20       ` David Sterba
2019-01-18 17:33 ` [PATCH 0/6] btrfs: find_device cleanups David Sterba
2019-01-19  6:54   ` Anand Jain

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=20190118170517.GB2900@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --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).