All of lore.kernel.org
 help / color / mirror / Atom feed
From: Su Yue <l@damenly.su>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] btrfs-progs: properly exclude leaves for lowmem
Date: Wed, 06 Jan 2021 09:42:24 +0800	[thread overview]
Message-ID: <v9calu2o.fsf@damenly.su> (raw)
In-Reply-To: <845796bfab85f02919d64908b63f3f7201a2abb3.1609882807.git.josef@toxicpanda.com>


On Wed 06 Jan 2021 at 05:40, Josef Bacik <josef@toxicpanda.com> 
wrote:

> The lowmem mode excludes all referenced blocks from the 
> allocator in
> order to avoid accidentally overwriting blocks while fixing the 
> file
> system.  However for leaves it wouldn't exclude anything, it 
> would just
> pin them down, which gets cleaned up on transaction commit. 
> We're safe
> for the first modification, but subsequent modifications could 
> blow up
> in our face.  Fix this by properly excluding leaves as well as 
> all of
> the nodes.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
>

LGTM.
Reviewed-by: Su Yue <l@damenly.su>
> ---
>  check/mode-common.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/check/mode-common.c b/check/mode-common.c
> index a6489191..ef77b060 100644
> --- a/check/mode-common.c
> +++ b/check/mode-common.c
> @@ -667,8 +667,12 @@ static int traverse_tree_blocks(struct 
> extent_buffer *eb, int tree_root, int pin
>
>  			/* If we aren't the tree root don't read the block */
>  			if (level == 1 && !tree_root) {
> -				btrfs_pin_extent(gfs_info, bytenr,
> -						 gfs_info->nodesize);
>
> +				if (pin)
> +					btrfs_pin_extent(gfs_info, bytenr,
> +							 gfs_info->nodesize);
> +				else
> +					set_extent_dirty(tree, bytenr,
> +							 gfs_info->nodesize);
>  				continue;
>  			}


  reply	other threads:[~2021-01-06  1:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 21:40 [PATCH] btrfs-progs: properly exclude leaves for lowmem Josef Bacik
2021-01-06  1:42 ` Su Yue [this message]
2021-01-06 16:17 ` 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=v9calu2o.fsf@damenly.su \
    --to=l@damenly.su \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.