linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/2] btrfs-progs: optimize not to scan repeated fsid mount points
Date: Tue, 15 Sep 2015 16:46:23 +0800	[thread overview]
Message-ID: <1442306783-1288-2-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1442306783-1288-1-git-send-email-anand.jain@oracle.com>

fsid can be mounted multiple times, with different subvolid.
And we don't have to scan a mount point if we already have
that in the scanned list.

And thus nicely avoids the following warning with multiple
subvol mounts on older kernel like 2.6.32 where
BTRFS_IOC_GET_FSLABEL ioctl does not exist.

./btrfs fi show -m
Label: none  uuid: 31845933-611e-422d-ae6f-386e57ad81aa
	Total devices 2 FS bytes used 172.00KiB
	devid    1 size 3.00GiB used 642.38MiB path /dev/sdd
	devid    2 size 3.00GiB used 622.38MiB path /dev/sde

warning, device 2 is missing
warning devid 2 not found already
warning, device 2 is missing
warning devid 2 not found already

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds-filesystem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 793df0e..e2049cc 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -468,6 +468,10 @@ static int btrfs_scan_kernel(void *search, unsigned unit_mode)
 			goto out;
 		}
 
+		/* skip all fs already shown as mounted fs */
+		if (is_seen_fsid(fs_info_arg.fsid))
+			continue;
+
 		ret = get_label_mounted(mnt->mnt_dir, label);
 		/* provide backward kernel compatibility */
 		if (ret == -ENOTTY)
-- 
2.4.1


  reply	other threads:[~2015-09-15  8:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15  8:46 [PATCH 1/2] btrfs-progs: provide fail safe for BTRFS_IOC_GET_FSLABEL ioctl Anand Jain
2015-09-15  8:46 ` Anand Jain [this message]
2015-09-25 13:57   ` [PATCH 2/2] btrfs-progs: optimize not to scan repeated fsid mount points David Sterba
2015-09-25 13:55 ` [PATCH 1/2] btrfs-progs: provide fail safe for BTRFS_IOC_GET_FSLABEL ioctl 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=1442306783-1288-2-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).