Motr  M0
m0hsm_api.h File Reference
#include <stdio.h>
#include <stdint.h>
#include "motr/client.h"
Include dependency graph for m0hsm_api.h:

Go to the source code of this file.

Data Structures

struct  m0hsm_options
 

Macros

#define __MOTR_HSM_M0HSM_API_H__
 
#define HSM_TIER_MAX   (UINT8_MAX - 1)
 

Enumerations

enum  hsm_log_level {
  LOG_NONE = 0, LOG_ERROR, LOG_INFO, LOG_VERB,
  LOG_DEBUG
}
 
enum  { MAX_M0_BUFSZ = 128*1024*1024 }
 
enum  hsm_cp_flags { HSM_MOVE = (1 << 0), HSM_KEEP_OLD_VERS = (1 << 1), HSM_WRITE_TO_DEST = (1 << 2) }
 
enum  hsm_rls_flags { HSM_KEEP_LATEST = (1 << 0) }
 

Functions

int m0hsm_init (struct m0_client *instance, struct m0_realm *uber_realm, const struct m0hsm_options *options)
 
int m0hsm_create (struct m0_uint128 id, struct m0_obj *obj, uint8_t tier_idx, bool keep_open)
 
int m0hsm_pwrite (struct m0_obj *obj, void *buf, size_t len, off_t off)
 
int m0hsm_set_write_tier (struct m0_uint128 id, uint8_t tier_idx)
 
int m0hsm_copy (struct m0_uint128 obj_id, uint8_t src_tier_idx, uint8_t tgt_tier_idx, off_t offset, size_t length, enum hsm_cp_flags flags)
 
int m0hsm_release (struct m0_uint128 obj_id, uint8_t tier_idx, off_t offset, size_t length, enum hsm_rls_flags flags)
 
int m0hsm_stage (struct m0_uint128 obj_id, uint8_t target_tier, off_t offset, size_t length, enum hsm_cp_flags flags)
 
int m0hsm_archive (struct m0_uint128 obj_id, uint8_t target_tier, off_t offset, size_t length, enum hsm_cp_flags flags)
 
int m0hsm_multi_release (struct m0_uint128 obj_id, uint8_t max_tier, off_t offset, size_t length, enum hsm_rls_flags flags)
 
int m0hsm_dump (FILE *stream, struct m0_uint128 id, bool details)
 

Macro Definition Documentation

◆ __MOTR_HSM_M0HSM_API_H__

#define __MOTR_HSM_M0HSM_API_H__

Definition at line 28 of file m0hsm_api.h.

◆ HSM_TIER_MAX

#define HSM_TIER_MAX   (UINT8_MAX - 1)

Max allowed tier index (UINT8_MAX is reserved for internal use)

Definition at line 65 of file m0hsm_api.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Max Object Store I/O buffer size

Enumerator
MAX_M0_BUFSZ 

Definition at line 62 of file m0hsm_api.h.

◆ hsm_cp_flags

copy options

Enumerator
HSM_MOVE 

Remove source extent after copy (default: leave it on the source tier)

HSM_KEEP_OLD_VERS 

Preserve previous versions of copied extent on the target tier (default: only keep the latest version).

HSM_WRITE_TO_DEST 

Indicate the target tier becomes the preferred tier for next write operations. For example, when data needs fast write access after staging. Or to direct next writes to a slower tier after archiving. Default is to keep writing in the current tier.

Definition at line 111 of file m0hsm_api.h.

◆ hsm_log_level

level of HSM traces

Enumerator
LOG_NONE 
LOG_ERROR 
LOG_INFO 
LOG_VERB 
LOG_DEBUG 

Definition at line 42 of file m0hsm_api.h.

◆ hsm_rls_flags

release options

Enumerator
HSM_KEEP_LATEST 

Release all data versions in the given tier except the freshest version. This makes it possible to free disk space from old data versions in the use-case of versioning (e.g. copy made with 'HSM_KEEP_OLD_VERS' flag).

Definition at line 146 of file m0hsm_api.h.

Function Documentation

◆ m0hsm_archive()

int m0hsm_archive ( struct m0_uint128  obj_id,
uint8_t  target_tier,
off_t  offset,
size_t  length,
enum hsm_cp_flags  flags 
)

Request to archive data to a slower tier.

Parameters
obj_idId of the object to be archived.
targer_tierTarget tier index (0 is the top tier).
offsetStart offset of the region to be staged.
lengthSize of the region to be staged.
flagsSet of OR'ed hsm_cp_flags.

