From: Stefan Behrens <sbehrens@giantdisaster.de>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 3/3] btrfs-progs: handle error in the btrfs_prepare_device
Date: Tue, 17 Dec 2013 09:01:37 +0100 [thread overview]
Message-ID: <52B004E1.706@giantdisaster.de> (raw)
In-Reply-To: <1387247616-1574-3-git-send-email-anand.jain@oracle.com>
On Tue, 17 Dec 2013 10:33:36 +0800, Anand Jain wrote:
> this patch will handle the strerror reporting of the error instead of
> printing errno, and also replaced the BUG_ON with the error handling
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> v2: commit update
> ---
> cmds-device.c | 7 +++----
> cmds-replace.c | 10 ++++------
> mkfs.c | 9 ++++++++-
> utils.c | 30 +++++++++++++++++++-----------
> 4 files changed, 34 insertions(+), 22 deletions(-)
>
[...]
> diff --git a/cmds-replace.c b/cmds-replace.c
> index d9b0940..8160107 100644
> --- a/cmds-replace.c
> +++ b/cmds-replace.c
> @@ -276,13 +276,11 @@ static int cmd_start_replace(int argc, char **argv)
> }
> strncpy((char *)start_args.start.tgtdev_name, dstdev,
> BTRFS_DEVICE_PATH_NAME_MAX);
> - if (btrfs_prepare_device(fddstdev, dstdev, 1, &dstdev_block_count, 0,
> - &mixed, 0)) {
> - fprintf(stderr, "Error: Failed to prepare device '%s'\n",
> - dstdev);
> - goto leave_with_error;
> - }
> + ret = btrfs_prepare_device(fddstdev, dstdev, 1, &dstdev_block_count, 0,
> + &mixed, 0);
> close(fddstdev);
> + if (ret)
> + goto leave_with_error;
> fddstdev = -1;
You change the code to call close(fddstdev) twice.
[...]
> +zero_dev_error:
> + if (ret) {
> + ret < 0 ?
> + fprintf(stderr, "ERROR: failed to zero device start '%s' - %s\n",
> + file, strerror(-ret)) :
> + fprintf(stderr, "ERROR: failed to zero device start '%s' - %d\n",
> + file, ret);
This is not funny.
next prev parent reply other threads:[~2013-12-17 8:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 2:33 [PATCH v2 1/3] btrfs-progs: don't replicate the stripe_len defines Anand Jain
2013-12-17 2:33 ` [PATCH v2 2/3] btrfs-progs: use stripe_len define here Anand Jain
2013-12-17 2:33 ` [PATCH v2 3/3] btrfs-progs: handle error in the btrfs_prepare_device Anand Jain
2013-12-17 8:01 ` Stefan Behrens [this message]
2013-12-17 8:37 ` Anand Jain
2013-12-17 14:18 ` 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=52B004E1.706@giantdisaster.de \
--to=sbehrens@giantdisaster.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.