From owner-freebsd-hackers Sun Jun 24 8:42:10 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id C5C6B37B405 for ; Sun, 24 Jun 2001 08:42:07 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from opal (cs.binghamton.edu [128.226.123.101]) by bingnet2.cc.binghamton.edu (8.11.4/8.11.4) with ESMTP id f5OFg5H25636; Sun, 24 Jun 2001 11:42:05 -0400 (EDT) Date: Sun, 24 Jun 2001 11:42:04 -0400 (EDT) From: Zhihui Zhang X-Sender: zzhang@opal To: Terry Lambert Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Confusion with mknod() and devfs In-Reply-To: <3B350150.E6175A61@mindspring.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 23 Jun 2001, Terry Lambert wrote: > Zhihui Zhang wrote: > > I think you got me wrong. I was talking about a device > > with more than one names. So we can have more than one > > vnode for the same device. (If there is more than one name > > to the same device in the same FS, they can share the vnode, > > otherwise, they cannot.) > > This is not how it works. The specfs/devfs will return > the same vnode. > > A "special device" file type in the traditional sense is > a major/minor/{block|character} tuple. > > The entry in an FS that references this is _not_ where > the vnode comes from, it's a hint to tell the system to > get the vnode from a single place, instead (specfs in a > traditional system, vfs in a less traditional system). > > > > Specifically, I fail to understand why we reload the inode > > in ufs_mknod(): > > Because when you make the node, you may have an exiting > open reference to the same major/minor/{block|character} > tuple, and you don't want to duplicate it in the ihash > cache. > Thanks. But I still don't get it. The ihash is keyed on i_dev (the device where the filesystem is mounted on) and i_number. If I have two names in a filesystem refer to the same device, then their inode number must be different. if two names from different filesystems refer to the same device, then their i_dev is different even if their inode number may happen to be the same. So I do not see how can we avoid duplicate entries in the ihash cache. -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message