/* PINT_handle_in_extent_list() * * Parameters: * PINT_llist *extent_list - PINT_llist of extent structures * PVFS_handle - a handle * * Returns 1 if the specified handle is within any of the * extents in the specified list of extents. Returns 0 * otherwise. * */ int PINT_handle_in_extent_list( PINT_llist *extent_list, PVFS_handle handle) { int ret = 0; PINT_llist *cur = NULL; PVFS_handle_extent *cur_extent = NULL; if (extent_list) { cur = extent_list; while(cur) { cur_extent = PINT_llist_head(cur); if (!cur_extent) { break; } if (PINT_handle_in_extent(cur_extent,handle)) { ret = 1; break; } cur = PINT_llist_next(cur); } } return ret; }
static int trove_map_handle_ranges( PINT_llist *extent_list, struct handle_ledger *ledger) { int ret = -1; PINT_llist *cur = NULL; PVFS_handle_extent *cur_extent = NULL; int64_t total_handles=0; if (extent_list && ledger) { cur = extent_list; while(cur) { cur_extent = PINT_llist_head(cur); if (!cur_extent) { break; } ret = trove_handle_ledger_addextent(ledger, cur_extent); if (ret != 0) { break; } /* if, for example, you had a 'first' of 5 and a 'last' of * 5, the difference is 0, but there is one handle */ total_handles += (cur_extent->last - cur_extent->first + 1); cur = PINT_llist_next(cur); } trove_handle_ledger_set_threshold(ledger, total_handles); } return ret; }
int main(int argc, char **argv) { PINT_llist *cur = NULL; struct server_configuration_s serverconfig; struct host_alias_s *cur_alias; struct filesystem_configuration_s *cur_fs = NULL; int alias_count = 1; if (argc != 3) { printf("Usage: %s <fs.conf> <server-alias>\n",argv[0]); return 1; } gossip_enable_stderr(); memset(&serverconfig,0,sizeof(serverconfig)); if (PINT_parse_config(&serverconfig, argv[1], argv[2], 1)) { printf("Failed to parse config files\n"); return 1; } /* dump all gathered config values */ fprintf(stderr,"--- Printing filesystem configuration\n\n"); fprintf(stderr,"Server ID : %s\n", serverconfig.host_id); fprintf(stderr,"Data Storage Space : %s\n", serverconfig.data_path); fprintf(stderr,"Meta Storage Space : %s\n", serverconfig.meta_path); fprintf(stderr,"FS Config File Name : %s (%d bytes)\n", serverconfig.fs_config_filename, (int)serverconfig.fs_config_buflen); fprintf(stderr,"Initial Unexp Requests : %d\n", serverconfig.initial_unexpected_requests); fprintf(stderr,"Configured Log File : %s\n", serverconfig.logfile); fprintf(stderr,"Configured FlowModules : %s\n", serverconfig.flow_modules); fprintf(stderr,"Configured BMIModules : %s\n", serverconfig.bmi_modules); fprintf(stderr,"Event Logging Mask String: %s\n", serverconfig.event_logging); fprintf(stderr,"\n--- Host Aliases (alias => address):\n"); cur = serverconfig.host_aliases; while(cur) { cur_alias = PINT_llist_head(cur); if (!cur_alias) { break; } fprintf(stderr,"%.2d) %s => %s\n", alias_count++, cur_alias->host_alias, cur_alias->bmi_address); cur = PINT_llist_next(cur); } fprintf(stderr,"\n"); cur = serverconfig.file_systems; while(cur) { cur_fs = PINT_llist_head(cur); if (!cur_fs) { break; } print_filesystem_configuration(cur_fs); cur = PINT_llist_next(cur); } fprintf(stderr,"\n--- Analyzing filesystem configuration\n\n"); if (PINT_config_is_valid_configuration(&serverconfig)) { fprintf(stderr,"\nOK: Configuration file is VALID\n"); } else { fprintf(stderr,"\nERROR: Configuration file is INVALID\n"); } PINT_config_release(&serverconfig); gossip_disable(); return 0; }
void print_filesystem_configuration(struct filesystem_configuration_s *fs) { PINT_llist *cur = NULL; struct host_handle_mapping_s *cur_h_mapping = NULL; if (fs) { fprintf(stderr,"=========== Reporting FS \"%s\" Information " "===========\n",fs->file_system_name); fprintf(stderr,"Collection ID : %d\n",fs->coll_id); fprintf(stderr,"Root Handle : %llu\n", llu(fs->root_handle)); fprintf(stderr,"Handle Recycle Timeout: %d seconds\n", (int)fs->handle_recycle_timeout_sec.tv_sec); fprintf(stderr,"Trove Sync Meta : %s\n", ((fs->trove_sync_meta == TROVE_SYNC) ? "yes" : "no")); fprintf(stderr,"Trove Sync Data : %s\n", ((fs->trove_sync_data == TROVE_SYNC) ? "yes" : "no")); fprintf(stderr,"Flow Protocol : "); switch(fs->flowproto) { case FLOWPROTO_DUMP_OFFSETS: fprintf(stderr,"flowproto_dump_offsets\n"); break; case FLOWPROTO_BMI_CACHE: fprintf(stderr,"flowproto_bmi_cache\n"); break; case FLOWPROTO_MULTIQUEUE: fprintf(stderr,"flowproto_multiqueue\n"); break; default: fprintf(stderr,"Unknown (<== ERROR!)\n"); break; } fprintf(stderr,"\n --- Meta Server(s) for %s (%d total):\n", fs->file_system_name,PINT_llist_count(fs->meta_handle_ranges)); cur = fs->meta_handle_ranges; while(cur) { cur_h_mapping = PINT_llist_head(cur); if (!cur_h_mapping) { break; } fprintf(stderr," %s\n", cur_h_mapping->alias_mapping->host_alias); cur = PINT_llist_next(cur); } fprintf(stderr,"\n --- Data Server(s) for %s (%d total):\n", fs->file_system_name,PINT_llist_count(fs->data_handle_ranges)); cur = fs->data_handle_ranges; while(cur) { cur_h_mapping = PINT_llist_head(cur); if (!cur_h_mapping) { break; } fprintf(stderr," %s\n", cur_h_mapping->alias_mapping->host_alias); cur = PINT_llist_next(cur); } fprintf(stderr,"\n --- Meta Handle Mappings for %s:\n", fs->file_system_name); cur = fs->meta_handle_ranges; while(cur) { cur_h_mapping = PINT_llist_head(cur); if (!cur_h_mapping) { break; } fprintf(stderr," %s has handle range %s\n", cur_h_mapping->alias_mapping->host_alias, cur_h_mapping->handle_range); cur = PINT_llist_next(cur); } fprintf(stderr,"\n --- Data Handle Mappings for %s:\n", fs->file_system_name); cur = fs->data_handle_ranges; while(cur) { cur_h_mapping = PINT_llist_head(cur); if (!cur_h_mapping) { break; } fprintf(stderr," %s has handle range %s\n", cur_h_mapping->alias_mapping->host_alias, cur_h_mapping->handle_range); cur = PINT_llist_next(cur); } } }