From owner-freebsd-stable Mon May 25 14:16:17 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA06376 for freebsd-stable-outgoing; Mon, 25 May 1998 14:16:17 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from cyrus.watson.org (BERLIOZ.CODA.CS.CMU.EDU [128.2.242.62]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA06192 for ; Mon, 25 May 1998 14:16:00 -0700 (PDT) (envelope-from robert@cyrus.watson.org) Received: from localhost (robert@localhost) by cyrus.watson.org (8.8.8/8.8.5) with SMTP id RAA06091; Mon, 25 May 1998 17:15:58 -0400 (EDT) Date: Mon, 25 May 1998 17:15:57 -0400 (EDT) From: Robert Watson To: Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?= cc: stable@FreeBSD.ORG Subject: Re: vnconfig + swap with sparse files In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by hub.freebsd.org id OAA06265 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk On 25 May 1998, Dag-Erling Coidan [iso-8859-1] Smørgrav wrote: > Robert Watson writes: > > I rebooted to stop swapping on the file, and modified my creation program > > to drop a \0 at the beginning of each block. Sure enough, starting > > swapping this time worked fine. > > What you should have done in the first place was: > > # dd if=/dev/zero of=swapfile bs=1048576 count=128 > > A sparse file cannot possibly work as swap since it does not have any > space allocate to it on the disk, and you *want* to allocate space on > the disk - where else are you going to swap out your data? I would argue that more intuitive behavior would be for the pager to get back 0'd pages, as all other users of sparse files do. When I mmap my sparse file, I get 0's :). While this is more intuitive, it may not in reality be feasible. However, a note in vn(4) under BUGS indicating that the vn driver does not automatically allocate pages for sparse files when used, or documenting its error return on attempting to read or write an unallocated block in a sparse file would make sense. Indeed, I did not expect the pager to swap to my sparse file -- I expected the file to become un-sparse as it went along. Robert Watson To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message