int main (int argc, char **argv) {
    const char *target;
    plfs_error_t ret;
    Plfs_fd *fd;
    int nr;

    if (argc > 1) {
        target = argv[1];
    } else {
        return -1;
    }

    plfs_handle_version_arg(argc, argv[1]);

    fd = NULL;
    ret = plfs_open(&fd, target, O_RDONLY, getpid(), 0777, NULL);
    if (ret != PLFS_SUCCESS) {
        fprintf(stderr, "Couldn't open path %s\n", target);
        exit(1);
    }

    ret = fd->optimize_access();

    if (ret != PLFS_SUCCESS) {
        fprintf(stderr, "optimize_access: flattenIndex of %s failed (%s)\n",
                target, strplfserr(ret));
    } else {
        printf("Successfully flattened index of %s\n",target);
    }

    (void) plfs_close(fd, getpid(), getuid(), O_RDONLY, NULL, &nr);

    exit(( ret == PLFS_SUCCESS) ?  0  : 1);
}
Beispiel #2
0
int main (int argc, char **argv) {
    int i;
    char *target;
    bool found_target = false;
    for (i = 1; i < argc; i++) {
        plfs_handle_version_arg(argc, argv[i]);
        if (strcmp(argv[i], "-nc") == 0) {
            // silently ignore deprecated argument
        } else if (!found_target) {
            target = argv[i];
            found_target = true;
        } else {
            // Found more than one target. This is an error.
            show_usage(argv[0]);
            exit(1);
        }
    }
    if (!found_target) {
        show_usage(argv[0]);
        exit(1);
    }

    int ret = plfs_dump_index(stderr,target,0);
    if ( ret != 0 ) {
        fprintf(stderr, "Error: %s is not in a PLFS mountpoint"
               " configured with 'workload n-1'\n", target);
    }
    exit( ret );
}
int main (int argc, char **argv) {
    const char *target;
    struct plfs_physpathinfo ppi;
    struct plfs_pathback pb;
    plfs_error_t perr;
    Index *index;

    if (argc > 1) {
        target = argv[1];
    } else {
        return -1;
    }
    plfs_handle_version_arg(argc, argv[1]);
    plfs_error_t ret = PLFS_SUCCESS;
    ret = plfs_resolvepath(target, &ppi);
    if (ret != PLFS_SUCCESS) {
        fprintf(stderr, "Couldn't resolve path %s\n", target);
        exit(1);
    }
    
    /*
     * XXXCDC: clearly we assume containerfs here and we totally
     * bypass the logicalfs layer.  maybe "compress_metadata" should
     * be a logicalfs operation?
     */
    pb.bpath = ppi.canbpath;
    pb.back = ppi.canback;

    index = new Index(pb.bpath, pb.back);
    perr = Container::populateIndex(pb.bpath, pb.back, index, false, false, 0);
    if (perr != PLFS_SUCCESS) {
        fprintf(stderr, "populateIndex of %s failed (%s)\n",
                target, strplfserr(perr));
        exit(1);
    }
    perr = Container::flattenIndex(pb.bpath, pb.back, index);
    delete index;
    
    if (perr != PLFS_SUCCESS) {
        fprintf(stderr, "flattenIndex of %s failed (%s)\n",
                target, strplfserr(perr));
        exit(1);
    } else {
        printf("Successfully flattened index of %s\n",target);
    }
    exit(0);
}
int main (int argc, char **argv) {
    const char *target;
    if (argc > 1) {
        target = argv[1];
    } else {
        return -1;
    }
    plfs_handle_version_arg(argc, argv[1]);
    int ret = container_flatten_index(NULL,target);
    if ( ret != 0 ) {
        fprintf( stderr, "Couldn't read index from %s: %s\n", 
                target, strerror(-ret));
        fprintf(stderr, "The file %s does not appear to be on an"
               " n-1 mount point", target);
    } else {
        printf("Successfully flattened index of %s\n",target);
    }
    exit( ret );
}
Beispiel #5
0
int main (int argc, char **argv) {
    const char *target  = argv[1];
    plfs_handle_version_arg(argc, argv[1]);
    if ( ! target ) {
        fprintf(stderr, "Usage: %s [filename | -version]\n", argv[0]);
        exit(-1);
    }
    int ret = plfs_recover(target);
    switch(ret) {
        case 0:
            printf("Successfully recovered %s\n",target);
            break;
        case -EEXIST:
            printf("%s already exists.\n",target);
            ret = 0;
            break;
        default:
            fprintf(stderr,"Couldn't recover %s: %s\n",target,strerror(-ret));
            fprintf(stderr,"%s may not be on a n-1 mount point\n",target);
            break;
    }
    exit( ret );
}
Beispiel #6
0
int main (int argc, char **argv) {
    int i;
    char *target = NULL;
    bool found_target = false;
    int uniform_restart = false;
    pid_t uniform_rank = 0;
    for (i = 1; i < argc; i++) {
        plfs_handle_version_arg(argc, argv[i]);
        if (strcmp(argv[i], "-nc") == 0) {
            // silently ignore deprecated argument
        } else if (strcmp(argv[i], "--uniform") == 0) {
            i++;
            uniform_restart = true;
            uniform_rank = (pid_t)atoi(argv[i]);
            printf("# Building map for only rank %d\n", uniform_rank);
        } else if (!found_target) {
            target = argv[i];
            found_target = true;
        } else {
            // Found more than one target. This is an error.
            show_usage(argv[0]);
            exit(1);
        }
    }
    if (!found_target) {
        show_usage(argv[0]);
        exit(1);
    }

    plfs_error_t ret = PLFS_SUCCESS;
    ret = container_dump_index(stderr,target,0,uniform_restart,uniform_rank);
    if ( ret != PLFS_SUCCESS ) {
        fprintf(stderr, "Error: %s is not in a PLFS mountpoint"
               " configured with 'workload n-1'\n", target);
    }
    exit( plfs_error_to_errno(ret) );
}