Motr  M0
mdstore.c File Reference
#include "lib/trace.h"
#include <sys/stat.h>
#include "lib/misc.h"
#include "lib/arith.h"
#include "lib/errno.h"
#include "lib/assert.h"
#include "lib/memory.h"
#include "lib/bitstring.h"
#include "lib/rwlock.h"
#include "fid/fid.h"
#include "fop/fop.h"
#include "cob/cob.h"
#include "mdstore/mdstore.h"
#include "motr/magic.h"
Include dependency graph for mdstore.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_COB
 
#define M0_MD_FAKE_BLOCKSIZE   4096
 
#define M0_MD_FAKE_VOLUME   250000
 
#define MDSTORE_PATH_MAX   1024
 
#define MDSTORE_NAME_MAX   255
 

Functions

M0_INTERNAL int m0_mdstore_mod_init (void)
 
M0_INTERNAL void m0_mdstore_mod_fini (void)
 
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)
 
static void mdstore_fini (struct m0_mdstore *md, bool pre_destroy)
 
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)
 
M0_INTERNAL void m0_mdstore_dir_nlink_update_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
M0_INTERNAL int m0_mdstore_dir_nlink_update (struct m0_mdstore *md, struct m0_fid *fid, int inc, struct m0_be_tx *tx)
 
M0_INTERNAL void m0_mdstore_create_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
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 void m0_mdstore_link_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
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_dir_empty_check (struct m0_mdstore *md, struct m0_cob *cob)
 
M0_INTERNAL void m0_mdstore_unlink_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
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_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 void m0_mdstore_rename_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
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 void m0_mdstore_setattr_credit (struct m0_mdstore *md, struct m0_be_tx_credit *accum)
 
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)
 

Macro Definition Documentation

◆ M0_MD_FAKE_BLOCKSIZE

#define M0_MD_FAKE_BLOCKSIZE   4096

Let's show client that we have 1G storage.

Definition at line 52 of file mdstore.c.

◆ M0_MD_FAKE_VOLUME

#define M0_MD_FAKE_VOLUME   250000

Definition at line 53 of file mdstore.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_COB

Definition at line 22 of file mdstore.c.

◆ MDSTORE_NAME_MAX

#define MDSTORE_NAME_MAX   255

Definition at line 898 of file mdstore.c.

◆ MDSTORE_PATH_MAX

#define MDSTORE_PATH_MAX   1024

Definition at line 897 of file mdstore.c.

Function Documentation

◆ m0_mdstore_dir_empty_check()

M0_INTERNAL int m0_mdstore_dir_empty_check ( struct m0_mdstore md,
struct m0_cob cob 
)

Checks that m0_cob_fid directory is empty.

Return values
0Directory is empty.
-ENOTEMPTYDirectory isn not empty.
-ENOMEMMemory allocation error.

Definition at line 348 of file mdstore.c.

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

◆ m0_mdstore_dir_nlink_update()

M0_INTERNAL int m0_mdstore_dir_nlink_update ( struct m0_mdstore md,
struct m0_fid fid,
int  inc,
struct m0_be_tx tx 
)

Directories cannot have hardlinks, so they can always be found by oikey(fid, 0):

Definition at line 167 of file mdstore.c.

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

◆ m0_mdstore_dir_nlink_update_credit()

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

Definition at line 161 of file mdstore.c.

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

◆ mdstore_fini()

static void mdstore_fini ( struct m0_mdstore md,
bool  pre_destroy 
)
static

Definition at line 117 of file mdstore.c.

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