From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH 3/3] btrfs-progs: use BTRFS_SCAN_LBLKID as default scan in filesystem show
Date: Tue, 8 Oct 2013 11:41:40 +0800 [thread overview]
Message-ID: <1381203700-17558-3-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1381203700-17558-1-git-send-email-anand.jain@oracle.com>
btrfs progs has to scan for the btrfs disks for two main reasons,
one to register them with the btrfs kernel (under btrfs dev scan)
2nd to report btrfs disks to the user (under btrfs fi show)
(there few more minor reasons like check_mounted etc..).
To facilitate the scan, in total we have the following methods
to scan for the btrfs
BTRFS_SCAN_PROC
which uses the /proc/partitions to look for the disks, when
scanning it does it twice first would look for non dm- paths
and in the 2nd scan it would pick only dm- paths.
BTRFS_SCAN_DEV
which scans all the block dev under /dev as they appear during
scanning.
BTRFS_SCAN_LBLKID
this uses the library functions provided by the lblkid to get
only disks which contains the btrfs SB.
The better method to use would be BTRFS_SCAN_LBLKID for the obvious
reasons we don't have to reinvent that feature with in btrfs-progs.
For the btrfs fi show - This patch will..
- make BTRFS_SCAN_LBLKID as the default scan option
(BTRFS_SCAN_DEV is accessible under the option --all-devices and
BTRFS_SCAN_PROC won't be used by btrfs fi show any more)
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
cmds-filesystem.c | 14 +-------------
1 files changed, 1 insertions(+), 13 deletions(-)
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 74b7a06..b737ec9 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -398,11 +398,10 @@ static int cmd_show(int argc, char **argv)
{
struct list_head *all_uuids;
struct btrfs_fs_devices *fs_devices;
- struct btrfs_device *device;
struct list_head *cur_uuid;
char *search = NULL;
int ret;
- int where = BTRFS_SCAN_PROC;
+ int where = BTRFS_SCAN_LBLKID;
int type = 0;
while (1) {
@@ -464,17 +463,6 @@ devs_only:
if (search && uuid_search(fs_devices, search) == 0)
continue;
- /* skip mounted as they are already printed by
- * btrfs_scan_kernel
- */
- /* do it only for the default, no option */
- if (where == BTRFS_SCAN_PROC) {
- device = list_entry(fs_devices->devices.next,
- struct btrfs_device, dev_list);
- ret = check_mounted(device->name);
- if (ret)
- continue;
- }
print_one_uuid(fs_devices);
}
--
1.7.1
next prev parent reply other threads:[~2013-10-08 3:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 3:41 [PATCH 1/3 v4] btrfs-progs: use kernel for mounted disk for show Anand Jain
2013-10-08 3:41 ` [PATCH 2/3 v2] btrfs-progs: add more parameter to the filesystem show Anand Jain
2013-10-15 17:22 ` David Sterba
2013-10-16 2:22 ` Anand Jain
2013-10-08 3:41 ` Anand Jain [this message]
2013-10-15 17:13 ` [PATCH 1/3 v4] btrfs-progs: use kernel for mounted disk for show David Sterba
2013-10-16 9:25 ` Anand Jain
2013-10-16 13:09 ` David Sterba
2013-10-21 14:44 ` Josef Bacik
2013-10-22 5:53 ` Anand Jain
2013-10-22 13:21 ` Josef Bacik
2013-10-22 13:28 ` Hugo Mills
2013-10-22 16:52 ` David Sterba
2013-10-23 11:20 ` Anand Jain
2013-10-23 11:41 ` 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=1381203700-17558-3-git-send-email-anand.jain@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).