From owner-cvs-all Mon Jan 21 10: 9:45 2002 Delivered-To: cvs-all@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id 8D41D37B416; Mon, 21 Jan 2002 10:09:39 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id 6204410DDF7; Mon, 21 Jan 2002 10:09:39 -0800 (PST) Date: Mon, 21 Jan 2002 10:09:39 -0800 From: Alfred Perlstein To: Brian Somers Cc: Maxim Sobolev , Dag-Erling Smorgrav , Kirk McKusick , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern vfs_subr.c src/sys/ufs/ffs ffs_inode.c ffs_vfsops.c src/sys/ufs/ufs ufs_inode.c ufs_vnops.c Message-ID: <20020121100939.I13686@elvis.mu.org> References: <200201211311.g0LDB1r91545@hak.lan.Awfulhak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200201211311.g0LDB1r91545@hak.lan.Awfulhak.org>; from brian@freebsd-services.com on Mon, Jan 21, 2002 at 01:11:00PM +0000 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Brian Somers [020121 05:11] wrote: > > I believe this occurs because when a program does open(O_TRUNC), > write(), write(), write(), write(), write(), close(), each write > that's committed to the softupdates queue is actually some block > updates followed by an inode update. Softupdates optimises out > the previous inode update. > > The initial inode update isn't optimised out (the truncate) so that > the disk blocks can be freed easily. > > So the queue ends up being: > > Make the file size 0 > Do a *load* of block updates > Make the file size correct. > > If you crash, you're *very* likely to end up with a zero length file. > > This is unfortunate, and there's no easy way to avoid it. Shouldn't editors fsync() files after ":w" ? :) -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductable donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message