Motr  M0
Meta-data Store

Data Structures

struct  m0_statfs
 
struct  m0_mdstore
 

Macros

#define M0_MD_MAX_NAME_LEN   256
 

Typedefs

typedef enum m0_mdstore_locate_flags m0_mdstore_locate_flags_t
 

Enumerations

enum  m0_mdstore_locate_flags { M0_MD_LOCATE_STORED = 1 << 0, M0_MD_LOCATE_OPENED = 1 << 1, M0_MD_LOCATE_ORPHAN = 1 << 2 }
 

Functions

M0_INTERNAL int m0_mdstore_statfs (struct m0_mdstore *md, struct m0_statfs *statfs)
 
M0_INTERNAL int m0_mdstore_init (struct m0_mdstore *md, struct m0_be_seg *db, bool init_root)
 
M0_INTERNAL void m0_mdstore_fini (struct m0_mdstore *md)
 
M0_INTERNAL int m0_mdstore_create (struct m0_mdstore *md, struct m0_sm_group *grp, struct m0_cob_domain_id *id, struct m0_be_domain *bedom, struct m0_be_seg *db)
 
M0_INTERNAL int m0_mdstore_destroy (struct m0_mdstore *md, struct m0_sm_group *grp, struct m0_be_domain *bedom)
 

Variables

uint64_t sf_type
 
uint32_t sf_bsize
 
uint64_t sf_blocks
 
uint64_t sf_bfree
 
uint64_t sf_bavail
 
uint64_t sf_files
 
uint64_t sf_ffree
 
uint32_t sf_namelen
 
struct m0_fid sf_root
 
struct m0_cob_domainmd_dom
 
struct m0_cobmd_root
 

. Input

Handle unlink operation described by and cob is so called statdata cob and returned by m0_cob_locate(). Error code is returned in error case or zero otherwise.

