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 <mpi.h>
#include <gurt/common.h>
#include <gurt/hash.h>
#include <daos.h>
#include <daos_fs.h>
#include "aiori.h"
#include "utilities.h"
#include "iordef.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_t
 

Macros

#define _BSD_SOURCE
 
#define CHECK_DAOS_API_VERSION(major, minor)   0
 
#define DCHECK(rc, format, ...)
 
#define INFO(level, format, ...)
 
#define DERR(format, ...)
 

Enumerations

enum  handleType { POOL_HANDLE, CONT_HANDLE, DFS_HANDLE }
 

Functions

static option_helpDFS_options (aiori_mod_opt_t **init_backend_options, aiori_mod_opt_t *init_values)
 
static void DFS_Init (aiori_mod_opt_t *)
 
static void DFS_Finalize (aiori_mod_opt_t *)
 
static aiori_fd_tDFS_Create (char *, int, aiori_mod_opt_t *)
 
static aiori_fd_tDFS_Open (char *, int, aiori_mod_opt_t *)
 
static IOR_offset_t DFS_Xfer (int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *)
 
static void DFS_Close (aiori_fd_t *, aiori_mod_opt_t *)
 
static void DFS_Delete (char *, aiori_mod_opt_t *)
 
static char * DFS_GetVersion ()
 
static void DFS_Fsync (aiori_fd_t *, aiori_mod_opt_t *)
 
static void DFS_Sync (aiori_mod_opt_t *)
 
static IOR_offset_t DFS_GetFileSize (aiori_mod_opt_t *, char *)
 
static int DFS_Statfs (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *)
 
static int DFS_Stat (const char *, struct stat *, aiori_mod_opt_t *)
 
static int DFS_Mkdir (const char *, mode_t, aiori_mod_opt_t *)
 
static int DFS_Rename (const char *, const char *, aiori_mod_opt_t *)
 
static int DFS_Rmdir (const char *, aiori_mod_opt_t *)
 
static int DFS_Access (const char *, int, aiori_mod_opt_t *)
 
static option_helpDFS_options ()
 
static void DFS_init_xfer_options (aiori_xfer_hint_t *)
 
static int DFS_check_params (aiori_mod_opt_t *)
 
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 bool rec_decref (struct d_hash_table *htable, d_list_t *rlink)
 
static uint32_t rec_hash (struct d_hash_table *htable, d_list_t *rlink)
 
static int HandleDistribute (enum handleType type)
 
static int parse_filename (const char *path, char **_obj_name, char **_cont_name)
 
static int share_file_handle (dfs_obj_t **file, MPI_Comm comm)
 
static dfs_obj_t * lookup_insert_dir (const char *name, mode_t *mode)
 

Variables

static dfs_t * dfs
 
static daos_handle_t poh
 
static daos_handle_t coh
 
static daos_oclass_id_t objectClass
 
static daos_oclass_id_t dir_oclass
 
static struct d_hash_table * aiori_dfs_hash = NULL
 
static int dfs_init_count
 
ior_aiori_t dfs_aiori
 
static aiori_xfer_hint_thints = NULL
 
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.

◆ CHECK_DAOS_API_VERSION

#define CHECK_DAOS_API_VERSION (   major,
  minor 
)    0

Definition at line 45 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); \
goto out; \
} \
} while (0)
CURLcode rc
Definition: aiori-S3-4c.c:111
int rank
Definition: utilities.c:70

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

Referenced by DFS_Access(), DFS_Create(), DFS_Delete(), DFS_Finalize(), DFS_Init(), DFS_Mkdir(), DFS_Open(), DFS_Rename(), DFS_Rmdir(), DFS_Stat(), DFS_Statfs(), HandleDistribute(), and share_file_handle().

◆ DERR

