Motr  M0
Storage devices.

Data Structures

struct  storage_devs_wait
 
struct  m0_storage_dev
 
struct  m0_storage_devs
 
struct  m0_storage_space
 

Enumerations

enum  m0_storage_dev_type { M0_STORAGE_DEV_TYPE_LINUX = 1, M0_STORAGE_DEV_TYPE_AD }
 

Functions

 M0_TL_DESCR_DEFINE (storage_dev, "storage_dev", M0_INTERNAL, struct m0_storage_dev, isd_linkage, isd_magic, M0_STORAGE_DEV_MAGIC, M0_STORAGE_DEV_HEAD_MAGIC)
 
 M0_TL_DEFINE (storage_dev, M0_INTERNAL, struct m0_storage_dev)
 
static bool storage_dev_state_update_cb (struct m0_clink *link)
 
static bool storage_devs_conf_expired_cb (struct m0_clink *link)
 
static bool storage_devs_conf_ready_async_cb (struct m0_clink *link)
 
static bool storage_devs_is_locked (const struct m0_storage_devs *devs)
 
M0_INTERNAL void m0_storage_devs_lock (struct m0_storage_devs *devs)
 
M0_INTERNAL void m0_storage_devs_unlock (struct m0_storage_devs *devs)
 
M0_INTERNAL int m0_storage_devs_init (struct m0_storage_devs *devs, enum m0_storage_dev_type type, struct m0_be_seg *be_seg, struct m0_stob_domain *bstore_dom, struct m0_reqh *reqh)
 
M0_INTERNAL void m0_storage_devs_fini (struct m0_storage_devs *devs)
 
M0_INTERNAL void m0_storage_devs_use_directio (struct m0_storage_devs *devs, bool directio)
 
M0_INTERNAL void m0_storage_devs_locks_disable (struct m0_storage_devs *devs)
 
M0_INTERNAL struct m0_storage_devm0_storage_devs_find_by_cid (struct m0_storage_devs *devs, uint64_t cid)
 
M0_INTERNAL struct m0_storage_devm0_storage_devs_find_by_dom (struct m0_storage_devs *devs, struct m0_stob_domain *dom)
 
M0_INTERNAL void m0_storage_dev_clink_add (struct m0_clink *link, struct m0_chan *chan)
 
M0_INTERNAL void m0_storage_dev_clink_del (struct m0_clink *link)
 
static void dev_filename_update (struct m0_storage_dev *dev, const struct m0_conf_obj *obj)
 
static int storage_dev_update_by_conf (struct m0_storage_dev *dev, struct m0_conf_sdev *sdev, struct m0_storage_devs *storage_devs)
 
static void storage_devs_conf_refresh (struct m0_storage_devs *storage_devs, struct m0_reqh *reqh)
 
static int stob_domain_create_or_init (struct m0_storage_dev *dev, struct m0_storage_devs *devs, m0_bcount_t size, bool force)
 
static void storage_dev_release (struct m0_ref *ref)
 
M0_INTERNAL void m0_storage_dev_get (struct m0_storage_dev *dev)
 
M0_INTERNAL void m0_storage_dev_put (struct m0_storage_dev *dev)
 
static int storage_dev_new (struct m0_storage_devs *devs, uint64_t cid, bool fi_no_dev, const char *path_orig, uint64_t size, struct m0_conf_sdev *conf_sdev, bool force, struct m0_storage_dev **out)
 
M0_INTERNAL int m0_storage_dev_new (struct m0_storage_devs *devs, uint64_t cid, const char *path, uint64_t size, struct m0_conf_sdev *conf_sdev, bool force, struct m0_storage_dev **dev)
 
M0_INTERNAL int m0_storage_dev_new_by_conf (struct m0_storage_devs *devs, struct m0_conf_sdev *sdev, bool force, struct m0_storage_dev **dev)
 
M0_INTERNAL void m0_storage_dev_destroy (struct m0_storage_dev *dev)
 
M0_INTERNAL void m0_storage_dev_attach (struct m0_storage_dev *dev, struct m0_storage_devs *devs)
 
M0_INTERNAL void m0_storage_dev_detach (struct m0_storage_dev *dev)
 
M0_INTERNAL void m0_storage_dev_space (struct m0_storage_dev *dev, struct m0_storage_space *space)
 
