linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: Linux fs Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: finding root filesystem of a subvolume?
Date: Tue, 22 Aug 2017 17:45:37 +0200	[thread overview]
Message-ID: <20170822154537.GJ14804@rus.uni-stuttgart.de> (raw)
In-Reply-To: <62494c0c-0c27-5b36-3727-b8755eb2cb58@gmail.com>

On Tue 2017-08-22 (11:03), Austin S. Hemmelgarn wrote:


> Or alternatively, repeatedly call `btrfs filesystem show` on the path, 
> removing one component from the end each time until you get a zero 
> return code.  The path you called it on that got a zero return code is 
> where the mount is (and thus what filesystem that subvolume is part of), 
> and the output just gave you a list of devices it's on.

"btrfs filesystem show" is relative slow (2.6 s), 
"btrfs subvolume show" is MUCH faster (0.02 s).


In perl I have now:

$root = $volume;
while (`btrfs subvolume show "$root" 2>/dev/null` !~ /toplevel subvolume/) {
  $root = dirname($root);
  last if $root eq '/';
}


-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<62494c0c-0c27-5b36-3727-b8755eb2cb58@gmail.com>

  reply	other threads:[~2017-08-22 15:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 12:23 finding root filesystem of a subvolume? Ulli Horlacher
2017-08-22 12:40 ` Hugo Mills
2017-08-22 12:50   ` Ulli Horlacher
2017-08-22 12:58     ` Marat Khalili
2017-08-22 13:12       ` Ulli Horlacher
2017-08-22 13:41         ` Marat Khalili
2017-08-22 13:27     ` Austin S. Hemmelgarn
2017-08-22 13:30       ` Ulli Horlacher
2017-08-22 13:37         ` Austin S. Hemmelgarn
2017-08-22 13:45           ` Marat Khalili
2017-08-22 13:53           ` Ulli Horlacher
2017-08-22 14:12             ` Austin S. Hemmelgarn
2017-08-22 14:23               ` Hugo Mills
2017-08-22 14:37                 ` Austin S. Hemmelgarn
2017-08-22 14:43 ` Peter Grandi
2017-08-22 15:03   ` Austin S. Hemmelgarn
2017-08-22 15:45     ` Ulli Horlacher [this message]
2017-08-22 16:48       ` Roman Mamedov
2017-08-22 17:41     ` Peter Grandi
2017-08-23 12:07       ` Austin S. Hemmelgarn
2017-08-23 13:14         ` Axel Burri

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=20170822154537.GJ14804@rus.uni-stuttgart.de \
    --to=framstag@rus.uni-stuttgart.de \
    --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).