#define DERR (   format,
  ... 
)
Value:
do { \
fprintf(stderr, format"\n", ##__VA_ARGS__); \
fflush(stderr); \
rc = -1; \
goto out; \
} while (0)

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

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

◆ INFO

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

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

Referenced by DFS_Finalize(), and DFS_Init().

Enumeration Type Documentation

◆ handleType

enum handleType
Enumerator
POOL_HANDLE 
CONT_HANDLE 
DFS_HANDLE 

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

Function Documentation

◆ DFS_Access()

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

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

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

Referenced by DFS_options().

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

◆ DFS_check_params()

static int DFS_check_params ( aiori_mod_opt_t options)
static

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

References DFS_options_t::cont, ERR, NULL, o, DFS_options_t::pool, and testComm.

Referenced by DFS_options().

Here is the caller graph for this function:

◆ DFS_Close()

static void DFS_Close ( aiori_fd_t fd,
aiori_mod_opt_t param 
)
static

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

Referenced by DFS_options().

Here is the caller graph for this function:

◆ DFS_Create()

static aiori_fd_t * DFS_Create ( char *  testFileName,
int  flags,
aiori_mod_opt_t param 
)
static

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

References DFS_options_t::chunk_size, DCHECK, DERR, dfs, aiori_xfer_hint_t::filePerProc, lookup_insert_dir(), aiori_dir_hdl::name, NULL, o, objectClass, parse_filename(), rank, rc, share_file_handle(), and testComm.

Referenced by DFS_options().

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

◆ DFS_Delete()

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

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

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

Referenced by DFS_options().

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

◆ DFS_Finalize()

static void DFS_Finalize ( aiori_mod_opt_t options)
static

◆ DFS_Fsync()

static void DFS_Fsync ( aiori_fd_t fd,
aiori_mod_opt_t param 
)
static

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

References dfs.

Referenced by DFS_options().

Here is the caller graph for this function:

◆ DFS_GetFileSize()

static IOR_offset_t DFS_GetFileSize ( aiori_mod_opt_t test,
char *  testFileName 
)
static

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

References dfs, aiori_xfer_hint_t::filePerProc, NULL, rank, rc, testComm, and TRUE.

Referenced by DFS_options().

Here is the caller graph for this function:

◆ DFS_GetVersion()

static char * DFS_GetVersion ( )
static

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

Referenced by DFS_options().

Here is the caller graph for this function:

◆ DFS_Init()

static void DFS_Init ( aiori_mod_opt_t options)
static

chunk size and oclass can change between different runs

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

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

References aiori_dfs_hash, coh, DFS_options_t::cont, CONT_HANDLE, DCHECK, DERR, dfs, DFS_HANDLE, dfs_init_count, dir_oclass, DFS_options_t::dir_oclass, ERR, DFS_options_t::group, HandleDistribute(), hdl_hash_ops, INFO, NULL, o, objectClass, DFS_options_t::oclass, poh, DFS_options_t::pool, POOL_HANDLE, DFS_options_t::prefix, rank, rc, and VERBOSE_1.

Referenced by DFS_options().

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

◆ DFS_init_xfer_options()

void DFS_init_xfer_options ( aiori_xfer_hint_t params)
static

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

Referenced by DFS_options().

Here is the caller graph for this function:

◆ DFS_Mkdir()

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

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

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

Referenced by DFS_options().

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

◆ DFS_Open()

static aiori_fd_t * DFS_Open ( char *  testFileName,
int  flags,
aiori_mod_opt_t param 
)
static

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

References DFS_options_t::chunk_size, DCHECK, DERR, dfs, aiori_xfer_hint_t::filePerProc, lookup_insert_dir(), aiori_dir_hdl::name, NULL, o, objectClass, parse_filename(), rank, rc, share_file_handle(), and testComm.

Referenced by DFS_options().

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

◆ DFS_options() [1/2]

static option_help* DFS_options ( aiori_mod_opt_t **  init_backend_options,
aiori_mod_opt_t init_values 
)
static

◆ DFS_options() [2/2]

static option_help* DFS_options ( )
static

◆ DFS_Rename()

static int DFS_Rename ( const char *  oldfile,
const char *  newfile,
aiori_mod_opt_t param 
)
static

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

References DCHECK, DERR, dfs, lookup_insert_dir(), NULL, parse_filename(), and rc.

Referenced by DFS_options().

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

◆ DFS_Rmdir()

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

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

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

Referenced by DFS_options().

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

◆ DFS_Stat()

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

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

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

Referenced by DFS_options().

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

◆ DFS_Statfs()

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

◆ DFS_Sync()

static void DFS_Sync ( aiori_mod_opt_t param)
static

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

References dfs.

Referenced by DFS_options().

Here is the caller graph for this function:

◆ DFS_Xfer()

static IOR_offset_t DFS_Xfer ( int  access,
aiori_fd_t file,
IOR_size_t buffer,
IOR_offset_t  length,
IOR_offset_t  off,
aiori_mod_opt_t param 
)
static

set memory location

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

References dfs, ERR, ERRF, MAX_RETRY, NULL, rc, aiori_xfer_hint_t::singleXferAttempt, TRUE, and WRITE.

Referenced by DFS_options().

Here is the caller graph for this function:

◆ HandleDistribute()

static int HandleDistribute ( enum handleType  type)
static

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

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

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 209 of file aiori-DFS.c.

References aiori_dir_hdl::entry.

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

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 215 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 421 of file aiori-DFS.c.

References aiori_dfs_hash, dfs, aiori_dir_hdl::entry, hdl_obj(), aiori_dir_hdl::name, NULL, aiori_dir_hdl::oh, and rc.

Referenced by DFS_Access(), DFS_Create(), DFS_Delete(), DFS_Mkdir(), DFS_Open(), DFS_Rename(), 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 314 of file aiori-DFS.c.

References errno, NULL, PATH_MAX, and rc.

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

Here is the caller graph for this function:

◆ rec_decref()

static bool rec_decref ( struct d_hash_table *  htable,
d_list_t *  rlink 
)
static

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

◆ rec_free()

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

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

References hdl_obj(), and aiori_dir_hdl::oh.

Here is the call graph for this function:

◆ rec_hash()

static uint32_t rec_hash ( struct d_hash_table *  htable,
d_list_t *  rlink 
)
static

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

References hdl_obj(), and aiori_dir_hdl::name.

Here is the call graph for this function:

◆ share_file_handle()

static int share_file_handle ( dfs_obj_t **  file,
MPI_Comm  comm 
)
static

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

References DCHECK, dfs, ERR, MPI_CHECK, NULL, rank, rc, and testComm.

Referenced by DFS_Create(), and DFS_Open().

Here is the caller graph for this function:

Variable Documentation

◆ aiori_dfs_hash

struct d_hash_table* aiori_dfs_hash = NULL
static

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

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

◆ coh

daos_handle_t coh
static

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

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

◆ dfs

dfs_t* dfs
static

◆ dfs_aiori

ior_aiori_t dfs_aiori
Initial value:
= {
.name = "DFS",
.initialize = DFS_Init,
.finalize = DFS_Finalize,
.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,
.xfer_hints = DFS_init_xfer_options,
.statfs = DFS_Statfs,
.mkdir = DFS_Mkdir,
.rename = DFS_Rename,
.rmdir = DFS_Rmdir,
.access = DFS_Access,
.stat = DFS_Stat,
.get_options = DFS_options,
.check_params = DFS_check_params,
.enable_mdtest = true,
}
static IOR_offset_t DFS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *)
Definition: aiori-DFS.c:773
static aiori_fd_t * DFS_Create(char *, int, aiori_mod_opt_t *)
Definition: aiori-DFS.c:684
static int DFS_Access(const char *, int, aiori_mod_opt_t *)
Definition: aiori-DFS.c:1062
static void DFS_Finalize(aiori_mod_opt_t *)
Definition: aiori-DFS.c:599
static int DFS_Rename(const char *, const char *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:991
static void DFS_Sync(aiori_mod_opt_t *)
Definition: aiori-DFS.c:844
static IOR_offset_t DFS_GetFileSize(aiori_mod_opt_t *, char *)
Definition: aiori-DFS.c:901
static int DFS_Mkdir(const char *, mode_t, aiori_mod_opt_t *)
Definition: aiori-DFS.c:961
static void DFS_init_xfer_options(aiori_xfer_hint_t *)
Definition: aiori-DFS.c:191
static option_help * DFS_options(aiori_mod_opt_t **init_backend_options, aiori_mod_opt_t *init_values)
Definition: aiori-DFS.c:79
static void DFS_Delete(char *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:864
static char * DFS_GetVersion()
Definition: aiori-DFS.c:889
static void DFS_Close(aiori_fd_t *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:855
static int DFS_Statfs(const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:937
static int DFS_Stat(const char *, struct stat *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:1097
static void DFS_Fsync(aiori_fd_t *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:833
static void DFS_Init(aiori_mod_opt_t *)
Definition: aiori-DFS.c:461
static aiori_fd_t * DFS_Open(char *, int, aiori_mod_opt_t *)
Definition: aiori-DFS.c:728
static int DFS_Rmdir(const char *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:1033
static int DFS_check_params(aiori_mod_opt_t *)
Definition: aiori-DFS.c:196

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

◆ dfs_init_count

int dfs_init_count
static

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

Referenced by DFS_Finalize(), and DFS_Init().

◆ dir_oclass

daos_oclass_id_t dir_oclass
static

Definition at line 51 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_decref = rec_decref,
.hop_rec_free = rec_free,
.hop_rec_hash = rec_hash
}
static void rec_free(struct d_hash_table *htable, d_list_t *rlink)
Definition: aiori-DFS.c:224
static bool rec_decref(struct d_hash_table *htable, d_list_t *rlink)
Definition: aiori-DFS.c:233
static uint32_t rec_hash(struct d_hash_table *htable, d_list_t *rlink)
Definition: aiori-DFS.c:239
static bool key_cmp(struct d_hash_table *htable, d_list_t *rlink, const void *key, unsigned int ksize)
Definition: aiori-DFS.c:215

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

Referenced by DFS_Init().

◆ hints

aiori_xfer_hint_t* hints = NULL
static

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

◆ objectClass

daos_oclass_id_t objectClass
static

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

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

◆ poh

daos_handle_t poh
static

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

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