// returns PLFS_SUCCESS or PLFS_E* plfs_error_t plfs_dump_config(int check_dirs, int make_dir) { PlfsConf *pconf = get_plfs_conf(); static IOStore *fakestore = NULL; int simple; if ( ! pconf ) { cerr << "FATAL no plfsrc file found.\n" << endl; return PLFS_ENOENT; } if ( pconf->err_msg ) { cerr << "FATAL conf file error: " << *(pconf->err_msg) << endl; return PLFS_EINVAL; } /* * if we make it here, we've parsed correctly. if we are checking * dirs, then we need to attach to backends. in order to check * the global_summary_dir (if enabled), we do a one-off attach * here first. we also need a fake iostore to check local posix * mount points (e.g. for FUSE, but it doesn't make sense for MPI * or library access XXX). */ if (check_dirs) { if (pconf->global_summary_dir) { map<string,PlfsMount *>::iterator itr; PlfsMount *pmnt; itr = pconf->mnt_pts.begin(); /* note: get_plfs_conf() ensures there is at least 1 mnt */ pmnt = itr->second; (void) plfs_attach(pmnt); /* ignore ret val */ } /* XXX: generate a fake POSIX iostore, we'll never free it */ if (fakestore == NULL) { char *pp, *bmp, spec[2]; int pl; map<string,PlfsMount *>::iterator itr; PlfsMount *pmnt; itr = pconf->mnt_pts.begin(); /* note: get_plfs_conf() ensures there is at least 1 mnt */ pmnt = itr->second; spec[0] = '/'; spec[1] = 0; plfs_iostore_get(spec, &pp, &pl, &bmp, pmnt, &fakestore); } } plfs_error_t ret = PLFS_SUCCESS; cout << "Config file " << pconf->file << " correctly parsed:" << endl << "Num Hostdirs: " << pconf->num_hostdirs << endl << "Threadpool size: " << pconf->threadpool_size << endl << "Write index buffer size (mbs): " << pconf->buffer_mbs << endl << "Read index buffer size (mbs): " << pconf->read_buffer_mbs << endl << "Num Mountpoints: " << pconf->mnt_pts.size() << endl << "Lazy Stat: " << pconf->lazy_stat << endl << "Lazy Droppings: " << pconf->lazy_droppings << endl << "Compress Contiguous: " << pconf->compress_contiguous << endl << "Test Metalink: " << pconf->test_metalink << endl; if (pconf->global_summary_dir) { cout << "Global summary dir: " << pconf->global_summary_dir << endl; if(check_dirs) { ret = plfs_check_dir("global_summary_dir", pconf->global_sum_io.prefix, pconf->global_sum_io.store, pconf->global_sum_io.bmpoint,ret,make_dir); } } map<string,PlfsMount *>::iterator itr; for(itr=pconf->mnt_pts.begin(); itr!=pconf->mnt_pts.end(); itr++) { PlfsMount *pmnt = itr->second; int check_dirs_now = check_dirs; cout << "Mount Point " << itr->first << " :" << endl; cout << "\tExpected Workload " << (pmnt->file_type == CONTAINER ? "shared_file (N-1)" : pmnt->file_type == FLAT_FILE ? "file_per_proc (N-N)" : pmnt->file_type == SMALL_FILE ? "small_file (1-N)" : "UNKNOWN. WTF. email [email protected]") << endl; if (check_dirs && plfs_attach(pmnt) != PLFS_SUCCESS) { cout << "\tUnable to attach to mount point, disable check_dirs" << endl; check_dirs_now = 0; } if(check_dirs_now && fakestore != NULL) { ret = plfs_check_dir("mount_point","", fakestore,itr->first,ret,make_dir); } simple = (pmnt->ncanback == pmnt->nback) && (pmnt->nshadowback == pmnt->nback); if (simple) { printf("\tBackends: total=%d (no restrictions)\n", pmnt->nback); } else { printf("\tBackends: canonical=%d, shadow=%d, total=%d\n", pmnt->ncanback, pmnt->nshadowback, pmnt->nback); } ret = print_backends(pmnt, simple, check_dirs_now, ret, make_dir); cout << "\tGlib buffer size (mbs): " << pmnt->glib_buffer_mbs << endl; if(pmnt->syncer_ip) { cout << "\tSyncer IP: " << pmnt->syncer_ip->c_str() << endl; } if(pmnt->statfs) { cout << "\tStatfs: " << pmnt->statfs->c_str() << endl; if(check_dirs_now && pmnt->statfs_io.store != NULL) { ret=plfs_check_dir("statfs",pmnt->statfs_io.prefix, pmnt->statfs_io.store, pmnt->statfs->c_str(),ret,make_dir); } } #ifdef USE_SMALLFILE if (pmnt->file_type == SMALL_FILE) { cout << "\tMax writers: " << pmnt->max_writers << endl; cout << "\tMax cached smallfile containers: " << pmnt->max_smallfile_containers << endl; } #endif cout << "\tChecksum: " << pmnt->checksum << endl; } return ret; }
int main(int argc, char **argv) { int opt; program_options_t options; options.backend = NULL; options.devname = NULL; options.xmlfile = "output.uddf"; options.truncateDives = 0; options.initialPressureFix = 0; options.logfile = "output.log"; options.dumpDives = 1; options.dumpMemory = 0; options.useInvalidElements = 0; static struct option long_options[] = { {"backend", required_argument, NULL, 'b'}, {"device", required_argument, NULL, 'd'}, {"output", required_argument, NULL, 'o'}, {"help", no_argument, NULL, 'h'}, {"ipf", no_argument, NULL, 'i'}, {"truncate", no_argument, NULL, 't'}, {"invalid", no_argument, NULL, 0}, {"listdevices", no_argument, NULL, 0}, {"listbackends", no_argument, NULL, 0}, {NULL, no_argument, NULL, 0} }; char *getopt_short = "b:d:o:hit"; /* getopt_long stores the option index here. */ int option_index = 0; opt = getopt_long (argc, argv, getopt_short, long_options, &option_index); while (opt != -1) { switch (opt) { case 0: /* If this option set a flag, do nothing else now. */ if (long_options[option_index].flag != 0) break; if (g_strcmp0("listdevices", long_options[option_index].name) == 0) { print_devices(); } if (g_strcmp0("listbackends", long_options[option_index].name) == 0) { print_backends(); } if (g_strcmp0("invalid", long_options[option_index].name) == 0) { options.useInvalidElements = 1; } break; case 'b': options.backend = optarg; break; case 'd': options.devname = optarg; break; case 'o': options.xmlfile = optarg; break; case 'i': options.initialPressureFix = 1; break; case 't': options.truncateDives = 1; break; case '?': case 'h': usage(); break; default: printf("Unknown argument: %c", (char)opt); return EXIT_FAILURE; } opt = getopt_long (argc, argv, getopt_short, long_options, &option_index); } if (options.backend == NULL || options.devname == NULL) { usage(); } return dump_dives(&options); }