On Wed, Jul 25, 2007 at 08:19:07PM +0200, Mark Furner wrote:
> Many thanks for the quick reply, Eric. ZFS is quite awesome, but also 
> awesomely complicated.
> 
> What did you mean with
> 
> >For *filesystems*, you can consult the per-pool history.
> 
> Is this the vdev label uberblock / MOS thing?

Yes, the history is stored in the MOS.

> > It is part of the MOS (meta object set), which is the root of all
> > pool-wide metadata.
> 
> I'm still trying to work out where the MOS can be found on disk. The 
> uberblock 
> points to it, but is it outside the vdev label? The diagram on p. 32 of 
> the  "ZFS On-Disk Specification"  is a bit ambiguous here. Where does the 
> file-system metadata end and the files / file metadata / directories begin?

The uberblock points the MOS:

struct uberblock {
        uint64_t        ub_magic;       /* UBERBLOCK_MAGIC              */
        uint64_t        ub_version;     /* SPA_VERSION                  */
        uint64_t        ub_txg;         /* txg of last sync             */
        uint64_t        ub_guid_sum;    /* sum of all vdev guids        */
        uint64_t        ub_timestamp;   /* UTC time of last sync        */
        blkptr_t        ub_rootbp;      /* MOS objset_phys_t            */
};

The 'ub_rootbp' points to the MOS, from which all pool data and metadata
can be discovered.  It is a normal block pointer, which means it can be
stored on any of the vdevs (several of them, thanks to ditto blocks).
Only the vdev label (including the uberblock) has a fixed location,
everything is derived from that.

For what's contained in the MOS, check out the definition for
DMU_POOL_DIRECTORY_OBJECT:

/*
 * The names of zap entries in the DIRECTORY_OBJECT of the MOS.
 */
#define DMU_POOL_DIRECTORY_OBJECT       1
#define DMU_POOL_CONFIG                 "config"
#define DMU_POOL_ROOT_DATASET           "root_dataset"
#define DMU_POOL_SYNC_BPLIST            "sync_bplist"
#define DMU_POOL_ERRLOG_SCRUB           "errlog_scrub"
#define DMU_POOL_ERRLOG_LAST            "errlog_last"
#define DMU_POOL_SPARES                 "spares"
#define DMU_POOL_DEFLATE                "deflate"
#define DMU_POOL_HISTORY                "history"
#define DMU_POOL_PROPS                  "pool_props"

Most of this is pool-wide metadata, but the 'root_dataset' is the link
into the DSL (dataset and snapshot layer) which has a list of all the
filesystems (among other things).  Each filesystem has its own data
structure that is the root of the actual filesystem data.

Hope that helps,

- Eric

--
Eric Schrock, Solaris Kernel Development       http://blogs.sun.com/eschrock

Reply via email to