Definition at line 2831 of file m0hsm_api.c.

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

◆ m0hsm_copy()

int m0hsm_copy ( struct m0_uint128  obj_id,
uint8_t  src_tier_idx,
uint8_t  tgt_tier_idx,
off_t  offset,
size_t  length,
enum hsm_cp_flags  flags 
)

Copy a region of an object from one tier to another. This is transparent to applications if they use the I/O calls defined above (m0hsm_create/pread/pwrite).

Parameters
obj_idId of the object to be copied.
src_tier_idxSource tier index (0 is the top tier).
tgt_tier_idxTarget tier index (0 is the top tier).
offsetStart offset of the region to be copied.
lengthSize of the region to be copied.
flagsSet of OR'ed hsm_cp_flags.

Definition at line 2715 of file m0hsm_api.c.

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

◆ m0hsm_create()

int m0hsm_create ( struct m0_uint128  id,
struct m0_obj obj,
uint8_t  tier_idx,
bool  keep_open 
)

Create an object to be managed by HSM.

Parameters
idIdentifier of the object to be created.
objPointer to the created object.
tier_idxIndex of the target tier (0 is the top tier).
keep_openKeep the object entity opened.

Definition at line 1571 of file m0hsm_api.c.

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

◆ m0hsm_dump()

int m0hsm_dump ( FILE *  stream,
struct m0_uint128  id,
bool  details 
)

Dump HSM information about a composite object.

Parameters
streamFILE* to write information to.
idIdentifier of the object to dump.
detailsIf true dump all details, else print brief output.

Definition at line 875 of file m0hsm_api.c.

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

◆ m0hsm_init()

int m0hsm_init ( struct m0_client instance,
struct m0_realm uber_realm,
const struct m0hsm_options options 
)

Initialize HSM API.

Parameters
optionsHSM options. NULL to keep defaults.

Definition at line 166 of file m0hsm_api.c.

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

◆ m0hsm_multi_release()

int m0hsm_multi_release ( struct m0_uint128  obj_id,
uint8_t  max_tier,
off_t  offset,
size_t  length,
enum hsm_rls_flags  flags 
)

Release a region of an object from multiple tiers. All data in tiers up to max_tier are released.

Parameters
obj_idId of the object to be archived.
targer_tierTarget tier index (0 is the top tier).
offsetStart offset of the region to be staged.
lengthSize of the region to be staged.
flagsSet of OR'ed hsm_rls_flags.

Definition at line 2499 of file m0hsm_api.c.

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

◆ m0hsm_pwrite()

int m0hsm_pwrite ( struct m0_obj obj,
void *  buf,
size_t  len,
off_t  off 
)

[WORKAROUND CALL] This call fixes a miss in composite layout management i.e. create a associated read extent when a data is written.

Write data to an object. Object's entity must be opened prior to calling this. offset and length must respect usual m0 requirements of alignment (PAGE_SIZE minimum).

Parameters
objObject to write data to.
iovData buffer.
offStart offset.

Definition at line 1968 of file m0hsm_api.c.

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

◆ m0hsm_release()

int m0hsm_release ( struct m0_uint128  obj_id,
uint8_t  tier_idx,
off_t  offset,
size_t  length,
enum hsm_rls_flags  flags 
)

Release a region of an object from the given tier.

Parameters
obj_idId of the object to be released.
tier_idxTier to drop the data from.
offsetStart offset of the region to be released.
lengthSize of the region to be released.
flagsSet of OR'ed hsm_rls_flags.

Definition at line 2493 of file m0hsm_api.c.

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

◆ m0hsm_set_write_tier()

int m0hsm_set_write_tier ( struct m0_uint128  id,
uint8_t  tier_idx 
)

Selects the target tier for next write operations. This does not move existing data.

Parameters
objObject for which we want to change the write tier.

Definition at line 1224 of file m0hsm_api.c.

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

◆ m0hsm_stage()

int m0hsm_stage ( struct m0_uint128  obj_id,
uint8_t  target_tier,
off_t  offset,
size_t  length,
enum hsm_cp_flags  flags 
)

Request to stage data to a faster tier.

Parameters
obj_idId of the object to be staged.
targer_tierTarget tier index (0 is the top tier).
offsetStart offset of the region to be staged.
lengthSize of the region to be staged.
flagsHSM_WRITE_TO_DEST if next write operations should also be directed to the same fast tier (intensive writes expected).

Definition at line 2773 of file m0hsm_api.c.

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