From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2] btrfs-progs: there is devid 0 when replace is running
Date: Tue, 4 Feb 2014 16:33:48 +0800 [thread overview]
Message-ID: <1391502828-24481-1-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1391487810-21545-1-git-send-email-anand.jain@oracle.com>
During disk replacement a new disk is temporarily
added to the fs devlist with devid 0 and fs num_device is
incremented by 1. However when progs reads the devlist it
fail to obtain details of devid 0 because it doesn't query
devid 0 at all.
reproducer:
btrfs rep start /dev/sdb /dev/sdf /btrfs
btrfs fi show
Label: none uuid: f8fb9819-16c8-47b7-b62f-0ff90f8c56cd
Total devices 3 FS bytes used 1.94GiB
devid 1 size 1.10GiB used 1.10GiB path /dev/sdb
devid 2 size 1.10GiB used 1.08GiB path /dev/sdc
devid 0 size 0.00 used 0.00 path
this patch will make it proper by querying devid 0.
btrfs repl start /dev/sdb /dev/sdf /btrfs
btrfs fi show /btrfs
Label: none uuid: f8fb9819-16c8-47b7-b62f-0ff90f8c56cd
Total devices 3 FS bytes used 1.94GiB
devid 0 size 1.10GiB used 1.10GiB path /dev/sdf
devid 1 size 1.10GiB used 1.10GiB path /dev/sdb
devid 2 size 1.10GiB used 1.08GiB path /dev/sdc
Its fine to query devid 0 when there is no replace
activity as well, because we just skip the error ENODEV
btrfs fi show /btrfs
Label: none uuid: f8fb9819-16c8-47b7-b62f-0ff90f8c56cd
Total devices 2 FS bytes used 1.94GiB
devid 1 size 1.10GiB used 1.10GiB path /dev/sdf
devid 2 size 1.10GiB used 1.08GiB path /dev/sdc
---
v2: fix commit message
utils.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/utils.c b/utils.c
index de513b6..a045ffd 100644
--- a/utils.c
+++ b/utils.c
@@ -1696,7 +1696,7 @@ int get_fs_info(char *path, struct btrfs_ioctl_fs_info_args *fi_args,
goto out;
}
- for (; i <= fi_args->max_id; ++i) {
+ for (i = 0; i <= fi_args->max_id; ++i) {
BUG_ON(ndevs >= fi_args->num_devices);
ret = get_device_info(fd, i, &di_args[ndevs]);
if (ret == -ENODEV)
--
1.7.1
next prev parent reply other threads:[~2014-02-04 8:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 4:23 [PATCH] btrfs-progs: there is devid 0 when replace is running Anand Jain
2014-02-04 8:33 ` Anand Jain [this message]
2014-02-24 11:24 ` [PATCH v2] " 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=1391502828-24481-1-git-send-email-anand.jain@oracle.com \
--to=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).