From: anand jain <anand.jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 06/11] btrfs-progs: scan /dev/mapper in filesystem show and device scan
Date: Tue, 13 Aug 2013 12:07:35 +0800 [thread overview]
Message-ID: <5209B107.7040506@oracle.com> (raw)
In-Reply-To: <20130805170419.GE5284@twin.jikos.cz>
On 06/08/2013 01:04, David Sterba wrote:
> On Mon, Jul 15, 2013 at 01:30:52PM +0800, Anand Jain wrote:
>> This patch adds --mapper option to btrfs device scan and
>> btrfs filesystem show cli, when used will look for btrfs
>> devs under /dev/mapper and will use the links provided
>> under the /dev/mapper.
>
>> In the long run I want the usage of /dev/mapper path
>> (along with /proc/partitions) be the default option to
>> scan for the btrfs devs. (/proc/partitions must be scanned
>> as well because to include the mapper blacklisted devs.)
>
> Well, we want to avoid using own scanning and always consult the blkid
> cache, so I'd rather stop adding user-visible changes to this command.
here is a test prog "t" (attached inline below) using blkid.
t picks up both non multipath path and mapper path as below.
----
# ./t
Device: /dev/sdb b03095dc-8eb5-40c9-8790-da6977110799
Device: /dev/sdc abc347f2-dfcc-46bf-a4ac-e21fba7ff1a3
Device: /dev/mapper/mpatha b03095dc-8eb5-40c9-8790-da6977110799
Device: /dev/mapper/mpathb abc347f2-dfcc-46bf-a4ac-e21fba7ff1a3
Found 4
------
However when
/etc/multipath.conf
defaults {
user_friendly_names no
}
then the mapper paths are not friendly enough to use
-------
# ./t
Device: /dev/sdb b03095dc-8eb5-40c9-8790-da6977110799
Device: /dev/sdc abc347f2-dfcc-46bf-a4ac-e21fba7ff1a3
Device: /dev/mapper/1ATA VBOX HARDDISK VB96b6139c-83f38bf1
b03095dc-8eb5-40c9-8790-da6977110799
Device: /dev/mapper/1ATA VBOX HARDDISK VBc6ab3781-f63da170
abc347f2-dfcc-46bf-a4ac-e21fba7ff1a3
Found 4
------
in this case the /dev/dm-<n> would have been better to use.
and our own scan does the better job here.. as it
reads /proc/partition and gives priority to dm-<n> paths
------
btrfs fi show
Label: none uuid: abc347f2-dfcc-46bf-a4ac-e21fba7ff1a3
Total devices 1 FS bytes used 28.00KiB
devid 1 size 2.00GiB used 240.75MiB path /dev/dm-1
Label: none uuid: b03095dc-8eb5-40c9-8790-da6977110799
Total devices 1 FS bytes used 28.00KiB
devid 1 size 1.98GiB used 238.25MiB path /dev/dm-0
-------
so as of now having our scan is better than blkid.
Now for the users who want to use the user friendly name
provided by mapper. the newly introduced option --mapper
which just looks under /dev/mapper will help.
Thanks, Anand
----------------t.c--------------
#include <stdio.h>
#include <blkid/blkid.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
main()
{
char *type;
char str[100];
int total = 0;
blkid_dev_iterate iter = NULL;
blkid_dev dev = NULL;
blkid_cache cache = NULL;
memset(str, '0', 100);
if (blkid_get_cache(&cache, 0) < 0)
return -1;
blkid_probe_all(cache);
iter = blkid_dev_iterate_begin(cache);
//blkid_dev_set_search(iter, NULL, NULL);
blkid_dev_set_search(iter, "TYPE", "btrfs");
while (blkid_dev_next(iter, &dev) == 0) {
dev = blkid_verify(cache, dev);
if (!dev)
continue;
else {
total++;
printf("Device: %s\t%s\n",
blkid_dev_devname(dev),
blkid_get_tag_value(cache,"UUID",
blkid_dev_devname(dev)));
}
}
blkid_dev_iterate_end(iter);
printf("Found %d\n", total);
return total;
}
next prev parent reply other threads:[~2013-08-13 4:07 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-10 14:56 [PATCH 0/9] btrfs-progs: coalesce of patches Anand Jain
2013-06-10 14:56 ` [PATCH 1/9] btrfs-progs: btrfs_scan_for_fsid doesn't need all the arguments Anand Jain
2013-06-10 20:00 ` Eric Sandeen
2013-06-11 13:15 ` anand jain
2013-06-10 14:56 ` [PATCH 2/9 v2] btrfs-progs: label option in btrfs filesystem show is not coded Anand Jain
2013-06-10 14:56 ` [PATCH 3/9 v2] btrfs-progs: update device scan usage Anand Jain
2013-06-10 14:56 ` [PATCH 4/9 v3] btrfs-progs: congregate dev scan Anand Jain
2013-06-10 14:56 ` [PATCH 5/9 v2] btrfs-progs: btrfs_scan_one_dir not to skip links when /dev/mapper is provided Anand Jain
2013-06-10 14:56 ` [PATCH 6/9 v2] btrfs-progs: scan /dev/mapper in filesystem show and device scan Anand Jain
2013-06-10 14:56 ` [PATCH 7/9 v3] btrfs-progs: device delete to get errors from the kernel Anand Jain
2013-06-10 14:56 ` [PATCH 8/9] btrfs-progs: get_label_mounted to return label instead of print Anand Jain
2013-06-21 7:41 ` [PATCH 08/13 v2] " Anand Jain
2013-06-10 14:56 ` [PATCH 9/9 v2] btrfs-progs: introduce btrfs filesystem show --kernel Anand Jain
2013-06-10 14:59 ` [PATCH 0/2] btrfs: coalesce of patches Anand Jain
2013-06-10 14:59 ` [PATCH 1/2] btrfs: device delete to get errors from the kernel Anand Jain
2013-06-10 14:59 ` [PATCH 2/2 v2] btrfs: add framework to read fs info and dev info " Anand Jain
2013-06-10 19:40 ` Josef Bacik
2013-06-11 13:10 ` anand jain
2013-06-11 13:15 ` Josef Bacik
2013-06-10 20:30 ` Zach Brown
2013-06-11 14:05 ` anand jain
2013-06-11 17:50 ` Zach Brown
2013-06-11 14:24 ` Josef Bacik
2013-06-21 7:02 ` Anand Jain
2013-06-21 7:32 ` [PATCH 2/2 v3] btrfs: obtain used_bytes in BTRFS_IOC_FS_INFO ioctl Anand Jain
2013-06-24 17:03 ` Josef Bacik
2013-06-25 3:00 ` Anand Jain
2013-07-08 7:39 ` [PATCH 13/13] btrfs-progs: fix memory leaks of device_list_add() Anand Jain
2013-07-15 4:58 ` Anand Jain
2013-07-15 5:30 ` [PATCH 00/11 v2 (resend)] btrfs-progs: coalesce of patches Anand Jain
2013-07-15 5:30 ` [PATCH 01/11] btrfs-progs: btrfs_scan_for_fsid doesn't need all the arguments Anand Jain
2013-07-15 5:30 ` [PATCH 02/11] btrfs-progs: label option in btrfs filesystem show is not coded Anand Jain
2013-07-15 5:30 ` [PATCH 03/11] btrfs-progs: update device scan usage Anand Jain
2013-07-15 5:30 ` [PATCH 04/11] btrfs-progs: congregate dev scan Anand Jain
2013-07-15 5:30 ` [PATCH 05/11] btrfs-progs: btrfs_scan_one_dir not to skip links when /dev/mapper is provided Anand Jain
2013-08-05 16:53 ` David Sterba
2013-07-15 5:30 ` [PATCH 06/11] btrfs-progs: scan /dev/mapper in filesystem show and device scan Anand Jain
2013-08-05 17:04 ` David Sterba
2013-08-13 4:07 ` anand jain [this message]
2013-07-15 5:30 ` [PATCH 07/11] btrfs-progs: device delete to get errors from the kernel Anand Jain
2013-07-15 5:30 ` [PATCH 08/11] btrfs-progs: get_label_mounted to return label instead of print Anand Jain
2013-07-15 5:30 ` [PATCH 09/11] btrfs-progs: move out print in cmd_df to another function Anand Jain
2013-07-15 5:30 ` [PATCH 10/11] btrfs-progs: get string for the group profile and type Anand Jain
2013-07-15 5:30 ` [PATCH 11/11] btrfs-progs: introduce btrfs filesystem show --kernel Anand Jain
2013-08-05 17:36 ` [PATCH 00/11 v2 (resend)] btrfs-progs: coalesce of patches David Sterba
2013-08-06 15:08 ` anand jain
2013-08-08 8:07 ` [PATCH 0/2 v2] introduce btrfs filesystem show --kernel Anand Jain
2013-08-08 8:07 ` [PATCH 1/2] btrfs-progs: move out print in cmd_df to another function Anand Jain
2013-08-08 8:07 ` [PATCH 2/2] btrfs-progs: introduce btrfs filesystem show --kernel Anand Jain
2013-08-08 18:08 ` Zach Brown
2013-08-09 10:57 ` anand jain
2013-08-09 18:03 ` Zach Brown
2013-08-08 8:09 ` [PATCH 0/2] scan /dev/mapper in filesystem show and device scan Anand Jain
2013-08-08 8:09 ` [PATCH 1/2] btrfs-progs: btrfs_scan_one_dir not to skip links when /dev/mapper is provided Anand Jain
2013-08-08 8:09 ` [PATCH 2/2] btrfs-progs: scan /dev/mapper in filesystem show and device scan Anand Jain
2013-08-08 8:10 ` [PATCH 0/2] " 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=5209B107.7040506@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--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).