static bool storage_devs_detached_cb (struct m0_clink *clink)
 
M0_INTERNAL void m0_storage_devs_detach_all (struct m0_storage_devs *devs)
 
M0_INTERNAL int m0_storage_dev_format (struct m0_storage_dev *dev, uint64_t cid)
 
static int sdev_stob_fsync (void *psdev)
 
M0_INTERNAL int m0_storage_devs_fdatasync (struct m0_storage_devs *sdevs)
 
M0_INTERNAL int m0_storage_dev_stob_create (struct m0_storage_devs *devs, struct m0_stob_id *sid, struct m0_dtx *dtx)
 
M0_INTERNAL int m0_storage_dev_stob_destroy (struct m0_storage_devs *devs, struct m0_stob *stob, struct m0_dtx *dtx)
 
M0_INTERNAL int m0_storage_dev_stob_find (struct m0_storage_devs *devs, struct m0_stob_id *sid, struct m0_stob **stob)
 
M0_INTERNAL void m0_storage_dev_stob_put (struct m0_storage_devs *devs, struct m0_stob *stob)
 
 M0_TL_DESCR_DECLARE (storage_dev, M0_EXTERN)
 
 M0_TL_DECLARE (storage_dev, M0_EXTERN, struct m0_storage_dev)
 

Detailed Description

This module provides functionality to work with storage devices used by IO service. It is intended to be used to attach/detach storage devices dynamically and query them for some information (i.e. used/free space).

Backing store domain and BE segment for storage devices are provided by user.

Structure m0_storage_devs contains list of storage devices used by IO service and intended to be the one and only place to hold such a list for IO service.

Functions provided by this module do not take any locks internally. User should lock m0_storage_devs structure on demand using m0_storage_devs_lock(), m0_storage_devs_unlock() functions.

Enumeration Type Documentation

◆ m0_storage_dev_type

Enumerator
M0_STORAGE_DEV_TYPE_LINUX 
M0_STORAGE_DEV_TYPE_AD 

Definition at line 65 of file storage_dev.h.

Function Documentation

◆ dev_filename_update()

static void dev_filename_update ( struct m0_storage_dev dev,
const struct m0_conf_obj obj 
)
static

Definition at line 193 of file storage_dev.c.

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

◆ m0_storage_dev_attach()

M0_INTERNAL void m0_storage_dev_attach ( struct m0_storage_dev dev,
struct m0_storage_devs devs 
)

Attaches storage device to the devs list.

Precondition
storage_devs_is_locked(devs)

Definition at line 633 of file storage_dev.c.

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

◆ m0_storage_dev_clink_add()

M0_INTERNAL void m0_storage_dev_clink_add ( struct m0_clink link,
struct m0_chan chan 
)

Definition at line 169 of file storage_dev.c.

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

◆ m0_storage_dev_clink_del()

M0_INTERNAL void m0_storage_dev_clink_del ( struct m0_clink link)

Definition at line 176 of file storage_dev.c.

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

◆ m0_storage_dev_destroy()

M0_INTERNAL void m0_storage_dev_destroy ( struct m0_storage_dev dev)

Destroys storage device object.

