-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Robinhood Sync Acceleration for PanFS #108
Open
elliswilson
wants to merge
2
commits into
cea-hpc:master
Choose a base branch
from
panasasinc:PAN_API2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil; -*- | ||
* vim:expandtab:shiftwidth=4:tabstop=4: | ||
*/ | ||
/* | ||
* Copyright (C) 2008, 2009 CEA/DAM | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the CeCILL License. | ||
* | ||
* The fact that you are presently reading this means that you have had | ||
* knowledge of the CeCILL license (http://www.cecill.info) and that you | ||
* accept its terms. | ||
*/ | ||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#include "panfs_config.h" | ||
#include "rbh_cfg_helpers.h" | ||
#include "rbh_misc.h" | ||
#include "rbh_logs.h" | ||
#include <errno.h> | ||
|
||
#define PANFS_CONFIG_BLOCK "Panasas" | ||
|
||
/* exported variable available to all modules */ | ||
panfs_config_t panfs_config; | ||
|
||
static void panfs_cfg_set_default(void *module_config) | ||
{ | ||
panfs_config_t *conf = (panfs_config_t *)module_config; | ||
rh_strncpy(conf->snap_delta_path, "", RBH_PATH_MAX); | ||
rh_strncpy(conf->snap_delta_results_path, "", RBH_PATH_MAX); | ||
rh_strncpy(conf->volume, "", FILENAME_MAX); | ||
conf->update_interval = 600;//10 min | ||
} | ||
|
||
static void panfs_cfg_write_default(FILE *output) | ||
{ | ||
print_begin_block(output, 0, PANFS_CONFIG_BLOCK, NULL); | ||
print_line(output, 1, "snap_delta_path : PATH"); | ||
print_line(output, 1, "snap_delta_results_path : PATH"); | ||
print_line(output, 1, "volume : volumeName"); | ||
print_line(output, 1, "# Interval for updating database"); | ||
print_line(output, 1, "update_interval = 10min ;"); | ||
fprintf(output, "\n"); | ||
print_end_block(output, 0); | ||
} | ||
|
||
static int panfs_cfg_read(config_file_t config, void *module_config, | ||
char *msg_out) | ||
{ | ||
panfs_config_t *conf = (panfs_config_t *)module_config; | ||
config_item_t panfs_block; | ||
int rc; | ||
|
||
static const char * const allowed_params[] = { | ||
"snap_delta_path", "snap_delta_results_path", "volume", "update_interval", NULL | ||
}; | ||
const cfg_param_t cfg_params[] = { | ||
{"snap_delta_path", PT_STRING, PFLG_MANDATORY | | ||
PFLG_REMOVE_FINAL_SLASH | PFLG_NO_WILDCARDS, conf->snap_delta_path, | ||
sizeof(conf->snap_delta_path)} | ||
, | ||
{"snap_delta_results_path", PT_STRING, PFLG_MANDATORY | | ||
PFLG_REMOVE_FINAL_SLASH | PFLG_NO_WILDCARDS, conf->snap_delta_results_path, | ||
sizeof(conf->snap_delta_results_path)} | ||
, | ||
{"volume", PT_STRING, | ||
PFLG_MANDATORY | | ||
PFLG_NO_WILDCARDS, conf->volume, sizeof(conf->volume)} | ||
, | ||
{"update_interval", PT_DURATION, PFLG_POSITIVE | PFLG_NOT_NULL, | ||
&conf->update_interval, 0} | ||
, | ||
|
||
END_OF_PARAMS | ||
}; | ||
|
||
/* get PANASAS block */ | ||
rc = get_cfg_block(config, PANFS_CONFIG_BLOCK, &panfs_block, msg_out); | ||
if (rc) | ||
return rc; | ||
|
||
/* retrieve std parameters */ | ||
rc = read_scalar_params(panfs_block, PANFS_CONFIG_BLOCK, cfg_params, | ||
msg_out); | ||
if (rc) | ||
return rc; | ||
|
||
/* check unknown parameters */ | ||
CheckUnknownParameters(panfs_block, PANFS_CONFIG_BLOCK, allowed_params); | ||
|
||
return 0; | ||
} | ||
|
||
static int panfs_cfg_set(void *module_config, bool reload) | ||
{ | ||
panfs_config_t *conf = (panfs_config_t *) module_config; | ||
|
||
if (!reload) { | ||
/* copy the whole structure content */ | ||
panfs_config = *conf; | ||
return 0; | ||
} | ||
|
||
if (strcmp(conf->snap_delta_path, panfs_config.snap_delta_path)){ | ||
DisplayLog(LVL_MAJOR, "PanasasConfig", | ||
PANFS_CONFIG_BLOCK | ||
"::Path to pan_snap_delta updated"); | ||
strcpy(panfs_config.snap_delta_path,conf->snap_delta_path); | ||
|
||
} | ||
if (strcmp(conf->snap_delta_results_path, panfs_config.snap_delta_results_path)){ | ||
DisplayLog(LVL_MAJOR, "PanasasConfig", | ||
PANFS_CONFIG_BLOCK | ||
"::Path to pan_snap_delta results updated"); | ||
strcpy(panfs_config.snap_delta_results_path,conf->snap_delta_results_path); | ||
|
||
} | ||
if (strcmp(conf->volume, panfs_config.volume)){ | ||
DisplayLog(LVL_MAJOR, "PanasasConfig", | ||
PANFS_CONFIG_BLOCK | ||
"::Volume's name changed in config file, but cannot be modified dynamically. If you need to change it, drop the database and run it one more time."); | ||
exit(1); | ||
} | ||
if (panfs_config.update_interval != conf->update_interval) { | ||
DisplayLog(LVL_MAJOR, "PanasasConfig", | ||
PANFS_CONFIG_BLOCK "::update_interval modified: " | ||
"'%" PRI_TT "'->'%" PRI_TT "'", | ||
panfs_config.update_interval, conf->update_interval); | ||
panfs_config.update_interval = conf->update_interval; | ||
} | ||
return 0; | ||
} | ||
|
||
static void panfs_cfg_write_template(FILE *output) | ||
{ | ||
print_begin_block(output, 0, PANFS_CONFIG_BLOCK, NULL); | ||
print_line(output, 1, | ||
"# Path to pan_snap_delta binary"); | ||
print_line(output, 1, "snap_delta_path = \"/panfs/\" ;"); | ||
fprintf(output, "\n"); | ||
print_line(output, 1, | ||
"# Path to pan_snap_delta results"); | ||
print_line(output, 1, "snap_delta_results_path = \"/tmp/\" ;"); | ||
fprintf(output, "\n"); | ||
print_line(output, 1, "# Name of the volume"); | ||
print_line(output, 1, "volume = home;"); | ||
fprintf(output, "\n"); | ||
print_line(output, 1, | ||
"# Time between checks to see if there are newer snapshots to process"); | ||
|
||
print_line(output, 1, " update_interval=10m;"); | ||
print_end_block(output, 0); | ||
} | ||
|
||
static void *panfs_cfg_new(void) | ||
{ | ||
return calloc(1, sizeof(panfs_config_t)); | ||
} | ||
|
||
static void panfs_cfg_free(void *cfg) | ||
{ | ||
if (cfg != NULL) | ||
free(cfg); | ||
} | ||
|
||
/** structure with config handling functions */ | ||
mod_cfg_funcs_t panfs_cfg_hdlr = { | ||
.module_name = "panasas", | ||
.new = panfs_cfg_new, | ||
.free = panfs_cfg_free, | ||
.set_default = panfs_cfg_set_default, | ||
.read = panfs_cfg_read, | ||
.set_config = panfs_cfg_set, | ||
.write_default = panfs_cfg_write_default, | ||
.write_template = panfs_cfg_write_template | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer you include this large piece of code in a subfonction.