The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] V6 UNIX main() oddness
@ 2018-01-25 18:42 Noel Chiappa
  2018-01-25 19:36 ` Ron Natalie
  2018-01-25 19:41 ` Clem Cole
  0 siblings, 2 replies; 3+ messages in thread
From: Noel Chiappa @ 2018-01-25 18:42 UTC (permalink / raw)


So, while bringing up V6 on a hardware PDP-11/23 with an RK11 emulator using
an SD card for storage which Dave Bridgham and I are doing, I found this piece
of code in main() on V6 Unix:

	rootdir = iget(rootdev, ROOTINO);
	rootdir->i_flag =& ~ILOCK;
	u.u_cdir = iget(rootdev, ROOTINO);
	u.u_cdir->i_flag =& ~ILOCK;

I don't get why two separate calls to iget(), with the same arguments;
why not replace the second pair of lines with:

	u.u_cdir = rootdir;
	rootdir->i_count++;

What am I missing?

	Noel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [TUHS] V6 UNIX main() oddness
  2018-01-25 18:42 [TUHS] V6 UNIX main() oddness Noel Chiappa
@ 2018-01-25 19:36 ` Ron Natalie
  2018-01-25 19:41 ` Clem Cole
  1 sibling, 0 replies; 3+ messages in thread
From: Ron Natalie @ 2018-01-25 19:36 UTC (permalink / raw)


I don't see any reason why you can't make that optimization at that point.
Nothing is going to come in and suddenly invalidate the inode between those
two lines.
I suspect it was an example of cut/paste-it is from some other part of the
kernel.

-----Original Message-----
From: TUHS [mailto:tuhs-bounces@minnie.tuhs.org] On Behalf Of Noel Chiappa
Sent: Thursday, January 25, 2018 1:43 PM
To: tuhs at minnie.tuhs.org
Cc: jnc at mercury.lcs.mit.edu
Subject: [TUHS] V6 UNIX main() oddness

So, while bringing up V6 on a hardware PDP-11/23 with an RK11 emulator using
an SD card for storage which Dave Bridgham and I are doing, I found this
piece of code in main() on V6 Unix:

	rootdir = iget(rootdev, ROOTINO);
	rootdir->i_flag =& ~ILOCK;
	u.u_cdir = iget(rootdev, ROOTINO);
	u.u_cdir->i_flag =& ~ILOCK;

I don't get why two separate calls to iget(), with the same arguments; why
not replace the second pair of lines with:

	u.u_cdir = rootdir;
	rootdir->i_count++;

What am I missing?

	Noel



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [TUHS] V6 UNIX main() oddness
  2018-01-25 18:42 [TUHS] V6 UNIX main() oddness Noel Chiappa
  2018-01-25 19:36 ` Ron Natalie
@ 2018-01-25 19:41 ` Clem Cole
  1 sibling, 0 replies; 3+ messages in thread
From: Clem Cole @ 2018-01-25 19:41 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]

Seems reasonable to me give the code path and time its being called.  Maybe
left over from hacking from an earlier kernel requirement and never noticed
by Ken.  I wonder if the mount table had been set up in some earlier scheme
and he wanted to make sure it was checked first.  That's the only thing
that seems logical, but we all miss optimizations.
ᐧ

On Thu, Jan 25, 2018 at 1:42 PM, Noel Chiappa <jnc at mercury.lcs.mit.edu>
wrote:

> So, while bringing up V6 on a hardware PDP-11/23 with an RK11 emulator
> using
> an SD card for storage which Dave Bridgham and I are doing, I found this
> piece
> of code in main() on V6 Unix:
>
>         rootdir = iget(rootdev, ROOTINO);
>         rootdir->i_flag =& ~ILOCK;
>         u.u_cdir = iget(rootdev, ROOTINO);
>         u.u_cdir->i_flag =& ~ILOCK;
>
> I don't get why two separate calls to iget(), with the same arguments;
> why not replace the second pair of lines with:
>
>         u.u_cdir = rootdir;
>         rootdir->i_count++;
>
> What am I missing?
>
>         Noel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20180125/745fbeda/attachment.html>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-25 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 18:42 [TUHS] V6 UNIX main() oddness Noel Chiappa
2018-01-25 19:36 ` Ron Natalie
2018-01-25 19:41 ` Clem Cole

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).