linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3.1 5/7] btrfs: Allow barrier_all_devices to do chunk level device check
Date: Mon, 13 Mar 2017 16:00:03 +0800	[thread overview]
Message-ID: <d19e5374-9bd6-378c-edbc-04c3e16f4fac@oracle.com> (raw)
In-Reply-To: <20170309013442.19957-6-quwenruo@cn.fujitsu.com>


Qu,

patch 4/4 added a cleanup for barrier_all_devices() and introduced
a new function check_barrier_error() where integration with per chunk
level device check will simplify.

  [PATCH 4/4] btrfs: cleanup barrier_all_devices() to check dev stat 
flush error

Thanks, Anand



On 03/09/2017 09:34 AM, Qu Wenruo wrote:
> The last user of num_tolerated_disk_barrier_failures is
> barrier_all_devices().
> But it's can be easily changed to new per-chunk degradable check
> framework.
>
> Now btrfs_device will have two extra members, representing send/wait
> error, set at write_dev_flush() time.
> With these 2 new members, btrfs_check_rw_degradable() can check if the
> fs is still OK when the fs is committed to disk.
>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> Tested-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
> Tested-by: Adam Borowski <kilobyte@angband.pl>
> Tested-by: Dmitrii Tcvetkov <demfloro@demfloro.ru>
> ---
>  fs/btrfs/disk-io.c | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 658b8fab1d39..549045a3e15f 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3570,17 +3570,20 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
>  {
>  	struct list_head *head;
>  	struct btrfs_device *dev;
> -	int errors_send = 0;
> -	int errors_wait = 0;
> +	struct extra_rw_degrade_errors *errors;
>  	int ret;
>
> +	errors = alloc_extra_rw_degrade_errors(info->fs_devices->num_devices);
> +	if (!errors)
> +		return -ENOMEM;
> +
>  	/* send down all the barriers */
>  	head = &info->fs_devices->devices;
>  	list_for_each_entry_rcu(dev, head, dev_list) {
>  		if (dev->missing)
>  			continue;
>  		if (!dev->bdev) {
> -			errors_send++;
> +			record_extra_rw_degrade_error(errors, dev->devid);
>  			continue;
>  		}
>  		if (!dev->in_fs_metadata || !dev->writeable)
> @@ -3588,7 +3591,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
>
>  		ret = write_dev_flush(dev, 0);
>  		if (ret)
> -			errors_send++;
> +			record_extra_rw_degrade_error(errors, dev->devid);
>  	}
>
>  	/* wait for all the barriers */
> @@ -3596,7 +3599,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
>  		if (dev->missing)
>  			continue;
>  		if (!dev->bdev) {
> -			errors_wait++;
> +			record_extra_rw_degrade_error(errors, dev->devid);
>  			continue;
>  		}
>  		if (!dev->in_fs_metadata || !dev->writeable)
> @@ -3604,11 +3607,13 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
>
>  		ret = write_dev_flush(dev, 1);
>  		if (ret)
> -			errors_wait++;
> +			record_extra_rw_degrade_error(errors, dev->devid);
>  	}
> -	if (errors_send > info->num_tolerated_disk_barrier_failures ||
> -	    errors_wait > info->num_tolerated_disk_barrier_failures)
> +	if (!btrfs_check_rw_degradable(info, errors)) {
> +		kfree(errors);
>  		return -EIO;
> +	}
> +	kfree(errors);
>  	return 0;
>  }
>
>

  reply	other threads:[~2017-03-13  7:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09  1:34 [PATCH v3.1 0/7] Chunk level degradable check Qu Wenruo
2017-03-09  1:34 ` [PATCH v3.1 1/7] btrfs: Introduce a function to check if all chunks a OK for degraded rw mount Qu Wenruo
2017-03-13  7:29   ` Anand Jain
2017-03-13  7:25     ` Qu Wenruo
2017-05-01 10:21       ` Dmitrii Tcvetkov
2017-05-02  0:20         ` Qu Wenruo
2017-05-02  2:28           ` Anand Jain
2017-03-09  1:34 ` [PATCH v3.1 2/7] btrfs: Do chunk level rw degrade check at mount time Qu Wenruo
2017-03-09  1:34 ` [PATCH v3.1 3/7] btrfs: Do chunk level degradation check for remount Qu Wenruo
2017-03-09  1:34 ` [PATCH v3.1 4/7] btrfs: Introduce extra_rw_degrade_errors parameter for btrfs_check_rw_degradable Qu Wenruo
2017-03-09  1:34 ` [PATCH v3.1 5/7] btrfs: Allow barrier_all_devices to do chunk level device check Qu Wenruo
2017-03-13  8:00   ` Anand Jain [this message]
2017-03-09  1:34 ` [PATCH v3.1 6/7] btrfs: Cleanup num_tolerated_disk_barrier_failures Qu Wenruo
2017-03-09  1:34 ` [PATCH v3.1 7/7] btrfs: Enhance missing device kernel message Qu Wenruo
2017-06-26 18:59 ` [PATCH v3.1 0/7] Chunk level degradable check David Sterba
2017-06-27  1:05   ` Qu Wenruo
2017-06-27  1:59     ` Anand Jain
2017-06-27  2:49       ` Qu Wenruo
2017-06-27 11:20         ` Austin S. Hemmelgarn
2017-06-27 12:20           ` 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=d19e5374-9bd6-378c-edbc-04c3e16f4fac@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.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).