22 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_IOSERVICE 121 "state=%d type=%d, %"PRIu64,
157 dev->isd_cid == cid);
166 dev->isd_domain ==
dom);
201 M0_ERR_INFO(-ENOMEM,
"Unable to duplicate sd_filename %s for " 324 rc = m0_conf_sdev_get(
confc, &sdev_fid, &conf_sdev) ?:
329 if (conf_sdev !=
NULL)
363 rc = m0_conf_sdev_get(
confc, &sdev_fid, &conf_sdev);
388 unsigned long long cid = (
unsigned long long)dev->
isd_cid;
390 char *cfg_init =
NULL;
406 rc = snprintf(
location, len + 1,
"linuxstob:%s",
413 len = snprintf(
NULL, 0,
"adstob:%llu", cid);
417 rc = snprintf(
location, len + 1,
"adstob:%llu", cid);
423 if (cfg ==
NULL || cfg_init ==
NULL) {
435 if (force &&
rc == 0) {
440 if (force ||
rc != 0)
459 storage_dev_tlink_del_fini(dev);
479 const char *path_orig,
491 const char *path = fi_no_dev ?
NULL : path_orig;
502 if (path_orig !=
NULL) {
541 }
else if (conf_sdev !=
NULL) {
587 size, conf_sdev, force, dev));
641 "state=%d type=%d, %"PRIu64,
648 storage_dev_tlink_init_at_tail(dev, &devs->
sds_devices);
664 "state=%d type=%d, %"PRIu64,
691 #ifdef __SPARE_SPACE__ 693 balloc->
cb_sb.bsb_freespare,
705 rc = fstatfs(
fd, &st);
715 .sds_block_size = st.f_bsize,
716 .sds_avail_blocks = st.f_bfree,
717 .sds_total_size = st.f_blocks * st.f_bsize
855 "state=%d type=%d, %"PRIu64,
896 "state=%d type=%d, %"PRIu64,
928 "state=%d type=%d, %"PRIu64,
940 #undef M0_TRACE_SUBSYSTEM
M0_TL_DEFINE(storage_dev, M0_INTERNAL, struct m0_storage_dev)
M0_INTERNAL struct m0_stob_domain * m0_stob_dom_get(struct m0_stob *stob)
M0_INTERNAL struct m0_storage_dev * m0_storage_devs_find_by_cid(struct m0_storage_devs *devs, uint64_t cid)
struct m0_be_domain * bs_domain
static int stob_domain_create_or_init(struct m0_storage_dev *dev, struct m0_storage_devs *devs, m0_bcount_t size, bool force)
static struct m0_semaphore wait
struct m0_parallel_pool sds_pool
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
m0_bcount_t bsb_freeblocks
M0_INTERNAL void m0_chan_broadcast_lock(struct m0_chan *chan)
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
struct m0_stob * isd_stob
M0_INTERNAL int m0_stob_locate(struct m0_stob *stob)
m0_bcount_t sds_free_blocks
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_attach(struct m0_storage_dev *dev, struct m0_storage_devs *devs)
M0_INTERNAL void m0_storage_dev_stob_put(struct m0_storage_devs *devs, struct m0_stob *stob)
struct m0_chan rh_conf_cache_ready_async
M0_INTERNAL struct m0_conf_obj * m0_conf_cache_lookup(const struct m0_conf_cache *cache, const struct m0_fid *id)
#define M0_LOG(level,...)
const struct m0_conf_obj_type * m0_conf_fid_type(const struct m0_fid *fid)
M0_INTERNAL void m0_storage_dev_get(struct m0_storage_dev *dev)
M0_INTERNAL int m0_stob_domain_destroy(struct m0_stob_domain *dom)
m0_bcount_t bsb_totalsize
struct m0_stob_domain * isd_domain
static bool storage_devs_conf_expired_cb(struct m0_clink *link)
const struct m0_conf_obj_type M0_CONF_SDEV_TYPE
#define M0_MEMBER(ptr, member)
enum m0_ha_obj_state isd_ha_state
struct m0_semaphore sdw_sem
#define M0_PARALLEL_FOR(name, pool, list, process)
static void dev_filename_update(struct m0_storage_dev *dev, const struct m0_conf_obj *obj)
M0_INTERNAL bool m0_clink_is_armed(const struct m0_clink *link)
static bool storage_devs_conf_ready_async_cb(struct m0_clink *link)
M0_INTERNAL bool m0_fid_validate_linuxstob(const struct m0_stob_id *stob_id)
static bool storage_devs_detached_cb(struct m0_clink *clink)
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
struct m0_stob_domain * sds_back_domain
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
M0_INTERNAL void m0_stob_ad_init_cfg_make(char **str, struct m0_be_domain *dom)
M0_INTERNAL void m0_storage_devs_use_directio(struct m0_storage_devs *devs, bool directio)
static struct m0_pools_common pc
enum m0_storage_dev_type sds_type
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)
#define M0_ASSERT_EX(cond)
M0_INTERNAL void m0_parallel_pool_fini(struct m0_parallel_pool *pool)
static int sdev_stob_fsync(void *psdev)
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_INTERNAL int m0_stob_domain_create(const char *location, const char *str_cfg_init, uint64_t dom_key, const char *str_cfg_create, struct m0_stob_domain **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 void m0_ref_put(struct m0_ref *ref)
#define M0_ERR_INFO(rc, fmt,...)
void m0_ref_init(struct m0_ref *ref, int init_num, void(*release)(struct m0_ref *ref))
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_ref_get(struct m0_ref *ref)
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
#define M0_AMB(obj, ptr, field)
M0_INTERNAL const struct m0_stob_id * m0_stob_id_get(struct m0_stob *stob)
M0_INTERNAL void m0_storage_devs_lock(struct m0_storage_devs *devs)
enum m0_stob_state so_state
static struct m0_stob * stob
M0_INTERNAL void m0_chan_init(struct m0_chan *chan, struct m0_mutex *ch_guard)
static void stob_put(void)
struct m0_clink isd_clink
static struct m0_confc * confc
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
M0_INTERNAL void m0_storage_dev_clink_add(struct m0_clink *link, struct m0_chan *chan)
static struct m0_be_seg * be_seg
M0_INTERNAL int m0_storage_dev_stob_destroy(struct m0_storage_devs *devs, struct m0_stob *stob, struct m0_dtx *dtx)
static void storage_devs_conf_refresh(struct m0_storage_devs *storage_devs, struct m0_reqh *reqh)
struct m0_conf_obj * m0_conf_obj_grandparent(const struct m0_conf_obj *obj)
enum m0_ha_obj_state co_ha_state
static struct m0_stob_domain * dom
M0_INTERNAL void m0_stob_id_make(uint64_t container, uint64_t key, const struct m0_fid *dom_id, struct m0_stob_id *stob_id)
struct m0_conf_cache cc_cache
struct m0_mutex isd_detached_lock
M0_INTERNAL int m0_parallel_pool_init(struct m0_parallel_pool *pool, int thread_nr, int qlinks_nr)
M0_INTERNAL int m0_semaphore_init(struct m0_semaphore *semaphore, unsigned value)
void * m0_alloc(size_t size)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
struct m0_chan co_ha_chan
M0_INTERNAL void m0_clink_cleanup(struct m0_clink *link)
enum m0_conf_service_type isd_srv_type
M0_INTERNAL int m0_stob_linux_domain_fd_put(struct m0_stob_domain *dom, int fd)
m0_bcount_t bsb_blocksize
enum m0_conf_service_type cs_type
M0_INTERNAL void m0_storage_devs_fini(struct m0_storage_devs *devs)
#define M0_CONF_CAST(ptr, type)
struct m0_pool_device_to_service * pc_dev2svc
static struct m0_clink clink[RDWR_REQUEST_MAX]
M0_INTERNAL int m0_stob_linux_domain_fd_get(struct m0_stob_domain *dom, int *fd)
struct m0_fid pds_sdev_fid
M0_INTERNAL int m0_storage_dev_format(struct m0_storage_dev *dev, uint64_t cid)
enum m0_storage_dev_type isd_type
M0_INTERNAL struct m0_storage_dev * m0_storage_devs_find_by_dom(struct m0_storage_devs *devs, struct m0_stob_domain *dom)
M0_INTERNAL void m0_parallel_pool_terminate_wait(struct m0_parallel_pool *pool)
M0_INTERNAL void m0_storage_devs_detach_all(struct m0_storage_devs *devs)
M0_INTERNAL void m0_conf_obj_get_lock(struct m0_conf_obj *obj)
struct m0_be_seg * sds_be_seg
static void storage_dev_release(struct m0_ref *ref)
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_stob_domain_fini(struct m0_stob_domain *dom)
struct m0_clink sds_conf_exp
M0_INTERNAL int m0_conf_device_cid_to_fid(struct m0_confc *confc, uint64_t cid, struct m0_fid *fid)
M0_INTERNAL void m0_storage_dev_destroy(struct m0_storage_dev *dev)
M0_INTERNAL int m0_stob_create(struct m0_stob *stob, struct m0_dtx *dtx, const char *str_cfg)
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
M0_INTERNAL int m0_stob_destroy(struct m0_stob *stob, struct m0_dtx *dtx)
M0_INTERNAL int64_t m0_ref_read(const struct m0_ref *ref)
M0_INTERNAL enum m0_stob_state m0_stob_state_get(struct m0_stob *stob)
M0_INTERNAL void m0_storage_devs_locks_disable(struct m0_storage_devs *devs)
M0_INTERNAL int m0_stob_domain_init(const char *location, const char *str_cfg_init, struct m0_stob_domain **out)
static struct m0_chan chan[RDWR_REQUEST_MAX]
M0_INTERNAL void m0_storage_dev_detach(struct m0_storage_dev *dev)
#define M0_FI_ENABLED(tag)
M0_INTERNAL void m0_storage_dev_space(struct m0_storage_dev *dev, struct m0_storage_space *space)
struct m0_chan rh_conf_cache_exp
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL int m0_storage_dev_stob_create(struct m0_storage_devs *devs, struct m0_stob_id *sid, struct m0_dtx *dtx)
M0_INTERNAL void m0_semaphore_fini(struct m0_semaphore *semaphore)
M0_INTERNAL int m0_stob_fd(struct m0_stob *stob)
struct m0_clink sdw_clink
struct m0_conf_obj sd_obj
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
struct m0_pools_common * rh_pools
M0_INTERNAL struct m0_balloc * m0_stob_ad_domain2balloc(const struct m0_stob_domain *dom)
static int storage_dev_update_by_conf(struct m0_storage_dev *dev, struct m0_conf_sdev *sdev, struct m0_storage_devs *storage_devs)
struct m0_chan isd_detached_chan
M0_INTERNAL bool m0_stob_linux_domain_directio(struct m0_stob_domain *dom)
struct m0t1fs_filedata * fd
M0_INTERNAL void m0_storage_devs_unlock(struct m0_storage_devs *devs)
M0_INTERNAL int m0_stob_find(const struct m0_stob_id *id, struct m0_stob **out)
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
M0_INTERNAL void m0_storage_dev_put(struct m0_storage_dev *dev)
struct m0_balloc_super_block cb_sb
#define M0_ASSERT_INFO(cond, fmt,...)
M0_INTERNAL void m0_semaphore_down(struct m0_semaphore *semaphore)
M0_INTERNAL void m0_stob_ad_cfg_make(char **str, const struct m0_be_seg *seg, const struct m0_stob_id *bstore_id, const m0_bcount_t size)
M0_INTERNAL void m0_semaphore_up(struct m0_semaphore *semaphore)
M0_INTERNAL void m0_storage_dev_clink_del(struct m0_clink *link)
#define m0_tl_find(name, var, head,...)
M0_INTERNAL void m0_stob_linux_conf_sdev_associate(struct m0_stob *stob, const struct m0_fid *conf_sdev)
static bool storage_dev_state_update_cb(struct m0_clink *link)
#define m0_tl_for(name, head, obj)
M0_INTERNAL void m0_chan_fini_lock(struct m0_chan *chan)
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_devs_fdatasync(struct m0_storage_devs *sdevs)
M0_INTERNAL bool m0_conf_obj_invariant(const struct m0_conf_obj *obj)
struct m0_clink sds_conf_ready_async
M0_INTERNAL void m0_stob_put(struct m0_stob *stob)
#define M0_IMPOSSIBLE(fmt,...)
static bool storage_devs_is_locked(const struct m0_storage_devs *devs)