From owner-freebsd-hackers Sat Dec 4 12:31: 8 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id F066C14C34 for ; Sat, 4 Dec 1999 12:31:05 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id MAA56701; Sat, 4 Dec 1999 12:29:37 -0800 (PST) (envelope-from dillon) Date: Sat, 4 Dec 1999 12:29:37 -0800 (PST) From: Matthew Dillon Message-Id: <199912042029.MAA56701@apollo.backplane.com> To: Chuck Youse Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: tmpfs .. ? References: Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message