From owner-freebsd-fs@FreeBSD.ORG Fri Mar 4 15:12:22 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0287106566C for ; Fri, 4 Mar 2011 15:12:22 +0000 (UTC) (envelope-from bra@fsn.hu) Received: from people.fsn.hu (people.fsn.hu [195.228.252.137]) by mx1.freebsd.org (Postfix) with ESMTP id 92C468FC0C for ; Fri, 4 Mar 2011 15:12:21 +0000 (UTC) Received: by people.fsn.hu (Postfix, from userid 1001) id 0934474FC99; Fri, 4 Mar 2011 16:12:21 +0100 (CET) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MF-ACE0E1EA [pR: 10.3004] X-CRM114-CacheID: sfid-20110304_16122_67F89D49 X-CRM114-Status: Good ( pR: 10.3004 ) X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Fri Mar 4 16:12:20 2011 X-DSPAM-Confidence: 0.7008 X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 4d710154273061365812542 X-DSPAM-Factors: 27, From*Attila Nagy , 0.00010, struct, 0.00212, struct, 0.00212, NULL), 0.00367, error+=, 0.00423, files+with, 0.00500, h>, 0.00550, I+guess, 0.00610, #ifdef, 0.00686, files, 0.00741, defined, 0.00783, relevant, 0.00783, seems+to, 0.00843, implemented, 0.00995, Subject*files, 0.01000, Hi+Is, 0.01000, Received*online.private, 0.99000, ZFS, 0.01000, is+described, 0.99000, Date*16+12, 0.99000, arguments, 0.01000, might+not, 0.01000, header, 0.01000, the+source, 0.01093, of+data, 0.01093, [+], 0.01093, X-Spambayes-Classification: ham; 0.00 Received: from japan.t-online.private (japan.t-online.co.hu [195.228.243.99]) by people.fsn.hu (Postfix) with ESMTPSA id 994BF74FC8B for ; Fri, 4 Mar 2011 16:12:20 +0100 (CET) Message-ID: <4D710154.90409@fsn.hu> Date: Fri, 04 Mar 2011 16:12:20 +0100 From: Attila Nagy User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.23) Gecko/20090817 Thunderbird/2.0.0.23 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: freebsd-fs@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Punching holes into (sparse) files - porting Solaris fcntl(F_FREESP) to FreeBSD? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2011 15:12:23 -0000 Hi, Is it possible to make regions of files, with already written data sparse? (I'm interested to do this on ZFS) All I could find in this topic is: http://www.mail-archive.com/zfs-discuss@opensolaris.org/msg29047.html grepping through the source gives a match for VOP_SPACE in cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c: zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap) { #ifdef sun [...] error = VOP_SPACE(ZTOV(zp), F_FREESP, &fl, FWRITE | FOFFMAX, lr->lr_offset, kcred, NULL); And the relevant section from fcntl(2) in Solaris: F_FREESP Free storage space associated with a section of the ordinary file fildes. The section is specified by a variable of data type struct flock pointed to by arg. The data type struct flock is defined in the header (see fcntl.h(3HEAD)) and is described below. Note that all file systems might not support all possible variations of F_FREESP arguments. In particular, many file systems allow space to be freed only at the end of a file. F_FREESP seems to be my friend, and it's implemented in Solaris's ZFS. How hard would it be to complete the port and make it accessible from FreeBSD? I guess it was left out with a reason... Thanks,