On Mon, May 28, 2018 at 8:51 PM, frostyplanet via openzfs-developer <
[email protected]> wrote:

> Greetings, I am currently learning ZFS code, having some questions about
> spacemap writing and condensing. Is there some people can enlighten me  on
> the big picture (because I could not find articles about these elsewhere ):
>

You might find the following talks informative on this subject:

ZFS overview and read / write code walkthrough:
https://www.youtube.com/watch?v=ptY6-K78McY

Part of this is about spacemap on-disk format:
https://www.youtube.com/watch?v=uJGkyMxdNFE

Log spacemap:
https://www.youtube.com/watch?v=jj2IxRkl5bQ



>
> 1)  Space map store on disk as dnode, writing dnode blocks again needs
> allocation and free,  is this a feed back loop and how to break this
> cycling dependence ?
>

Yes, we call this "sync to convergence".  The cycle is broken by
overwriting the block in place, thus not requiring any change of the
allocation information.  This is safe since we are only overwriting blocks
that were allocated in the current txg, so if we crash it's as if nothing
happened.


>
> 2) During disk space near full situation,  is it possible some syncing
> will fail becauses of cannot allocate to space map appending writes ?  (I
> have seen some posts about failure to delete files on a full disk)
>

No, we reserve some free space so that this can't happen.  It isn't really
related to file deletion, which may fail due to a (since fixed) bug in the
space checking code, or if we are extremely low on space (in which case you
can still "zfs destroy" to free up space).  See also zfs_space_check_t in
dsl_synctask.h.


>
> 3) Is it possible to condense a spacemap even if disk space not enough to
> allocate a new space?
>

If there's zero allocatable space, then you've hit a bug in ZFS, and your
pool is now permanently read-only.  Normally there is always enough free
space to condense a spacemap.

--matt


> *openzfs <https://openzfs.topicbox.com/latest>* / openzfs-developer
> <https://openzfs.topicbox.com/groups/developer/members> / Permalink
> <https://openzfs.topicbox.com/groups/developer/discussions/Td20524f29bfb36ea-M43f6fd1390923df8c3a777cd>
>  Delivery
> options <https://openzfs.topicbox.com/groups>
>

------------------------------------------
openzfs: openzfs-developer
Permalink: 
https://openzfs.topicbox.com/groups/developer/discussions/Td20524f29bfb36ea-Mc09706bb1d1dc7999b00fba7
Delivery options: https://openzfs.topicbox.com/groups

Reply via email to