Skip site navigation (1)Skip section navigation (2)
Date:      24 Aug 2017 02:23:56 -0000
From:      "John Levine" <johnl@iecc.com>
To:        freebsd-questions@freebsd.org
Cc:        greg.marsh@gmail.com
Subject:   Re: ZFS question re: deletion during compression
Message-ID:  <20170824022356.19730.qmail@ary.lan>
In-Reply-To: <CAHtBMo76EwM-Q1Qr%2BU8VMH6kDsUkc%2Bcb9mxARSYco=XzNxT9-Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <CAHtBMo76EwM-Q1Qr+U8VMH6kDsUkc+cb9mxARSYco=XzNxT9-Q@mail.gmail.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170824022356.19730.qmail>