Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 1998 17:15:57 -0400 (EDT)
From:      Robert Watson <robert@cyrus.watson.org>
To:        Dag-Erling Coidan =?iso-8859-1?Q?Sm=F8rgrav?=  <dag-erli@ifi.uio.no>
Cc:        stable@FreeBSD.ORG
Subject:   Re: vnconfig + swap with sparse files
Message-ID:  <Pine.BSF.3.96.980525170957.5875A-100000@cyrus.watson.org>
In-Reply-To: <xzpk97amczt.fsf@bilskirnir.ifi.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help

On 25 May 1998, Dag-Erling Coidan [iso-8859-1] Smørgrav  wrote:

> Robert Watson <robert@cyrus.watson.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980525170957.5875A-100000>