All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3 v3] btrfs-progs: there is devid 0 when replace is running
@ 2014-02-24 11:43 Anand Jain
  2014-02-24 11:43 ` [PATCH 2/3] btrfs-progs: latest_devid is not always the probed devid Anand Jain
  2014-02-24 11:43 ` [PATCH 3/3] btrfs-progs: Fix bug when scanned for devid which was missing and deleted Anand Jain
  0 siblings, 2 replies; 5+ messages in thread
From: Anand Jain @ 2014-02-24 11:43 UTC (permalink / raw)
  To: linux-btrfs

From: Anand Jain <anand.jain@oracle.com>

as of now, when we replace a disk, it is added to the
dev list with devid 0. And we fail to obtain details
of devid 0 because we don'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

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
---
 v3: it needs to handle per devid probe
 v2: commit message fix

 utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils.c b/utils.c
index de513b6..e0c750d 100644
--- a/utils.c
+++ b/utils.c
@@ -1637,7 +1637,7 @@ int get_fs_info(char *path, struct btrfs_ioctl_fs_info_args *fi_args,
 	int fd = -1;
 	int ret = 0;
 	int ndevs = 0;
-	int i = 1;
+	int i = 0;
 	struct btrfs_fs_devices *fs_devices_mnt = NULL;
 	struct btrfs_ioctl_dev_info_args *di_args;
 	char mp[BTRFS_PATH_NAME_MAX + 1];
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-26  2:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-24 11:43 [PATCH 1/3 v3] btrfs-progs: there is devid 0 when replace is running Anand Jain
2014-02-24 11:43 ` [PATCH 2/3] btrfs-progs: latest_devid is not always the probed devid Anand Jain
2014-02-25 17:27   ` David Sterba
2014-02-26  2:06     ` Anand Jain
2014-02-24 11:43 ` [PATCH 3/3] btrfs-progs: Fix bug when scanned for devid which was missing and deleted Anand Jain

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.