From owner-freebsd-current Mon Mar 6 10:19:40 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id KAA13725 for current-outgoing; Mon, 6 Mar 1995 10:19:40 -0800 Received: from cs.weber.edu (cs.weber.edu [137.190.16.16]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id KAA13717 for ; Mon, 6 Mar 1995 10:19:33 -0800 Received: by cs.weber.edu (4.1/SMI-4.1.1) id AA18693; Mon, 6 Mar 95 11:12:14 MST From: terry@cs.weber.edu (Terry Lambert) Message-Id: <9503061812.AA18693@cs.weber.edu> Subject: Re: "Sparse" files? To: bde@zeta.org.au (Bruce Evans) Date: Mon, 6 Mar 95 11:12:13 MST Cc: current@freefall.cdrom.com, jkh@FreeBSD.org In-Reply-To: <199503060641.QAA15475@godzilla.zeta.org.au> from "Bruce Evans" at Mar 6, 95 04:41:27 pm X-Mailer: ELM [version 2.4dev PL52] Sender: current-owner@FreeBSD.org Precedence: bulk > >Do we have any support for the likes of Linux's sparse files? Patrick > >here says it saves around 25% for executables alone when run-length > >compression is done for zero'd blocks. > > ffs certainly supports holes in regular files. Gnu cp preserves holes > in regular files and creates them if possible, at least on POSIX file > systems for which stat() returns suitable non-POSIX info (st_blocks > and/or st_blksize). Our cp neither creates them nor preserves them. > It might be difficult to support them and still use mmap(). > > The usual ffs block size is 8K, while the usual linux block size is 1K, > so the chance of finding a zero block to compress is much lower. What they are doing is RLE "compression", so it isn't really a "sparse" file. BSD has (?) gzip support anyway. I was thinking on the zero'ed block issue last night, both in regard to frags being zeroed, and in regard to alignment and restoration issues. The alignment issue would allow paging on a 512 byte boundry. This is a clear win in the file-as-swap-store case. The restoration issue is one of special casing zero-fill block writes to not mark the block dirty for written zeroes. Clearly, you could do this in copy (like gnu cp and tar currently do); the question is whether the kernel write overhead is too high. One of the guys at work has been experimenting with using "team" to download images on an http server with some significant promise; this is related, in that it implies that the amount of time in an I/O wait is sufficient latency to mask overhead in a block compare for 0's, at least until kernel multithreading and reader/writer locking are pounded in everywhere. Terry Lambert terry@cs.weber.edu --- Any opinions in this posting are my own and not those of my present or previous employers.