From: Hans van Kranenburg <Hans.van.Kranenburg@mendix.com>
To: Qu Wenruo <wqu@suse.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v3 4/6] btrfs-progs: lowmem check: Add dev_item check for used bytes and total bytes
Date: Mon, 8 Oct 2018 22:20:53 +0000 [thread overview]
Message-ID: <cd511cfa-baa2-6a13-2802-6eac1f47d8bb@mendix.com> (raw)
In-Reply-To: <20181008123044.13413-5-wqu@suse.com>
On 10/08/2018 02:30 PM, Qu Wenruo wrote:
> Obviously, used bytes can't be larger than total bytes.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> check/mode-lowmem.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
> index 07c03cad77af..1173b963b8f3 100644
> --- a/check/mode-lowmem.c
> +++ b/check/mode-lowmem.c
> @@ -4074,6 +4074,11 @@ static int check_dev_item(struct btrfs_fs_info *fs_info,
> used = btrfs_device_bytes_used(eb, dev_item);
> total_bytes = btrfs_device_total_bytes(eb, dev_item);
>
> + if (used > total_bytes) {
> + error("device %llu has incorrect used bytes %llu > total bytes %llu",
> + dev_id, used, total_bytes);
> + return ACCOUNTING_MISMATCH;
The message and return code point at an error in accounting logic.
However, if you have a fully allocated device and a DUP chunk ending
beyond device, then having used > total_bytes is expected...
So maybe there's two possibilities... There's an error in the accounting
logic, or there's an "over-allocation", which is another type of issue
which produces used > total with correct accounting logic.
> + }
> key.objectid = dev_id;
> key.type = BTRFS_DEV_EXTENT_KEY;
> key.offset = 0;
>
--
Hans van Kranenburg
next prev parent reply other threads:[~2018-10-08 22:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-08 12:30 [PATCH v3 0/6] btrfs-progs: check: Detect invalid dev extents and device items Qu Wenruo
2018-10-08 12:30 ` [PATCH v3 1/6] btrfs-progs: image: Use correct device size when restoring Qu Wenruo
2018-10-11 12:07 ` Nikolay Borisov
2018-10-12 5:20 ` Qu Wenruo
2018-10-08 12:30 ` [PATCH v3 2/6] btrfs-progs: lowmem check: Add check for overlapping dev extents Qu Wenruo
2018-10-09 1:46 ` Su Yue
2018-10-08 12:30 ` [PATCH v3 3/6] btrfs-progs: original check: Add ability to detect bad " Qu Wenruo
2018-10-09 2:01 ` Su Yue
2018-10-08 12:30 ` [PATCH v3 4/6] btrfs-progs: lowmem check: Add dev_item check for used bytes and total bytes Qu Wenruo
2018-10-08 22:20 ` Hans van Kranenburg [this message]
2018-10-09 1:14 ` Qu Wenruo
2018-10-09 20:21 ` Hans van Kranenburg
2018-10-08 12:30 ` [PATCH v3 5/6] btrfs-progs: original " Qu Wenruo
2018-10-08 12:30 ` [PATCH v3 6/6] btrfs-progs: fsck-tests: Add test image for dev extents beyond device boundary Qu Wenruo
2018-12-17 18:55 ` [PATCH v3 0/6] btrfs-progs: check: Detect invalid dev extents and device items 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=cd511cfa-baa2-6a13-2802-6eac1f47d8bb@mendix.com \
--to=hans.van.kranenburg@mendix.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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;
as well as URLs for NNTP newsgroup(s).