All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <dsterba@suse.cz>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2 02/10] btrfs-progs: Add support to suppress tree block csum error output.
Date: Thu, 29 Jan 2015 08:58:25 +0800	[thread overview]
Message-ID: <54C985B1.2010300@cn.fujitsu.com> (raw)
In-Reply-To: <20150128181641.GH3641@twin.jikos.cz>


-------- Original Message --------
Subject: Re: [PATCH v2 02/10] btrfs-progs: Add support to suppress tree 
block csum error output.
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Date: 2015年01月29日 02:16
> On Mon, Jan 19, 2015 at 02:45:04PM +0800, Qu Wenruo wrote:
>> Add new open ctree flag OPEN_CTREE_SUPPRESS_ERROR to suppress tree block
>> csum error output.
>>
>> @@ -996,6 +996,7 @@ struct btrfs_fs_info {
>>   	unsigned int on_restoring:1;
>>   	unsigned int is_chunk_recover:1;
>>   	unsigned int quota_enabled:1;
>> +	unsigned int suppress_error:1;
> This is confusing, it suppresses only csum errors.
Indeed, what about suprress_csum_err?
>
>> --- a/disk-io.c
>> +++ b/disk-io.c
>> @@ -42,7 +42,8 @@ static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
>>   	struct btrfs_fs_devices *fs_devices;
>>   	int ret = 1;
>>   
>> -	if (buf->start != btrfs_header_bytenr(buf)) {
>> +	if (buf->start != btrfs_header_bytenr(buf) &&
>> +	    !root->fs_info->suppress_error) {
> Though here it's used to skip block start mismatch error. But looking at
> the rest of the code, it's better to put this check to the caller and
> keep check_tree_block as is.
Did you mean move the bytenr check out of check_tree_block() and caller 
do the bytenr check?
If so, I'll change it soon.

Thanks,
Qu
>
>>   		printk("Check tree block failed, want=%Lu, have=%Lu\n",
>>   		       buf->start, btrfs_header_bytenr(buf));
>>   		return ret;
>> @@ -118,6 +119,8 @@ int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
>>   {
>>   	u16 csum_size =
>>   		btrfs_super_csum_size(root->fs_info->super_copy);
>> +	if (verify && root->fs_info->suppress_error)
>> +		return verify_tree_block_csum_silent(buf, csum_size);
>>   	return csum_tree_block_size(buf, csum_size, verify);
>>   }
>>   
>> @@ -282,10 +285,13 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
>>   			return eb;
>>   		}
>>   		if (ignore) {
>> -			if (check_tree_block(root, eb))
>> -				printk("read block failed check_tree_block\n");
>> -			else
>> -				printk("Csum didn't match\n");
>> +			if (check_tree_block(root, eb)) {
>> +				if (!root->fs_info->suppress_error)
>> +					printk("read block failed check_tree_block\n");
>> +			} else {
>> +				if (!root->fs_info->suppress_error)
>> +					printk("Csum didn't match\n");
>> +			}
>>   			break;
>>   		}
>>   		num_copies = btrfs_num_copies(&root->fs_info->mapping_tree,
>> @@ -1112,6 +1118,8 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
>>   	}
>>   	if (flags & OPEN_CTREE_RESTORE)
>>   		fs_info->on_restoring = 1;
>> +	if (flags & OPEN_CTREE_SUPPRESS_ERROR)
>> +		fs_info->suppress_error = 1;
>>   
>>   	ret = btrfs_scan_fs_devices(fp, path, &fs_devices, sb_bytenr,
>>   				    (flags & OPEN_CTREE_RECOVER_SUPER));
>> diff --git a/disk-io.h b/disk-io.h
>> index e12870e..90ede6b 100644
>> --- a/disk-io.h
>> +++ b/disk-io.h
>> @@ -33,6 +33,7 @@ enum btrfs_open_ctree_flags {
>>   	OPEN_CTREE_RESTORE		= (1 << 4),
>>   	OPEN_CTREE_NO_BLOCK_GROUPS	= (1 << 5),
>>   	OPEN_CTREE_EXCLUSIVE		= (1 << 6),
>> +	OPEN_CTREE_SUPPRESS_ERROR	= (1 << 7), /* Suppress csum error */
>>   };
>>   
>>   static inline u64 btrfs_sb_offset(int mirror)


  reply	other threads:[~2015-01-29  1:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19  6:45 [PATCH v2 00/10] Enhance btrfs-find-root and open_ctree() to provide better chance on damaged btrfs Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 01/10] btrfs-progs: Cleanup, use bitshift instead of immediate number in btrfs_open_ctree_flags Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 02/10] btrfs-progs: Add support to suppress tree block csum error output Qu Wenruo
2015-01-28 18:16   ` David Sterba
2015-01-29  0:58     ` Qu Wenruo [this message]
2015-01-19  6:45 ` [PATCH v2 03/10] btrfs-progs: Add new btrfs_open_ctree_flags CHUNK_ONLY Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 04/10] btrfs-progs: Add new find-root.[ch] infrastructure Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 05/10] btrfs-progs: Switch btrfs-find-root to use the new open_ctree flags Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 06/10] btrfs-progs: Add better search generation judgment for btrfs-find-root Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 07/10] btrfs-progs: Swith btrfs-find-root to use the find-root infrastructure Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 08/10] btrfs-progs: Cleanup unneeded btrfs-find-root codes Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 09/10] btrfs-progs: Add new option for btrfs-find-root to search through all the metadata extents Qu Wenruo
2015-01-19  6:45 ` [PATCH v2 10/10] btrfs-progs: Allow open_ctree use backup tree root or search it automatically if primary tree root is corrupted Qu Wenruo
2015-07-27 15:04   ` David Sterba
2015-07-28  0:34     ` Qu Wenruo
2015-07-28 12:00       ` 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=54C985B1.2010300@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.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 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.