Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Russell Coker <russell@coker.com.au>
To: linux-btrfs@vger.kernel.org, Qu Wenruo <quwenruo.btrfs@gmx.com>
Subject: Re: btrfs-progs: btrfs dev usa as non-root is wrong and should just abort
Date: Thu, 11 Jul 2024 13:42:02 +1000	[thread overview]
Message-ID: <4914581.rnE6jSC6OK@cupcakke> (raw)
In-Reply-To: <96677547-0177-4226-92bd-174c167269b3@gmx.com>

On Thursday, 11 July 2024 07:13:25 AEST Qu Wenruo wrote:
> 在 2024/7/10 21:22, Russell Coker 写道:
> > Below is the difference between running btrfs dev usa as root and non-root
> > on a laptop with kernel 6.8.12-amd64.  When run as non-root it gets
> > everything wrong and in my tests I have never been able to see it give
> > nay accurate data as non-root.  I think it should just abort with an
> > error in that situation, there's no point in giving a wrong answer.
> > 
> > # btrfs dev usa /
> > /dev/mapper/root, ID: 1
> > 
> >     Device size:           476.37GiB
> >     Device slack:            1.50KiB
> >     Data,single:           216.01GiB
> >     Metadata,DUP:            6.00GiB
> >     System,DUP:             64.00MiB
> >     Unallocated:           254.29GiB
> > 
> > $ btrfs dev usa /
> > WARNING: cannot read detailed chunk info, per-device usage will not be
> > shown, run as root
> > /dev/mapper/root, ID: 1
> > 
> >     Device size:           952.73MiB
> >     Device slack:           16.00EiB
> >     Unallocated:           476.37GiB
> 
> Mind to post the raw result?
> 
> The 16EiB output definitely means something wrong.
> 
> So far the result looks like btrfs-progs is interpret the result wrong
> with some offset of the result.
> 
> In my case, non-root call of "btrfs dev usage" always shows the slack as
> 0, and unallocated as N/A, so the 16EiB looks like some shift.

# btrfs dev usa -b /
/dev/mapper/root, ID: 1
   Device size:          511493395968
   Device slack:               1536
   Data,single:          231936622592
   Metadata,DUP:         6442450944
   System,DUP:             67108864
   Unallocated:          273047212032

$ btrfs dev usa -b /
WARNING: cannot read detailed chunk info, per-device usage will not be shown, 
run as root
/dev/mapper/root, ID: 1
   Device size:           999010539
   Device slack:         18446743563215167723
   Unallocated:          511493394432

> And what's the version of the btrfs-progs?

The Debian package version is 6.6.3-1.2+b1.

-- 
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/




  reply	other threads:[~2024-07-11  3:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10 11:52 btrfs-progs: btrfs dev usa as non-root is wrong and should just abort Russell Coker
2024-07-10 16:29 ` Boris Burkov
2024-07-11  3:50   ` Russell Coker
2024-07-10 21:13 ` Qu Wenruo
2024-07-11  3:42   ` Russell Coker [this message]
2024-07-11  3:47     ` Qu Wenruo
2024-07-11  3:55       ` Russell Coker
2024-07-11  3:58         ` Qu Wenruo

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=4914581.rnE6jSC6OK@cupcakke \
    --to=russell@coker.com.au \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /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