linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Guilherme G. Piccoli" <gpiccoli@canonical.com>
To: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>,
	linux-raid@vger.kernel.org
Cc: linux-block@vger.kernel.org, dm-devel@redhat.com,
	jay.vosburgh@canonical.com, NeilBrown <neilb@suse.com>,
	Song Liu <songliubraving@fb.com>
Subject: Re: [PATCH v2 1/2] md raid0/linear: Introduce new array state 'broken'
Date: Thu, 22 Aug 2019 12:35:31 -0300	[thread overview]
Message-ID: <51d10dea-4148-6a2c-8e70-7cc977ce1def@canonical.com> (raw)
In-Reply-To: <ca2096ca-8cb2-468f-89d4-24cd059b8a6b@cloud.ionos.com>

On 22/08/2019 05:49, Guoqing Jiang wrote:
> Hi,

Hi Guoqing, thanks for the review!


> 
> On 8/16/19 3:40 PM, Guilherme G. Piccoli wrote:
>> +static bool linear_is_missing_dev(struct mddev *mddev)
>> +{
>> +    struct md_rdev *rdev;
>> +    static int already_missing;
>> +    int def_disks, work_disks = 0;
>> +
>> +    def_disks = mddev->raid_disks;
>> +    rdev_for_each(rdev, mddev)
>> +        if (rdev->bdev->bd_disk->flags & GENHD_FL_UP)
>> +            work_disks++;
>> +
>> +    if (unlikely(def_disks - work_disks)) {
> 
> If my understanding is correct, after enter the branch,
> 
>> +        if (already_missing < (def_disks - work_disks)) {
> 
> the above is always true since already_missing should be '0', right?
> If so, maybe the above checking is pointless.

The variable 'already_missing' is static, so indeed it starts with 0.
When there are missing disks, we'll enter the 'if(def_disks -
work_disks)' and indeed print the message. But notice we'll set
'already_missing = def_disks - work_disks', so we won't enter the if and
print the message anymore _unless_ a new member is removed and
'already_missing' gets unbalanced with regards to 'def_disks - work_disks'.

The idea behind it is to show a single message whenever a new member is
removed. The use of a static variable allows us to do that.

Nevertheless, this path will be dropped in the V3 that is ready to be sent.
Cheers,


Guilherme

      reply	other threads:[~2019-08-22 15:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16 13:40 [PATCH v2 1/2] md raid0/linear: Introduce new array state 'broken' Guilherme G. Piccoli
2019-08-16 13:41 ` [PATCH v2 2/2] mdadm: Introduce new array state 'broken' for raid0/linear Guilherme G. Piccoli
2019-08-19 18:10 ` [PATCH v2 1/2] md raid0/linear: Introduce new array state 'broken' Song Liu
2019-08-19 18:30   ` Guilherme G. Piccoli
2019-08-19 18:57     ` Song Liu
2019-08-19 19:11       ` Guilherme G. Piccoli
2019-08-19 21:57         ` Song Liu
2019-08-21 14:16           ` Guilherme G. Piccoli
2019-08-21 16:14             ` Song Liu
2019-08-21 18:06               ` Song Liu
2019-08-21 19:10               ` Guilherme G. Piccoli
2019-08-21 19:22                 ` Song Liu
2019-08-22 16:16                   ` Guilherme G. Piccoli
2019-08-22  8:49 ` Guoqing Jiang
2019-08-22 15:35   ` Guilherme G. Piccoli [this message]

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=51d10dea-4148-6a2c-8e70-7cc977ce1def@canonical.com \
    --to=gpiccoli@canonical.com \
    --cc=dm-devel@redhat.com \
    --cc=guoqing.jiang@cloud.ionos.com \
    --cc=jay.vosburgh@canonical.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=songliubraving@fb.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).