Motr
M0
|
#include <stob.h>
Data Fields | |
const struct m0_stob_ops * | so_ops |
struct m0_stob_domain * | so_domain |
struct m0_stob_id | so_id |
enum m0_stob_state | so_state |
uint64_t | so_ref |
struct m0_chan | so_ref_chan |
struct m0_mutex | so_ref_mutex |
struct m0_tlink | so_cache_linkage |
uint64_t | so_cache_magic |
void * | so_private |
In-memory representation of a storage object.
Description.
m0_stob serves multiple purposes:
- it acts as a placeholder in storage object identifiers name-space. For example, locks can be taken on it; - it acts as a handle for the underlying storage object. IO and meta-data operations can be directed to the storage object by calling functions on m0_stob; - it caches certain storage object attributes in memory.
Accordingly, m0_stob can be in one of the states described by enum m0_stob_state. Compare these m0_stob roles with the socket interface (bind, connect, etc.)
Maintenance of stob lifetime is responsibility of stob implementation.
Stob operations vectors (so_ops) can differ for stobs within the same domain. Consequently, so_ops is assigned by stob creation interface and depends on stob type implementation.
Stob id is unique within a domain but not across cluster. User chooses ids and is responsible for the uniqeness within their domain. Stob id is represented by struct m0_stob_id and consists of:
- Stob domain fid; - Stob fid.
Stob fid has the following structure:
* 8 bits 120 bits * +----------------------+----------------------------------------------+ * | stob type id | stob key | * +----------------------+----------------------------------------------+ *
Note: stob type id is not the same as stob domain type id. It's made to make possible to distinguish stob fids from stob domain fids.
Reference counting semantics.
m0_stob_find(), m0_stob_find_by_key(), m0_stob_lookup() and m0_stob_lookup_by_key() always acquire reference to a m0_stob implicitly. m0_stob_get() and m0_stob_put() work with references explicity. The rest interface functions don't change reference count of an m0_stob.
struct m0_stob_domain* so_domain |
struct m0_stob_id so_id |
const struct m0_stob_ops* so_ops |
struct m0_chan so_ref_chan |
enum m0_stob_state so_state |