public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH 1/2] btrfs: block-group: Fix two rebase errors where assignment for cache is missing
Date: Tue,  5 Nov 2019 09:35:34 +0800	[thread overview]
Message-ID: <20191105013535.14239-2-wqu@suse.com> (raw)
In-Reply-To: <20191105013535.14239-1-wqu@suse.com>

Without proper cache->flags, btrfs space info will be screwed up and
report error at mount time.

And without proper cache->used, commit transaction will report -EEXIST
when running delayed refs.

Please fold this into the original patch "btrfs: block-group: Refactor btrfs_read_block_groups()".

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/block-group.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index b5eededaa750..c2bd85d29070 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1713,6 +1713,8 @@ static int read_one_block_group(struct btrfs_fs_info *info,
 	}
 	read_extent_buffer(leaf, &bgi, btrfs_item_ptr_offset(leaf, slot),
 			   sizeof(bgi));
+	cache->used = btrfs_stack_block_group_used(&bgi);
+	cache->flags = btrfs_stack_block_group_flags(&bgi);
 	if (!mixed && ((cache->flags & BTRFS_BLOCK_GROUP_METADATA) &&
 	    (cache->flags & BTRFS_BLOCK_GROUP_DATA))) {
 			btrfs_err(info,
-- 
2.23.0


  reply	other threads:[~2019-11-05  1:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  1:35 [PATCH 0/2] btrfs: block-group: Bug fixes for "btrfs: block-group: Refactor btrfs_read_block_groups()" Qu Wenruo
2019-11-05  1:35 ` Qu Wenruo [this message]
2019-11-13 14:31   ` [PATCH 1/2] btrfs: block-group: Fix two rebase errors where assignment for cache is missing David Sterba
2019-11-14  0:57     ` Qu Wenruo
2019-11-14  1:37       ` Qu WenRuo
2019-11-14 13:11         ` David Sterba
2019-11-05  1:35 ` [PATCH 2/2] btrfs: block-group: Reuse the item key from caller of read_one_block_group() Qu Wenruo
2019-11-05 16:47 ` [PATCH 0/2] btrfs: block-group: Bug fixes for "btrfs: block-group: Refactor btrfs_read_block_groups()" 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=20191105013535.14239-2-wqu@suse.com \
    --to=wqu@suse.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