> * Mount COW layer over clean tree.
> * Edit a file, writing to the COW layer.
> * Build the kernel.
> * Decide that you don't want the change, delete the COW version,
> exposing the original version of the file, timestamp goes backwards.
ITYM "creating a whiteout entry". unlink() on unionfs doesn't expose
the underlying object.
It looks so:
* each directory in covering layer has a flag (is_transparent)
* all children of non-transparent directory are non-transparent
* lookup in non-transparent directory is a usual lookup in covering
layer.
* lookup in transparent directory
lookup in covering layer
if found an object -> return it
else if found whiteout -> no entry
else
do lookup in covered
if not found -> no entry
else if found is a directory
create a directory in covering
mark it transparent
return new directory
else -> return what we found
* mkdir creates non-transparent directories
* unlink and rmdir leave whiteout entry
* attempt to modify file copies it into covering and modifies that copy.
That gives you real copy-on-write semantics - when you remove object it
stays removed; rm -rf foo && mkdir foo gives you an empty directory, etc.
rename() support is messy - especially when it comes to renaming directories
(if it was transparent you need to copy the entire subtree to covering layer).
Whiteouts are usually represented as directory entries with no inode and
type of entry being DT_WHT (14). Adding support of these beasts into
ext2 is ~ 10 lines of patch.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/