IOR
Data Structures | Macros | Enumerations | Functions | Variables
aiori-DFS.c File Reference
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <libgen.h>
#include <gurt/common.h>
#include <gurt/hash.h>
#include <daos.h>
#include <daos_fs.h>
#include "ior.h"
#include "iordef.h"
#include "aiori.h"
#include "utilities.h"
Include dependency graph for aiori-DFS.c:

Go to the source code of this file.

Data Structures

struct  aiori_dir_hdl
 
struct  dfs_options
 

Macros

#define _BSD_SOURCE
 
#define DCHECK(rc, format, ...)
 
#define INFO(level, format, ...)
 
#define GERR(format, ...)
 

Enumerations

enum  handleType {
  POOL_HANDLE, CONT_HANDLE, ARRAY_HANDLE, POOL_HANDLE,
  CONT_HANDLE, DFS_HANDLE
}
 

Functions

static void * DFS_Create (char *, IOR_param_t *)
 
static void * DFS_Open (char *, IOR_param_t *)
 
static IOR_offset_t DFS_Xfer (int, void *, IOR_size_t *, IOR_offset_t, IOR_param_t *)
 
static void DFS_Close (void *, IOR_param_t *)
 
static void DFS_Delete (char *, IOR_param_t *)
 
static char * DFS_GetVersion ()
 
static void DFS_Fsync (void *, IOR_param_t *)
 
static void DFS_Sync (IOR_param_t *)
 
static IOR_offset_t DFS_GetFileSize (IOR_param_t *, MPI_Comm, char *)
 
static int DFS_Statfs (const char *, ior_aiori_statfs_t *, IOR_param_t *)
 
static int DFS_Stat (const char *, struct stat *, IOR_param_t *)
 
static int DFS_Mkdir (const char *, mode_t, IOR_param_t *)
 
static int DFS_Rmdir (const char *, IOR_param_t *)
 
static int DFS_Access (const char *, int, IOR_param_t *)
 
static void DFS_Init ()
 
static void DFS_Finalize ()
 
static option_helpDFS_options ()
 
static struct aiori_dir_hdlhdl_obj (d_list_t *rlink)
 
static bool key_cmp (struct d_hash_table *htable, d_list_t *rlink, const void *key, unsigned int ksize)
 
static void rec_free (struct d_hash_table *htable, d_list_t *rlink)
 
static void HandleDistribute (enum handleType type)
 
static int parse_filename (const char *path, char **_obj_name, char **_cont_name)
 
static dfs_obj_t * lookup_insert_dir (const char *name, mode_t *mode)
 

Variables

dfs_t * dfs
 
static daos_handle_t poh
 
static daos_handle_t coh
 
static daos_oclass_id_t objectClass = OC_SX
 
static daos_oclass_id_t dir_oclass = OC_SX
 
static struct d_hash_table * dir_hash
 
static bool dfs_init
 
static struct dfs_options o
 
static option_help options []
 
ior_aiori_t dfs_aiori
 
static d_hash_table_ops_t hdl_hash_ops
 

Macro Definition Documentation

◆ _BSD_SOURCE

#define _BSD_SOURCE

Definition at line 13 of file aiori-DFS.c.

◆ DCHECK