M0_INTERNAL int m0_mdstore_link (struct m0_mdstore *md, struct m0_fid *pfid, struct m0_cob *cob, struct m0_buf *name, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_mdstore_unlink (struct m0_mdstore *md, struct m0_fid *pfid, struct m0_cob *cob, struct m0_buf *name, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_mdstore_rename (struct m0_mdstore *md, struct m0_fid *pfid_tgt, struct m0_fid *pfid_src, struct m0_cob *cob_tgt, struct m0_cob *cob_src, struct m0_buf *tname, struct m0_buf *sname, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_mdstore_fcreate (struct m0_mdstore *md, struct m0_fid *pfid, struct m0_cob_attr *attr, struct m0_cob **out, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_mdstore_open (struct m0_mdstore *md, struct m0_cob *cob, m0_mdstore_locate_flags_t flags, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_mdstore_close (struct m0_mdstore *md, struct m0_cob *cob, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_mdstore_setattr (struct m0_mdstore *md, struct m0_cob *cob, struct m0_cob_attr *attr, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_mdstore_getattr (struct m0_mdstore *md, struct m0_cob *cob, struct m0_cob_attr *attr)
 
M0_INTERNAL int m0_mdstore_readdir (struct m0_mdstore *md, struct m0_cob *cob, struct m0_rdpg *rdpg)
 
M0_INTERNAL int m0_mdstore_locate (struct m0_mdstore *md, const struct m0_fid *fid, struct m0_cob **cob, int flags)
 
M0_INTERNAL int m0_mdstore_lookup (struct m0_mdstore *md, struct m0_fid *pfid, struct m0_buf *name, struct m0_cob **cob)
 
M0_INTERNAL int m0_mdstore_path (struct m0_mdstore *md, struct m0_fid *fid, char **path)
 
M0_INTERNAL void m0_mdstore_create_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_mdstore_link_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_mdstore_unlink_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_mdstore_rename_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_mdstore_setattr_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
M0_INTERNAL int m0_mdstore_mod_init (void)
 
M0_INTERNAL void m0_mdstore_mod_fini (void)
 

Detailed Description

Macro Definition Documentation

◆ M0_MD_MAX_NAME_LEN

#define M0_MD_MAX_NAME_LEN   256

Maximal name len during readdir

Definition at line 43 of file mdstore.h.

Typedef Documentation

◆ m0_mdstore_locate_flags_t

Definition at line 75 of file mdstore.h.

Enumeration Type Documentation

◆ m0_mdstore_locate_flags

Flags supplied to m0_mdstore_locate() to point out where a cob should be found: on store, in opened files table or orhans table.

Enumerator
M0_MD_LOCATE_STORED 

Find cob on store.

M0_MD_LOCATE_OPENED 

Find cob in opened cobs table.

M0_MD_LOCATE_ORPHAN 

Find cob in orphans table.

Definition at line 66 of file mdstore.h.

Function Documentation

◆ m0_mdstore_close()

M0_INTERNAL int m0_mdstore_close ( struct m0_mdstore md,
struct m0_cob cob,
struct m0_be_tx tx 
)

Handle close operation on . Input is so called statdata cob and returned by m0_cob_locate().

Error code is returned in error case or zero otherwise.

Todo:
:
  • orphans handling?
  • quota handling?

Definition at line 536 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_create()

M0_INTERNAL int m0_mdstore_create ( struct m0_mdstore md,
struct m0_sm_group grp,
struct m0_cob_domain_id id,
struct m0_be_domain bedom,
struct m0_be_seg db 
)

Creates and initialises mdstore.

Definition at line 135 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_create_credit()

M0_INTERNAL void m0_mdstore_create_credit ( struct m0_mdstore md,
struct m0_be_tx_credit accum 
)

Definition at line 202 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_destroy()

M0_INTERNAL int m0_mdstore_destroy ( struct m0_mdstore md,
struct m0_sm_group grp,
struct m0_be_domain bedom 
)

Finalises and destroys mdstore.

Definition at line 146 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_fcreate()

M0_INTERNAL int m0_mdstore_fcreate ( struct m0_mdstore md,
struct m0_fid pfid,
struct m0_cob_attr attr,
struct m0_cob **  out,
struct m0_be_tx tx 
)

Handle create operation described by on . Input is returned by m0_cob_alloc().

Error code is returned in error case or zero otherwise.

Increment cnr_nlink of parent directory.

Definition at line 209 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_fini()

M0_INTERNAL void m0_mdstore_fini ( struct m0_mdstore md)

Finalize mdstore instance.

Definition at line 130 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_getattr()

M0_INTERNAL int m0_mdstore_getattr ( struct m0_mdstore md,
struct m0_cob cob,
struct m0_cob_attr attr 
)

Get attributes of into passed . Input is so called statdata cob and returned by m0_cob_locate().

Error code is returned in error case or zero otherwise.

Definition at line 642 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_init()

M0_INTERNAL int m0_mdstore_init ( struct m0_mdstore md,
struct m0_be_seg db,
bool  init_root 
)

Init mdstore and get it ready to work. If init_root == !0 then root cob is initialized.

Definition at line 78 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_link()

M0_INTERNAL int m0_mdstore_link ( struct m0_mdstore md,
struct m0_fid pfid,
struct m0_cob cob,
struct m0_buf name,
struct m0_be_tx tx 
)

Definition at line 295 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_link_credit()

M0_INTERNAL void m0_mdstore_link_credit ( struct m0_mdstore md,
struct m0_be_tx_credit accum 
)

Definition at line 288 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_locate()

M0_INTERNAL int m0_mdstore_locate ( struct m0_mdstore md,
const struct m0_fid fid,
struct m0_cob **  cob,
int  flags 
)

Find cob by fid.

Finds cob by and store its pointer to passed .

Definition at line 819 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_lookup()

M0_INTERNAL int m0_mdstore_lookup ( struct m0_mdstore md,
struct m0_fid pfid,
struct m0_buf name,
struct m0_cob **  cob 
)

Find cob by parent fid and name.

Finds cob by name and store its pointer to passed .

In order to handle possible obf-like names like this: (cat /mnt/motr/.motr/1:5), parent fid is checked and special action is taken to extract fid components from file name in obf case. Then m0_cob_locate() is used to find cob by fid rather than by name.

See also
m0_cob_domain_mkfs
m0_mdstore_locate

Definition at line 863 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_mod_fini()

M0_INTERNAL void m0_mdstore_mod_fini ( void  )

Definition at line 46 of file mdstore.c.

◆ m0_mdstore_mod_init()

M0_INTERNAL int m0_mdstore_mod_init ( void  )

Definition at line 41 of file mdstore.c.

◆ m0_mdstore_open()

M0_INTERNAL int m0_mdstore_open ( struct m0_mdstore md,
struct m0_cob cob,
m0_mdstore_locate_flags_t  flags,
struct m0_be_tx tx 
)

Handle open operation described by on . Input is so called statdata cob and returned by m0_cob_locate(). Error code is returned in error case or zero otherwise.

Todo:
: Place cob to open files table.

Definition at line 525 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_path()

M0_INTERNAL int m0_mdstore_path ( struct m0_mdstore md,
struct m0_fid fid,
char **  path 
)

Get path by . Path is allocated by m0_alloc() on success and path is saved there. When it is not longer needed it may be freed with m0_free().

Definition at line 900 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_readdir()

M0_INTERNAL int m0_mdstore_readdir ( struct m0_mdstore md,
struct m0_cob cob,
struct m0_rdpg rdpg 
)

Handle readdir operation described by on . Input is so called statdata cob and returned by m0_cob_locate().

Error code is returned in error case or something >= 0 otherwise.

Definition at line 705 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_rename()

M0_INTERNAL int m0_mdstore_rename ( struct m0_mdstore md,
struct m0_fid pfid_tgt,
struct m0_fid pfid_src,
struct m0_cob cob_tgt,
struct m0_cob cob_src,
struct m0_buf tname,
struct m0_buf sname,
struct m0_be_tx tx 
)

Handle rename operation described by params. Input cobs are statdata cobs and returned by m0_cob_locate(). Rest of the arguments are self explanatory.

Error code is returned in error case or zero otherwise.

Definition at line 560 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_rename_credit()

M0_INTERNAL void m0_mdstore_rename_credit ( struct m0_mdstore md,
struct m0_be_tx_credit accum 
)

Definition at line 553 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_setattr()

M0_INTERNAL int m0_mdstore_setattr ( struct m0_mdstore md,
struct m0_cob cob,
struct m0_cob_attr attr,
struct m0_be_tx tx 
)

Handle setattr operation described by on . Input is so called statdata cob and returned by m0_cob_locate().

Error code is returned in error case or zero otherwise.

Definition at line 632 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_setattr_credit()

M0_INTERNAL void m0_mdstore_setattr_credit ( struct m0_mdstore md,
struct m0_be_tx_credit accum 
)

Definition at line 626 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_statfs()

M0_INTERNAL int m0_mdstore_statfs ( struct m0_mdstore md,
struct m0_statfs statfs 
)

Populate with storage data such as free files, etc.

We need statfs mostly to provide mdstore root fid to m0t1fs at this point. It is not yet clear what else info should be returned where it can be retrieved from. Hence return zeros so far.

Definition at line 55 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_unlink()

M0_INTERNAL int m0_mdstore_unlink ( struct m0_mdstore md,
struct m0_fid pfid,
struct m0_cob cob,
struct m0_buf name,
struct m0_be_tx tx 
)

Copy statdata (in case of killing old statdata) or update statdata with new nlink number.

Kill the name itself.
Decrement cnr_nlink of parent directory.

Definition at line 388 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_mdstore_unlink_credit()

M0_INTERNAL void m0_mdstore_unlink_credit ( struct m0_mdstore md,
struct m0_be_tx_credit accum 
)

Definition at line 380 of file mdstore.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ md_dom

struct m0_cob_domain* md_dom

Definition at line 58 of file mdstore.h.

◆ md_root

struct m0_cob* md_root

Definition at line 59 of file mdstore.h.

◆ sf_bavail

uint64_t sf_bavail

Definition at line 50 of file mdstore.h.

◆ sf_bfree

uint64_t sf_bfree

Definition at line 49 of file mdstore.h.

◆ sf_blocks

uint64_t sf_blocks

Definition at line 48 of file mdstore.h.

◆ sf_bsize

uint32_t sf_bsize

Definition at line 47 of file mdstore.h.

◆ sf_ffree

uint64_t sf_ffree

Definition at line 52 of file mdstore.h.

◆ sf_files

uint64_t sf_files

Definition at line 51 of file mdstore.h.

◆ sf_namelen

uint32_t sf_namelen

Definition at line 53 of file mdstore.h.

◆ sf_root

struct m0_fid sf_root

Definition at line 54 of file mdstore.h.

◆ sf_type

uint64_t sf_type

Definition at line 46 of file mdstore.h.