From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.cz
Subject: Re: [PATCH 4/4] btrfs: cleanup barrier_all_devices() to check dev stat flush error
Date: Tue, 14 Mar 2017 11:36:28 +0800 [thread overview]
Message-ID: <01cc891a-0fb6-5107-0ba3-1567b9c7330b@oracle.com> (raw)
In-Reply-To: <e181c53d-0a54-710b-95af-d38901e2812d@cn.fujitsu.com>
>>>>
>>>> +struct device_checkpoint {
>>>> + struct list_head list;
>>>> + struct btrfs_device *device;
>>>> + int stat_value_checkpoint;
>>>> +};
>>>> +
>>>> +static int add_device_checkpoint(struct list_head *checkpoint,
>>>
>>> Could we have another structure instead of list_head to record device
>>> checkpoints?
>>> The list_head is never a meaningful structure under most cases.
>>
>> I didn't understand this, there is device_checkpoint and the context
>> of struct list_head *checkpoint would start and end within
>> barrier_all_devices().
>
> I just mean to encapsulate the list_head into another structure, e.g,
> call it device_checkpoints or something else.
>
> Just a list_head is not quite meaningful.
OK. Will do.
>>>> +static int check_stat_flush(struct btrfs_device *dev,
>>>> + struct list_head *checkpoint)
>>>> +{
>>>> + int val;
>>>> + struct device_checkpoint *cdev;
>>>> +
>>>> + list_for_each_entry(cdev, checkpoint, list) {
>>>> + if (cdev->device == dev) {
>>>> + val = btrfs_dev_stat_read(dev,
>>>> + BTRFS_DEV_STAT_FLUSH_ERRS);
>>>> + if (cdev->stat_value_checkpoint != val)
>>>> + return 1;
>>>
>>> This check implies that BTRFS_DEV_STAT_FLUSH_ERRS will only be modified
>>> by checkpoint related code.
>>> Or any other modifier can easily break the check, causing false alert.
>>
>> I have already checked it, its not possible with the current code,
>> or do you see if that is possible with the current code ? or Did I
>> miss something ?
>
> You didn't miss anything.
>
> However I just got the same comment on better not to play around
> something inside btrfs_device.
>
> So I'm not sure if it's good to do it this time just for cleaning up
> barrier_all_devices().
Right. The reason I said that before was first of all the concept
of err_send and err_wait wasn't needed as shown in the patch set
1 to 3 in this patch-set. We have the dev_stat flush which keeps
track of the flush error in the right way.
Next to monitor the change in the flush error instead of checkpoint
probably dev_stat_ccnt is the correct way (which in the long term
we would need that kind on the per error-stat for rest of the
error-stat including flush). But unless we have all the requirements
well understood from the other pending stuff like device disappear
and reappear I won't change the struct btrfs_devices as of now.
Hope this clarifies better. Will send out the patch with the review
comment incorporated. Thanks. On top of which per chunk missing
device check patch can be added.
Thanks, Anand
next prev parent reply other threads:[~2017-03-14 3:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 7:42 [PATCH 0/4] cleanup barrier_all_devices() Anand Jain
2017-03-13 7:42 ` [PATCH 1/4] btrfs: REQ_PREFLUSH does not use btrfs_end_bio() completion callback Anand Jain
2017-03-28 15:19 ` David Sterba
2017-03-29 10:00 ` Anand Jain
2017-03-30 10:57 ` Anand Jain
2017-03-13 7:42 ` [PATCH 2/4] btrfs: Communicate back ENOMEM when it occurs Anand Jain
2017-03-14 8:49 ` Qu Wenruo
2017-03-28 15:38 ` David Sterba
2017-03-29 10:00 ` Anand Jain
2017-03-13 7:42 ` [PATCH 3/4] btrfs: cleanup barrier_all_devices() unify dev error count Anand Jain
2017-03-14 8:53 ` Qu Wenruo
2017-03-13 7:42 ` [PATCH 4/4] btrfs: cleanup barrier_all_devices() to check dev stat flush error Anand Jain
2017-03-13 9:05 ` Qu Wenruo
2017-03-13 16:21 ` Anand Jain
2017-03-14 0:28 ` Qu Wenruo
2017-03-14 3:36 ` Anand Jain [this message]
2017-03-14 8:26 ` [PATCH V2 " Anand Jain
2017-03-14 8:47 ` Qu Wenruo
2017-03-28 16:19 ` David Sterba
2017-03-29 10:00 ` Anand Jain
2017-03-31 11:36 ` [PATCH 4/4 V2] " Anand Jain
2017-04-05 4:07 ` [PATCH 4/4 V3] " Anand Jain
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=01cc891a-0fb6-5107-0ba3-1567b9c7330b@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--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).