Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Dec 2008 14:55:40 -0500
From:      "Zaphod Beeblebrox" <zbeeble@gmail.com>
To:        "Christopher Arnold" <chris@arnold.se>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: ZFS and other filesystem semantics.
Message-ID:  <5f67a8c40812151155o166b96b1meef07e685307c9ba@mail.gmail.com>
In-Reply-To: <alpine.BSF.2.00.0812091448020.66657@localhost>
References:  <alpine.BSF.2.00.0812091448020.66657@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 9, 2008 at 9:01 AM, Christopher Arnold <chris@arnold.se> wrote:


> i have been thinking a bit about filesytem semantics lately. Mainly about
> open files.
>
> Classicly if a file is open the filedescriptor continues accessing the same
> file regardless if it is deleted or someone did a mv and replaced it.
>
> But what happens in ZFS?
>
> * delete file in ZFS
> I guess this is a no brainer, standard unix way of accessing the old file.


When all references to  data  are freed, the data is freed.  directory
entries and open files are both references.


> * The fs get snapshotted and file deleted
> Same as above i guess.


A snapshot counts as a reference


> * The fs gets snapshotted and later the snapshot get deleted...
> What happens here?


A snapshot is a reference.  When the file is "deleted" the snapshot still
references the data.  When the snapshot is deleted, if the data has no other
references, it is freed.


> Or maybe even:
> * The fs gets snapshotted, file deleted, then snapshot deleted.
>
> (These questions are actually just a sidestep from the issue im trying to
> figure out right no. But i guess they are nevertheless interesting.)
>
> The reason i have been thinking about this is that i'm implementing a
> remote RO filesystem with local caching. And to reduce latency i download
> chunks of the files and cache these chunks. I'm trying to keep the
> filesystem stateless, but my issue is that if the file get changed under our
> feet the resulting chunks would be from different files.
>
> Have anyone seen a nice solution to this issue?
>
> Does anyone have any ideas of how to implement unix like semantics over a
> stateless procotol without to much magic?


The semantics you desire are basically reference counting.



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