linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 0/3] cleanup couple of device-related functions' retval
Date: Mon,  3 Sep 2018 12:46:11 +0300	[thread overview]
Message-ID: <20180903094614.2667-1-nborisov@suse.com> (raw)

Currently btrfs_find_device_by_path, btrfs_find_device_missing_or_by_path and 
btrfs_find_device_by_devspec are called in a chain and they all return an 
integer value to signal error and at the same time use one of their parameters
as an output. This patch set refactors those functions starting from the 
bottom, gradually making them return a pointer to btrfs_device. This is 
sufficient to convey an error when it occurs as well as return the actual 
device we are looking for. One added benefit is that the ioctl-specific positive
return value BTRFS_ERROR_DEV_MISSING_NOT_FOUND is now returned from 
btrfs_rm_device rather than from some internal function. 

Additionally I'll be sending a patch to progs, adding a test ensuring that 
BTRFS_ERROR_MISSING_NOT_FOUND is returned appropriately. 

This survived both my btrfs-progs test as well as xfstest run. No functional 
changes.


Nikolay Borisov (3):
  btrfs: Make btrfs_find_device_by_path return struct btrfs_device
  btrfs: Make btrfs_find_device_missing_or_by_path return directly a
    device
  btrfs: Make btrfs_find_device_by_devspec return btrfs_device directly

 fs/btrfs/dev-replace.c |  8 ++---
 fs/btrfs/volumes.c     | 73 ++++++++++++++++++++++--------------------
 fs/btrfs/volumes.h     |  9 ++----
 3 files changed, 45 insertions(+), 45 deletions(-)

-- 
2.17.1

             reply	other threads:[~2018-09-03 14:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03  9:46 Nikolay Borisov [this message]
2018-09-03  9:46 ` [PATCH 1/3] btrfs: Make btrfs_find_device_by_path return struct btrfs_device Nikolay Borisov
2018-09-03 12:13   ` Qu Wenruo
2018-09-10 18:02   ` David Sterba
2018-09-03  9:46 ` [PATCH 2/3] btrfs: Make btrfs_find_device_missing_or_by_path return directly a device Nikolay Borisov
2018-09-03 12:23   ` Qu Wenruo
2018-09-03  9:46 ` [PATCH 3/3] btrfs: Make btrfs_find_device_by_devspec return btrfs_device directly Nikolay Borisov
2018-09-03 12:27   ` Qu Wenruo
2018-09-03 10:02 ` [PATCH] btrfs-progs: tests: Add test for missing device delete error value Nikolay Borisov
2018-09-10 17:57   ` David Sterba
2018-09-11 14:31     ` David Sterba
2018-09-10 18:07 ` [PATCH 0/3] cleanup couple of device-related functions' retval 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=20180903094614.2667-1-nborisov@suse.com \
    --to=nborisov@suse.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).