From owner-freebsd-fs Mon Oct 7 21:53:16 2002 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 65F0837B401 for ; Mon, 7 Oct 2002 21:53:15 -0700 (PDT) Received: from snipe.mail.pas.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id F332D43E8A for ; Mon, 7 Oct 2002 21:53:14 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0110.cvx22-bradley.dialup.earthlink.net ([209.179.198.110] helo=mindspring.com) by snipe.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17ymMk-0005yN-00; Mon, 07 Oct 2002 21:53:06 -0700 Message-ID: <3DA2646B.45D024AB@mindspring.com> Date: Mon, 07 Oct 2002 21:51:55 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "David E. Cross" Cc: freebsd-fs@freebsd.org, guptar@cs.rpi.edu Subject: Re: UFS, Inode question References: <200210080439.g984drE16529@pegasus.cs.rpi.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org "David E. Cross" wrote: > Our current method independently stores inode allocation > and linking as discrete events. The problem arises if one is committed > without the other (think an inopportune break point in the disk-journal > vs. in-core journal.) That could lead to an inode being allocated, but not > actually referenced. > > What does the system do with an inode with a reference count of 0, is that > a free inode (on the "free list"). Or can it still be an unreferenced inode? > If it can be unreferenced then we need to rethink some things here as the > entire point is to avoid fsck. These answers are for "fsck -y"; for manual fsck, the answers will depend on your interaction with the fsck program... Unreferenced inodes are not free unless they are marked free in the bitmap. A fsck will mark the free, if they have a zero reference count. An inode with no directory references, but a postive reference count is assumed to have lost its directory entry, and is linked into the lost+found directory. An inode with a zero reference count, but a directory reference to it is assumed to have been a failure during create, and is removed (a failure during delete would leave a positive reference count, and either a directory entry, or no directory entry; in the former case, "the file is there"; the latter case is already covered). The one thing you should be careful of here is to increase and commit the link count change to the inode before making the referencing directory entry (UFS does this already). Actually, every place soft updates creates a dependency, you could create a log entry, and you'd pretty much be "done"... -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message