#define DCHECK (   rc,
  format,
  ... 
)
Value:
do { \
int _rc = (rc); \
\
if (_rc != 0) { \
fprintf(stderr, "ERROR (%s:%d): %d: %d: " \
format"\n", __FILE__, __LINE__, rank, _rc, \
##__VA_ARGS__); \
fflush(stderr); \
exit(-1); \
} \
} while (0)
CURLcode rc
Definition: aiori-S3.c:121
int rank
Definition: utilities.c:57

Definition at line 144 of file aiori-DFS.c.

Referenced by DFS_Create(), DFS_Delete(), DFS_Finalize(), DFS_Init(), DFS_Mkdir(), DFS_Open(), DFS_Rmdir(), DFS_Stat(), HandleDistribute(), and lookup_insert_dir().

◆ GERR

#define GERR (   format,
  ... 
)
Value:
do { \
fprintf(stderr, format"\n", ##__VA_ARGS__); \
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \
} while (0)

Definition at line 163 of file aiori-DFS.c.

Referenced by DFS_Create(), DFS_Delete(), DFS_Init(), DFS_Mkdir(), DFS_Open(), DFS_Rmdir(), DFS_Stat(), and lookup_insert_dir().

◆ INFO

#define INFO (   level,
  format,
  ... 
)
Value:
do { \
if (verbose >= level) \
printf("[%d] "format"\n", rank, ##__VA_ARGS__); \
} while (0)
int verbose
Definition: utilities.c:59
int rank
Definition: utilities.c:57

Definition at line 157 of file aiori-DFS.c.

Referenced by DFS_Finalize(), and DFS_Init().

Enumeration Type Documentation

◆ handleType

enum handleType
Enumerator
POOL_HANDLE 
CONT_HANDLE 
ARRAY_HANDLE 
POOL_HANDLE 
CONT_HANDLE 
DFS_HANDLE 

Definition at line 53 of file aiori-DFS.c.

Function Documentation

◆ DFS_Access()

static int DFS_Access ( const char *  path,
int  mode,
IOR_param_t param 
)
static

just close if it's a file

Definition at line 857 of file aiori-DFS.c.

References lookup_insert_dir(), and NULL.

Here is the call graph for this function:

◆ DFS_Close()

static void DFS_Close ( void *  fd,
IOR_param_t param 
)
static

Definition at line 705 of file aiori-DFS.c.

◆ DFS_Create()

static void * DFS_Create ( char *  testFileName,
IOR_param_t param 
)
static

Definition at line 540 of file aiori-DFS.c.

References dfs_options::chunk_size, DCHECK, dfs, IOR_param_t::filePerProc, GERR, lookup_insert_dir(), IOR_param_t::mode, aiori_dir_hdl::name, NULL, objectClass, parse_filename(), rank, and rc.

Here is the call graph for this function:

◆ DFS_Delete()

static void DFS_Delete ( char *  testFileName,
IOR_param_t param 
)
static

Definition at line 714 of file aiori-DFS.c.

References DCHECK, dfs, GERR, lookup_insert_dir(), aiori_dir_hdl::name, NULL, parse_filename(), and rc.

Here is the call graph for this function:

◆ DFS_Finalize()

static void DFS_Finalize ( )
static

◆ DFS_Fsync()

static void DFS_Fsync ( void *  fd,
IOR_param_t param 
)
static

Definition at line 683 of file aiori-DFS.c.

References dfs.

◆ DFS_GetFileSize()

static IOR_offset_t DFS_GetFileSize ( IOR_param_t test,
MPI_Comm  comm,
char *  testFileName 
)
static

Definition at line 751 of file aiori-DFS.c.

References dfs, IOR_param_t::filePerProc, MPI_CHECK, NULL, rank, rc, TRUE, and WARN.

◆ DFS_GetVersion()

static char * DFS_GetVersion ( )
static

Definition at line 739 of file aiori-DFS.c.

◆ DFS_Init()

static void DFS_Init ( )
static

in case we are already initialized, return

shouldn't be fatal since it can be called with POSIX backend selection

Connect to DAOS pool

Definition at line 387 of file aiori-DFS.c.

References coh, dfs_options::cont, CONT_HANDLE, DCHECK, dfs, DFS_HANDLE, dfs_init, dir_hash, dir_oclass, dfs_options::dir_oclass, ERR, GERR, dfs_options::group, HandleDistribute(), hdl_hash_ops, INFO, NULL, objectClass, dfs_options::oclass, poh, dfs_options::pool, POOL_HANDLE, dfs_options::prefix, rank, rc, dfs_options::svcl, and VERBOSE_1.

Here is the call graph for this function:

◆ DFS_Mkdir()

static int DFS_Mkdir ( const char *  path,
mode_t  mode,
IOR_param_t param 
)
static

Definition at line 800 of file aiori-DFS.c.

References DCHECK, dfs, dir_oclass, GERR, lookup_insert_dir(), aiori_dir_hdl::name, NULL, parse_filename(), and rc.

Here is the call graph for this function:

◆ DFS_Open()

static void * DFS_Open ( char *  testFileName,
IOR_param_t param 
)
static

Definition at line 589 of file aiori-DFS.c.

References dfs_options::chunk_size, DCHECK, dfs, GERR, lookup_insert_dir(), IOR_param_t::mode, aiori_dir_hdl::name, NULL, objectClass, parse_filename(), and rc.

Here is the call graph for this function:

◆ DFS_options()

static option_help * DFS_options ( )
static

Definition at line 382 of file aiori-DFS.c.

References options.

◆ DFS_Rmdir()

static int DFS_Rmdir ( const char *  path,
IOR_param_t param 
)
static

Definition at line 828 of file aiori-DFS.c.

References DCHECK, dfs, GERR, lookup_insert_dir(), aiori_dir_hdl::name, NULL, parse_filename(), and rc.

Here is the call graph for this function:

◆ DFS_Stat()

static int DFS_Stat ( const char *  path,
struct stat *  buf,
IOR_param_t param 
)
static

Definition at line 874 of file aiori-DFS.c.

References DCHECK, dfs, GERR, lookup_insert_dir(), aiori_dir_hdl::name, NULL, parse_filename(), and rc.

Here is the call graph for this function:

◆ DFS_Statfs()

static int DFS_Statfs ( const char *  path,
ior_aiori_statfs_t sfs,
IOR_param_t param 
)
static

Definition at line 794 of file aiori-DFS.c.

◆ DFS_Sync()

static void DFS_Sync ( IOR_param_t param)
static

Definition at line 694 of file aiori-DFS.c.

References dfs.

◆ DFS_Xfer()

static IOR_offset_t DFS_Xfer ( int  access,
void *  file,
IOR_size_t buffer,
IOR_offset_t  length,
IOR_param_t param 
)
static

set memory location

Definition at line 626 of file aiori-DFS.c.

References dfs, ERR, MAX_RETRY, NULL, IOR_param_t::offset, rc, IOR_param_t::singleXferAttempt, TRUE, and WRITE.

◆ HandleDistribute()

static void HandleDistribute ( enum handleType  type)
static

Definition at line 201 of file aiori-DFS.c.

References coh, CONT_HANDLE, DCHECK, dfs, DFS_HANDLE, ERR, MPI_CHECK, NULL, poh, POOL_HANDLE, rank, and rc.

Referenced by DFS_Init().

Here is the caller graph for this function:

◆ hdl_obj()

static struct aiori_dir_hdl* hdl_obj ( d_list_t *  rlink)
static

Definition at line 170 of file aiori-DFS.c.

References aiori_dir_hdl::entry.

Referenced by key_cmp(), lookup_insert_dir(), and rec_free().

Here is the caller graph for this function:

◆ key_cmp()

static bool key_cmp ( struct d_hash_table *  htable,
d_list_t *  rlink,
const void *  key,
unsigned int  ksize 
)
static

Definition at line 176 of file aiori-DFS.c.

References hdl_obj(), and aiori_dir_hdl::name.

Here is the call graph for this function:

◆ lookup_insert_dir()

static dfs_obj_t* lookup_insert_dir ( const char *  name,
mode_t *  mode 
)
static

Definition at line 350 of file aiori-DFS.c.

References DCHECK, dfs, dir_hash, aiori_dir_hdl::entry, GERR, hdl_obj(), aiori_dir_hdl::name, NULL, aiori_dir_hdl::oh, PATH_MAX, and rc.

Referenced by DFS_Access(), DFS_Create(), DFS_Delete(), DFS_Mkdir(), DFS_Open(), DFS_Rmdir(), and DFS_Stat().

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

◆ parse_filename()

static int parse_filename ( const char *  path,
char **  _obj_name,
char **  _cont_name 
)
static

Definition at line 259 of file aiori-DFS.c.

References NULL, and rc.

Referenced by DFS_Create(), DFS_Delete(), DFS_Mkdir(), DFS_Open(), DFS_Rmdir(), and DFS_Stat().

Here is the caller graph for this function:

◆ rec_free()

static void rec_free ( struct d_hash_table *  htable,
d_list_t *  rlink 
)
static

Definition at line 185 of file aiori-DFS.c.

References aiori_dir_hdl::entry, hdl_obj(), and aiori_dir_hdl::oh.

Here is the call graph for this function:

Variable Documentation

◆ coh

daos_handle_t coh
static

Definition at line 41 of file aiori-DFS.c.

Referenced by DFS_Finalize(), DFS_Init(), and HandleDistribute().

◆ dfs

dfs_t* dfs

◆ dfs_aiori

ior_aiori_t dfs_aiori
Initial value:
= {
.name = "DFS",
.create = DFS_Create,
.open = DFS_Open,
.xfer = DFS_Xfer,
.close = DFS_Close,
.delete = DFS_Delete,
.get_version = DFS_GetVersion,
.fsync = DFS_Fsync,
.sync = DFS_Sync,
.get_file_size = DFS_GetFileSize,
.statfs = DFS_Statfs,
.mkdir = DFS_Mkdir,
.rmdir = DFS_Rmdir,
.access = DFS_Access,
.stat = DFS_Stat,
.initialize = DFS_Init,
.finalize = DFS_Finalize,
.get_options = DFS_options,
.enable_mdtest = true,
}
static option_help * DFS_options()
Definition: aiori-DFS.c:382
static int DFS_Stat(const char *, struct stat *, IOR_param_t *)
Definition: aiori-DFS.c:874
static void DFS_Delete(char *, IOR_param_t *)
Definition: aiori-DFS.c:714
static void DFS_Finalize()
Definition: aiori-DFS.c:470
static void * DFS_Create(char *, IOR_param_t *)
Definition: aiori-DFS.c:540
static void DFS_Sync(IOR_param_t *)
Definition: aiori-DFS.c:694
static int DFS_Statfs(const char *, ior_aiori_statfs_t *, IOR_param_t *)
Definition: aiori-DFS.c:794
static void * DFS_Open(char *, IOR_param_t *)
Definition: aiori-DFS.c:589
static IOR_offset_t DFS_GetFileSize(IOR_param_t *, MPI_Comm, char *)
Definition: aiori-DFS.c:751
static void DFS_Close(void *, IOR_param_t *)
Definition: aiori-DFS.c:705
static int DFS_Access(const char *, int, IOR_param_t *)
Definition: aiori-DFS.c:857
static void DFS_Fsync(void *, IOR_param_t *)
Definition: aiori-DFS.c:683
static char * DFS_GetVersion()
Definition: aiori-DFS.c:739
static void DFS_Init()
Definition: aiori-DFS.c:387
static int DFS_Mkdir(const char *, mode_t, IOR_param_t *)
Definition: aiori-DFS.c:800
static IOR_offset_t DFS_Xfer(int, void *, IOR_size_t *, IOR_offset_t, IOR_param_t *)
Definition: aiori-DFS.c:626
static int DFS_Rmdir(const char *, IOR_param_t *)
Definition: aiori-DFS.c:828

Definition at line 119 of file aiori-DFS.c.

◆ dfs_init

bool dfs_init
static

Definition at line 45 of file aiori-DFS.c.

Referenced by DFS_Finalize(), and DFS_Init().

◆ dir_hash

struct d_hash_table* dir_hash
static

Definition at line 44 of file aiori-DFS.c.

Referenced by DFS_Finalize(), DFS_Init(), and lookup_insert_dir().

◆ dir_oclass

daos_oclass_id_t dir_oclass = OC_SX
static

Definition at line 43 of file aiori-DFS.c.

Referenced by DFS_Finalize(), DFS_Init(), and DFS_Mkdir().

◆ hdl_hash_ops

d_hash_table_ops_t hdl_hash_ops
static
Initial value:
= {
.hop_key_cmp = key_cmp,
.hop_rec_free = rec_free
}
static void rec_free(struct d_hash_table *htable, d_list_t *rlink)
Definition: aiori-DFS.c:185
static bool key_cmp(struct d_hash_table *htable, d_list_t *rlink, const void *key, unsigned int ksize)
Definition: aiori-DFS.c:176

Definition at line 194 of file aiori-DFS.c.

Referenced by DFS_Init().

◆ o

struct dfs_options o
static
Initial value:
= {
.pool = NULL,
.svcl = NULL,
.group = NULL,
.cont = NULL,
.chunk_size = 1048576,
.oclass = NULL,
.dir_oclass = NULL,
.prefix = NULL,
.destroy = 0,
}
#define NULL
Definition: iordef.h:79

Definition at line 72 of file aiori-DFS.c.

◆ objectClass

daos_oclass_id_t objectClass = OC_SX
static

Definition at line 42 of file aiori-DFS.c.

Referenced by DFS_Create(), DFS_Finalize(), DFS_Init(), and DFS_Open().

◆ options

option_help options[]
static
Initial value:
= {
{0, "dfs.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.pool},
{0, "dfs.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', & o.svcl},
{0, "dfs.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', & o.group},
{0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.cont},
{0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size},
{0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass},
{0, "dfs.dir_oclass", "directory object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.dir_oclass},
{0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix},
{0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o.destroy},
}
int chunk_size
Definition: aiori-DFS.c:65
char * pool
Definition: aiori-DFS.c:61
#define LAST_OPTION
Definition: option.h:37
int destroy
Definition: aiori-DFS.c:69
static struct dfs_options o
Definition: aiori-DFS.c:72
char * prefix
Definition: aiori-DFS.c:68
char * cont
Definition: aiori-DFS.c:64
char * svcl
Definition: aiori-DFS.c:62
char * dir_oclass
Definition: aiori-DFS.c:67
char * group
Definition: aiori-DFS.c:63
char * oclass
Definition: aiori-DFS.c:66

Definition at line 84 of file aiori-DFS.c.

Referenced by DFS_options().

◆ poh

daos_handle_t poh
static

Definition at line 41 of file aiori-DFS.c.

Referenced by DFS_Finalize(), DFS_Init(), and HandleDistribute().