Finalises (but doesn't destroy) the underlying stob domain.

Definition at line 603 of file storage_dev.c.

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

◆ m0_storage_dev_detach()

M0_INTERNAL void m0_storage_dev_detach ( struct m0_storage_dev dev)

Detaches storage device.

In fact, this function releases a reference to the storage device which is detached when all references are released. On detach the storage device is destroyed implicitly. m0_storage_devs structure which contains the storage device must be locked.

Definition at line 652 of file storage_dev.c.

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

◆ m0_storage_dev_format()

M0_INTERNAL int m0_storage_dev_format ( struct m0_storage_dev dev,
uint64_t  cid 
)

Formats storage device.

Not implemented yet.

Definition at line 767 of file storage_dev.c.

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

◆ m0_storage_dev_get()

M0_INTERNAL void m0_storage_dev_get ( struct m0_storage_dev dev)

Obtains reference to the storage device.

Definition at line 466 of file storage_dev.c.

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

◆ m0_storage_dev_new()

M0_INTERNAL int m0_storage_dev_new ( struct m0_storage_devs devs,
uint64_t  cid,
const char *  path,
uint64_t  size,
struct m0_conf_sdev sdev,
bool  force,
struct m0_storage_dev **  dev 
)

Allocates and initialises new storage device.

Creates backing store stob in domain provided in m0_storage_devs_init. Also creates AD stob domain for storage device.

Definition at line 576 of file storage_dev.c.

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

◆ m0_storage_dev_new_by_conf()

M0_INTERNAL int m0_storage_dev_new_by_conf ( struct m0_storage_devs devs,
struct m0_conf_sdev sdev,
bool  force,
struct m0_storage_dev **  dev 
)

Initialises device using information from configuration object.

Extracts device parameters and executes m0_storage_dev_new.

Definition at line 590 of file storage_dev.c.

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

◆ m0_storage_dev_put()

M0_INTERNAL void m0_storage_dev_put ( struct m0_storage_dev dev)

Releases reference to the storage device.

m0_storage_devs structure which contains the storage device must be locked, because this function can lead to execution of device detach.

Definition at line 471 of file storage_dev.c.

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

◆ m0_storage_dev_space()

M0_INTERNAL void m0_storage_dev_space ( struct m0_storage_dev dev,
struct m0_storage_space space 
)

Obtains information about free space of the device.

Definition at line 674 of file storage_dev.c.

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

◆ m0_storage_dev_stob_create()

M0_INTERNAL int m0_storage_dev_stob_create ( struct m0_storage_devs devs,
struct m0_stob_id sid,
struct m0_dtx dtx 
)

Creates a stob if it doesn't exist.

This function is synchronised with possible storage device detach operation.

Definition at line 810 of file storage_dev.c.

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

◆ m0_storage_dev_stob_destroy()

M0_INTERNAL int m0_storage_dev_stob_destroy ( struct m0_storage_devs devs,
struct m0_stob stob,
struct m0_dtx dtx 
)

Destroys stob and releases reference to the respective storage device.

Definition at line 836 of file storage_dev.c.

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

◆ m0_storage_dev_stob_find()

M0_INTERNAL int m0_storage_dev_stob_find ( struct m0_storage_devs devs,
struct m0_stob_id sid,
struct m0_stob **  stob 
)

Finds and locates a stob which belongs to a storage device from the devs. On success acquires reference to the stob and respective storage device.

Note
CSS_NOENT is a valid state of the resulting stob.

Definition at line 868 of file storage_dev.c.

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

◆ m0_storage_dev_stob_put()

M0_INTERNAL void m0_storage_dev_stob_put ( struct m0_storage_devs devs,
struct m0_stob stob 
)

Releases reference to the stob and respective storage device.

Definition at line 912 of file storage_dev.c.

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

◆ m0_storage_devs_detach_all()

M0_INTERNAL void m0_storage_devs_detach_all ( struct m0_storage_devs devs)

Synchronously detaches all storage devices.

Definition at line 743 of file storage_dev.c.

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

◆ m0_storage_devs_fdatasync()

M0_INTERNAL int m0_storage_devs_fdatasync ( struct m0_storage_devs devs)

Does fdatasync on all stobs in storage devices.

Definition at line 802 of file storage_dev.c.

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

◆ m0_storage_devs_find_by_cid()

M0_INTERNAL struct m0_storage_dev * m0_storage_devs_find_by_cid ( struct m0_storage_devs devs,
uint64_t  cid 
)

Finds storage device by its cid.

Definition at line 152 of file storage_dev.c.

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

◆ m0_storage_devs_find_by_dom()

M0_INTERNAL struct m0_storage_dev * m0_storage_devs_find_by_dom ( struct m0_storage_devs devs,
struct m0_stob_domain dom 
)

Finds storage device by its AD stob domain.

Definition at line 161 of file storage_dev.c.

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

◆ m0_storage_devs_fini()

M0_INTERNAL void m0_storage_devs_fini ( struct m0_storage_devs devs)

Finalises storage devices structure.

Definition at line 107 of file storage_dev.c.

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

◆ m0_storage_devs_init()

M0_INTERNAL int m0_storage_devs_init ( struct m0_storage_devs devs,
enum m0_storage_dev_type  type,
struct m0_be_seg be_seg,
struct m0_stob_domain bstore_dom,
struct m0_reqh reqh 
)

Initialises storage devices structure.

Backing store domain should be already created and initialised.

Definition at line 83 of file storage_dev.c.

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

◆ m0_storage_devs_lock()

M0_INTERNAL void m0_storage_devs_lock ( struct m0_storage_devs devs)

Locks storage devices structure.

Definition at line 71 of file storage_dev.c.

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

◆ m0_storage_devs_locks_disable()

M0_INTERNAL void m0_storage_devs_locks_disable ( struct m0_storage_devs devs)

Disable sdev locks. Use case: 1+0+0 configuration.

Definition at line 145 of file storage_dev.c.

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

◆ m0_storage_devs_unlock()

M0_INTERNAL void m0_storage_devs_unlock ( struct m0_storage_devs devs)

Unlocks storage devices structure.

Definition at line 77 of file storage_dev.c.

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

◆ m0_storage_devs_use_directio()

M0_INTERNAL void m0_storage_devs_use_directio ( struct m0_storage_devs devs,
bool  directio 
)

Enables or disables direct I/O for linuxstobs.

Precondition
storage_dev_tlist_is_empty(&devs->sds_devices)

Definition at line 134 of file storage_dev.c.

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

◆ M0_TL_DECLARE()

M0_TL_DECLARE ( storage_dev  ,
M0_EXTERN  ,
struct m0_storage_dev   
)

◆ M0_TL_DEFINE()

M0_TL_DEFINE ( storage_dev  ,
M0_INTERNAL  ,
struct m0_storage_dev   
)

◆ M0_TL_DESCR_DECLARE()

M0_TL_DESCR_DECLARE ( storage_dev  ,
M0_EXTERN   
)

◆ M0_TL_DESCR_DEFINE()

M0_TL_DESCR_DEFINE ( storage_dev  ,
"storage_dev"  ,
M0_INTERNAL  ,
struct m0_storage_dev  ,
isd_linkage  ,
isd_magic  ,
M0_STORAGE_DEV_MAGIC  ,
M0_STORAGE_DEV_HEAD_MAGIC   
)

tlist descriptor for list of m0_storage_dev objects placed in m0_storage_devs::sds_devices list using isd_linkage.

◆ sdev_stob_fsync()

static int sdev_stob_fsync ( void *  psdev)
static

Definition at line 776 of file storage_dev.c.

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

◆ stob_domain_create_or_init()

static int stob_domain_create_or_init ( struct m0_storage_dev dev,
struct m0_storage_devs devs,
m0_bcount_t  size,
bool  force 
)
static

Definition at line 382 of file storage_dev.c.

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

◆ storage_dev_new()

static int storage_dev_new ( struct m0_storage_devs devs,
uint64_t  cid,
bool  fi_no_dev,
const char *  path_orig,
uint64_t  size,
struct m0_conf_sdev conf_sdev,
bool  force,
struct m0_storage_dev **  out 
)
static

Definition at line 476 of file storage_dev.c.

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

◆ storage_dev_release()

static void storage_dev_release ( struct m0_ref ref)
static

Definition at line 452 of file storage_dev.c.

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

◆ storage_dev_state_update_cb()

static bool storage_dev_state_update_cb ( struct m0_clink link)
static

Definition at line 182 of file storage_dev.c.

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

◆ storage_dev_update_by_conf()

static int storage_dev_update_by_conf ( struct m0_storage_dev dev,
struct m0_conf_sdev sdev,
struct m0_storage_devs storage_devs 
)
static

Definition at line 277 of file storage_dev.c.

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

◆ storage_devs_conf_expired_cb()

static bool storage_devs_conf_expired_cb ( struct m0_clink link)
static

Definition at line 207 of file storage_dev.c.

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

◆ storage_devs_conf_ready_async_cb()

static bool storage_devs_conf_ready_async_cb ( struct m0_clink link)
static

Definition at line 335 of file storage_dev.c.

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

◆ storage_devs_conf_refresh()

static void storage_devs_conf_refresh ( struct m0_storage_devs storage_devs,
struct m0_reqh reqh 
)
static

Definition at line 303 of file storage_dev.c.

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

◆ storage_devs_detached_cb()

static bool storage_devs_detached_cb ( struct m0_clink clink)
static

Definition at line 734 of file storage_dev.c.

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

◆ storage_devs_is_locked()

static bool storage_devs_is_locked ( const struct m0_storage_devs devs)
static

Definition at line 66 of file storage_dev.c.

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