: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 
                                        <[EMAIL PROTECTED]>


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to