From owner-freebsd-questions@freebsd.org Thu Aug 24 02:24:21 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86FEFDD1402 for ; Thu, 24 Aug 2017 02:24:21 +0000 (UTC) (envelope-from johnl@iecc.com) Received: from miucha.iecc.com (w6.iecc.com [IPv6:2001:470:1f07:1126::4945:4343]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "miucha.iecc.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13863661FC for ; Thu, 24 Aug 2017 02:24:20 +0000 (UTC) (envelope-from johnl@iecc.com) Received: (qmail 13641 invoked from network); 24 Aug 2017 02:24:19 -0000 Received: from unknown (64.57.183.18) by mail1.iecc.com with QMQP; 24 Aug 2017 02:24:19 -0000 Date: 24 Aug 2017 02:23:56 -0000 Message-ID: <20170824022356.19730.qmail@ary.lan> From: "John Levine" To: freebsd-questions@freebsd.org Cc: greg.marsh@gmail.com Subject: Re: ZFS question re: deletion during compression In-Reply-To: Organization: X-Headerized: yes Mime-Version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 02:24:21 -0000 In article you write: >I'm curious if ZFS didn't allow the file to be deleted while gzip was >working on it. Merely removing it from the directory listing. Meaning my >compressed file is fine. This isn't ZFS, this is the way Unix works. So long as a file has a link in any directory or is open, it's still live. It's only deleted and its space reclaimed when it has no names and is not open. Look at the library routine tmpfile() which returns a FILE pointer to a freshly created file with no name. You can write stuff to it, rewind it, read it, seek around, read or write, just like any other file. It goes away and its space is reclaimed when the it's closed, either explicitly or automatically when your program exits. R's, John