* a question about clone_mnt in namespace.c
@ 2012-06-20 2:54 yushang
2012-06-22 9:29 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: yushang @ 2012-06-20 2:54 UTC (permalink / raw)
To: linux-fsdevel
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;
}
}
...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: a question about clone_mnt in namespace.c
2012-06-20 2:54 a question about clone_mnt in namespace.c yushang
@ 2012-06-22 9:29 ` Al Viro
2012-07-01 2:03 ` yushang
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2012-06-22 9:29 UTC (permalink / raw)
To: yushang; +Cc: linux-fsdevel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: a question about clone_mnt in namespace.c
2012-06-22 9:29 ` Al Viro
@ 2012-07-01 2:03 ` yushang
0 siblings, 0 replies; 3+ messages in thread
From: yushang @ 2012-07-01 2:03 UTC (permalink / raw)
To: Al Viro; +Cc: linux-fsdevel
Thanks for reply. I think mnt_slave and mnt_master are integrity parts
of master/slave semantics and put the 2 lines together will make the
logic clearer.
Many thanks.
2012/6/22 Al Viro <viro@zeniv.linux.org.uk>:
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-01 2:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-20 2:54 a question about clone_mnt in namespace.c yushang
2012-06-22 9:29 ` Al Viro
2012-07-01 2:03 ` yushang
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).