public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Boris Burkov <boris@bur.io>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH v3 1/4] btrfs: support remount of ro fs with free space tree
Date: Thu, 24 Sep 2020 19:02:40 +0200	[thread overview]
Message-ID: <20200924170240.GZ6756@twin.jikos.cz> (raw)
In-Reply-To: <1d0cca6ce1f67484c6b7ef591e264c04ca740c96.1600282812.git.boris@bur.io>

On Thu, Sep 17, 2020 at 11:13:38AM -0700, Boris Burkov wrote:
>  #include "block-group.h"
>  #include "discard.h"
> +#include "free-space-tree.h"
>  
>  #include "qgroup.h"
>  #define CREATE_TRACE_POINTS
> @@ -1838,6 +1839,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
>  	u64 old_max_inline = fs_info->max_inline;
>  	u32 old_thread_pool_size = fs_info->thread_pool_size;
>  	u32 old_metadata_ratio = fs_info->metadata_ratio;
> +	bool create_fst = false;
>  	int ret;
>  
>  	sync_filesystem(sb);
> @@ -1862,6 +1864,16 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
>  	btrfs_resize_thread_pool(fs_info,
>  		fs_info->thread_pool_size, old_thread_pool_size);
>  
> +	if (btrfs_test_opt(fs_info, FREE_SPACE_TREE) &&
> +	    !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) {
> +		create_fst = true;
> +		if (!sb_rdonly(sb) || *flags & SB_RDONLY) {
> +			btrfs_warn(fs_info,
> +				   "Remounting with free space tree only supported from read-only to read-write");

lowercase for start of the sting, unindent it so ends below 80 columns

> +			create_fst = false;
> +		}
> +	}
> +
>  	if ((bool)(*flags & SB_RDONLY) == sb_rdonly(sb))
>  		goto out;
>  
> @@ -1924,6 +1936,21 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
>  			goto restore;
>  		}
>  
> +		/*
> +		 * NOTE: when remounting with a change that does writes, don't
> +		 * put it anywhere above this point, as we are not sure to be
> +		 * safe to write until we pass the above checks.
> +		 */
> +		if (create_fst) {
> +			ret = btrfs_create_free_space_tree(fs_info);
> +			if (ret) {
> +				btrfs_warn(fs_info,
> +					   "failed to create free space tree: %d", ret);

same

> +				goto restore;
> +			}
> +		}
> +
> +
>  		ret = btrfs_cleanup_fs_roots(fs_info);
>  		if (ret)
>  			goto restore;
> -- 
> 2.24.1

  parent reply	other threads:[~2020-09-24 17:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 18:13 [PATCH v3 0/4] btrfs: free space tree mounting fixes Boris Burkov
2020-09-17 18:13 ` [PATCH v3 1/4] btrfs: support remount of ro fs with free space tree Boris Burkov
2020-09-21 14:35   ` Josef Bacik
2020-09-24 17:02   ` David Sterba [this message]
2020-09-17 18:13 ` [PATCH 2/4] btrfs: use sb state to print space_cache mount option Boris Burkov
2020-09-21 14:50   ` Josef Bacik
2020-09-21 17:04     ` David Sterba
2020-09-21 17:13       ` Boris Burkov
2020-09-24 17:04   ` David Sterba
2020-09-17 18:13 ` [PATCH v3 3/4] btrfs: remove free space items when creating free space tree Boris Burkov
2020-09-21 14:54   ` Josef Bacik
2020-09-21 17:13   ` David Sterba
2020-09-21 18:22     ` Boris Burkov
2020-09-21 19:01     ` Josef Bacik
2020-09-24 17:07   ` David Sterba
2020-09-17 18:13 ` [PATCH 4/4] btrfs: skip space_cache v1 setup when not using it Boris Burkov
2020-09-21 14:54   ` Josef Bacik
2020-09-18 14:23 ` [PATCH v3 0/4] btrfs: free space tree mounting fixes 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=20200924170240.GZ6756@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=boris@bur.io \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox