All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: yushang <yusunn@gmail.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: a question about clone_mnt in namespace.c
Date: Fri, 22 Jun 2012 10:29:24 +0100	[thread overview]
Message-ID: <20120622092924.GC14083@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAHHgPeMOcgg6f8xzknxSDksbgJ2XuMoaVzot3Xur2-UjmveQ-A@mail.gmail.com>

On Wed, Jun 20, 2012 at 10:54:00AM +0800, yushang wrote:
> Hi dear all,
> I have a question about the mnt_master logic in clone_mnt , look at
> following lines:
> ...
> } else if (!(flag & CL_PRIVATE)) {
>   if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(old))
> 	list_add(&mnt->mnt_share, &old->mnt_share);
>   if (IS_MNT_SLAVE(old))
> 	list_add(&mnt->mnt_slave, &old->mnt_slave);
>     mnt->mnt_master = old->mnt_master;
> }
> ...
> I think the following lines are equivalent, right ? or I've missed
> something ? many thanks!
> ...
> } else if (!(flag & CL_PRIVATE)) {
>   if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(old))
> 	list_add(&mnt->mnt_share, &old->mnt_share);
>   if (IS_MNT_SLAVE(old)) {
> 	list_add(&mnt->mnt_slave, &old->mnt_slave);
>         mnt->mnt_master = old->mnt_master;
>   }
> }

Yes; we are guaranteed that mnt->master is NULL after alloc_vfsmnt(),
so that would be an equivalent transformation.  Matter of taste,
mostly - performance win is negligible and IMO your variant is
slightly less explicit.

  reply	other threads:[~2012-06-22  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20  2:54 a question about clone_mnt in namespace.c yushang
2012-06-22  9:29 ` Al Viro [this message]
2012-07-01  2:03   ` yushang

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=20120622092924.GC14083@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=yusunn@gmail.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 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.