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 DCHECK(rc, format, ...)
 
#define INFO(level, format, ...)
 
#define GERR(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_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 void HandleDistribute (enum handleType type)
 
static int parse_filename (const char *path, char **_obj_name, char **_cont_name)
 
static void share_file_handle (dfs_obj_t **file, MPI_Comm comm)
 
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
 
static daos_oclass_id_t dir_oclass
 
static struct d_hash_table * dir_hash
 
static bool dfs_init
 
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.

◆ 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-4c.c:111
int rank
Definition: utilities.c:68

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

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

◆ 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 179 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:70
int rank
Definition: utilities.c:68

Definition at line 173 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 53 of file aiori-DFS.c.

Function Documentation

◆ DFS_Access()

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

just close if it's a file

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

References lookup_insert_dir(), and NULL.

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

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

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

References DFS_options_t::chunk_size, DCHECK, dfs, aiori_xfer_hint_t::filePerProc, GERR, 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 800 of file aiori-DFS.c.

References DCHECK, dfs, GERR, 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 769 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 837 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 825 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

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

References coh, DFS_options_t::cont, CONT_HANDLE, DCHECK, dfs, DFS_HANDLE, dfs_init, dir_hash, dir_oclass, DFS_options_t::dir_oclass, ERR, GERR, 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, DFS_options_t::svcl, 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 187 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 879 of file aiori-DFS.c.

References DCHECK, dfs, dir_oclass, GERR, 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 669 of file aiori-DFS.c.

References DFS_options_t::chunk_size, DCHECK, dfs, aiori_xfer_hint_t::filePerProc, GERR, 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_Rmdir()

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

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

References DCHECK, dfs, GERR, 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 953 of file aiori-DFS.c.

References DCHECK, dfs, GERR, 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

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

Referenced by DFS_options().

Here is the caller graph for this function:

◆ DFS_Sync()

static void DFS_Sync ( aiori_mod_opt_t param)
static

Definition at line 780 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 712 of file aiori-DFS.c.

References dfs, ERR, 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 void HandleDistribute ( enum handleType  type)
static

Definition at line 237 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 206 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 212 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 423 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 293 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 221 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:

◆ share_file_handle()

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

Definition at line 384 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

◆ 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",
.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,
.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:712
static aiori_fd_t * DFS_Create(char *, int, aiori_mod_opt_t *)
Definition: aiori-DFS.c:626
static int DFS_Access(const char *, int, aiori_mod_opt_t *)
Definition: aiori-DFS.c:936
static void DFS_Finalize(aiori_mod_opt_t *)
Definition: aiori-DFS.c:553
static void DFS_Sync(aiori_mod_opt_t *)
Definition: aiori-DFS.c:780
static IOR_offset_t DFS_GetFileSize(aiori_mod_opt_t *, char *)
Definition: aiori-DFS.c:837
static int DFS_Mkdir(const char *, mode_t, aiori_mod_opt_t *)
Definition: aiori-DFS.c:879
static void DFS_init_xfer_options(aiori_xfer_hint_t *)
Definition: aiori-DFS.c:187
static option_help * DFS_options(aiori_mod_opt_t **init_backend_options, aiori_mod_opt_t *init_values)
Definition: aiori-DFS.c:74
static void DFS_Delete(char *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:800
static char * DFS_GetVersion()
Definition: aiori-DFS.c:825
static void DFS_Close(aiori_fd_t *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:791
static int DFS_Statfs(const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:873
static int DFS_Stat(const char *, struct stat *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:953
static void DFS_Fsync(aiori_fd_t *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:769
static void DFS_Init(aiori_mod_opt_t *)
Definition: aiori-DFS.c:456
static aiori_fd_t * DFS_Open(char *, int, aiori_mod_opt_t *)
Definition: aiori-DFS.c:669
static int DFS_Rmdir(const char *, aiori_mod_opt_t *)
Definition: aiori-DFS.c:907
static int DFS_check_params(aiori_mod_opt_t *)
Definition: aiori-DFS.c:192

Definition at line 133 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
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:221
static bool key_cmp(struct d_hash_table *htable, d_list_t *rlink, const void *key, unsigned int ksize)
Definition: aiori-DFS.c:212

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

Referenced by DFS_Init().

◆ hints

aiori_xfer_hint_t* hints = NULL
static

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

◆ objectClass

daos_oclass_id_t objectClass
static

Definition at line 42 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 41 of file aiori-DFS.c.

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