[OpenIndiana-discuss] zfs question - when can _rewriting_ a block of a file fail on out-of-space?

Richard Elling richard.elling at richardelling.com
Sun Jun 3 13:54:58 UTC 2012


On Jun 1, 2012, at 10:45 PM, Richard L. Hamilton wrote:

> In a non-COW filesystem, one would expect that rewriting an already allocated block would never fail for out-of-space (ENOSPC).

This seems like a rather broad assumption. It may hold for FAT or UFS, but might not
hold for some of the more modern file systems (eg flash file systems) But I digress...

> But I would expect that it could on ZFS - definitely if there was a snapshot around, as it would create a divergence from that snapshot (because both blocks would be kept).  Or if deduplication was in effect, and the new block contents were unique when the old contents hadn't been unique.
> 
> Could rewriting a block _ever_ fail with ENOSPC if there _wasn't_ a snapshot present, or is the replace old block with new somehow guaranteed to succeed, so as to avoid introducing unexpected semantics?  (say maybe there's a reserved amount of free space just for rewrites to avoid that sort of problem, or some other magic)

There is a reserve at the pool level. It is needed for the ZIL at the very least.

> I would think DBMS developers allowing databases to be stored on ZFS, as well as folks using mmap(), might particularly want to be aware of the cases in which an errno not anticipated from experience with other filesystems might arise.

Those developers have to handle all error conditions anyway.

NB, many important databases are also COW, so the concept is well understood.
 -- richard

--
ZFS Performance and Training
Richard.Elling at RichardElling.com
+1-760-896-4422





More information about the OpenIndiana-discuss mailing list