linux-newbie.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: wuzhouhui <wuzhouhui14@mails.ucas.ac.cn>
To: linux-newbie@vger.kernel.org
Subject: Pointer compare in md driver
Date: Fri, 27 Oct 2017 16:08:25 +0800	[thread overview]
Message-ID: <aa2d080d-8410-ba9a-0e0b-084a08079dd8@mails.ucas.ac.cn> (raw)

Hi,

I have a question when reading md driver. Following is the code from
linux/drivers/md/md.c, function md_do_sync():

>                 for_each_mddev(mddev2, tmp) {
>                         if (mddev2 == mddev)
>                                 continue;
>                         if (!mddev->parallel_resync
>                         &&  mddev2->curr_resync
>                         &&  match_mddev_units(mddev, mddev2)) {
>                                 DEFINE_WAIT(wq);
>                                 if (mddev < mddev2 && mddev->curr_resync == 2) {
>                                         /* arbitrarily yield */
>                                         mddev->curr_resync = 1;
>                                         wake_up(&resync_wait);
>                                 }
>                                 if (mddev > mddev2 && mddev->curr_resync == 1)
>                                         /* no need to wait here, we can wait the next
>                                          * time 'round when curr_resync == 2
>                                          */
>                                         continue;
>                                 /* We need to wait 'interruptible' so as not to

The type of mddev2 and mddev both are struct mddev *, so what's the
meaning of comparing these two variables?

--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

                 reply	other threads:[~2017-10-27  8:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=aa2d080d-8410-ba9a-0e0b-084a08079dd8@mails.ucas.ac.cn \
    --to=wuzhouhui14@mails.ucas.ac.cn \
    --cc=linux-newbie@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).