Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Dec 1999 12:29:37 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Chuck Youse <cyouse@paradox.nexuslabs.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: tmpfs .. ?
Message-ID:  <199912042029.MAA56701@apollo.backplane.com>
References:   <Pine.BSF.4.10.9912022306280.57379-100000@paradox.nexuslabs.com>

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

:Has anyone toyed with the idea of implementing a swap-based filesystem
:similar to Sun's tmpfs?
:
:Chuck Youse

    I did it a couple of months ago.  You simply use the VN device and
    tell it to use swap as backing store, then newfs up a UFS filesystem
    on it.  You have the option to have it dynamically allocate and 
    deallocate swap, or you can force it to pre-reserve swap.  See the
    'vnconfig' man page and the -S option and the '-s reserve' option. 

    This is for -CURRENT only.

    Generally speaking this isn't going to be as efficient as a real tmpfs
    due to the update daemon syncing all filesystems every so often.
    But if you pre-reserve the swap it *will* be just as efficient as a
    normal filesystem.  In fact, if you have multiple swap partitions
    your tmpfs will wind up being interleaved and will have even better
    performance.  pre-reservation also gives you the ability to recover
    the filesystem after a crash though for obvious reasons it can be 
    problematic to depend on this ability.

    The big difference between MFS and VN is that MFS simulates a 'disk'
    by using a special processes VM space, which means that disk blocks tend
    to end up in memory twice - in the VM cache, and in the VM space.  The
    VN device implements the disk directly on a file or swap and does not 
    have the double-caching problem.  MFS will tend to overload the VM
    system if you use it to accomodate large files.  VN operates more like a
    normal disk, especially (in performance terms) when you use pre-reserved
    swap as backing store.

	vnconfig -e -s labels,reserve -S 100m /dev/vn0
	disklabel -r -w vn0 auto
	newfs -i 4096 /dev/rvn0c
	tunefs -n enable /dev/rvn0c
	mount /dev/vn0c /usr/obj


					-Matt
					Matthew Dillon 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912042029.MAA56701>