Architecture - New Metadata API

= Requirements =


 * 1) clear, simple, no tricks
 * 2) portable
 * 3) support for CMD
 * 4) support for WBC
 * 5) support for few llite-like layer at same time (lustre, pnfs, etc)

Proposal

 * 1) MDAPI consists of primitive metadata operations like lookup, getattr by fid, readdir, create, unlink, open, close, mkdir, rmdir, rename
 * 2) MDD uses same API so that client can talk to MDD directly
 * 3) all network-related things are extracted to MDC-MDT (intents, recovery)
 * 4) open is part of in-core state needed only for remote clients, so part of MDT-MDC only
 * 5) there may be MDD running on server and MDD running on client at same time. MDD on server is better for contended resource (like /tmp directory), MDD on client is metadata writeback cache
 * 6) MDC should provide notion of context where results of compound operation can be stored, this context to be opened and closed by llite (probably ldlm could help as we're holding lock till end of operation)
 * 7) LMV is request forwarder only (do we still need striped directories?)
 * 8) transactions are exposed above MDC with CMD as single transaction can update few servers

= API =

context - a notion allowing to store results of do-ahead operation (intents)

md_init_ctxt -- initialize context md_fini_ctxt -- release context md_lookup    -- lookup given parent directory and name into fid (NULL) md_getattr   -- fetch attributes for given fid md_setattr   -- set attributes for given fid md_create    -- create file/directory with given name in given parent md_open      -- open file/directory by fid, returns open handle md_close     -- close given open handle md_readdir   -- return set of directory entries from given fid/hash/offset? md_unlink    -- unlink name in given directory (may cause file removal) md_symlink   -- create symbolic link md_rename    -- rename ... md_xattr_*   -- set of calls to manipulate extended attributes md_statfs    -- return fs stats (all/avail blocks/files, etc) md_enqueue   -- enqueue lock (can take intent from context) md_decref_lock-- release (not meaning cancel) lock md_cancel    -- cancel lock

= Use Cases =

lock cancel
= Problems =


 * 1) without intents in VFS, it's possible that stat(2) has to issue 2 RPCs to MDS: one from ->lookup, another from ->getattr. is solution needed?

= Implementation steps =


 * 1) restructure llite and MDC to new API
 * 2) IFF we want MDWBC implemented this way, restructure MDT/MDD and implement ROSD/TOSD