UnifyFS icon indicating copy to clipboard operation
UnifyFS copied to clipboard

Implement or remove unifycr_get_chunk_list()

Open nedbass opened this issue 8 years ago • 1 comments

Commit 75543ecf7a32f5e4dcf6297ee02a51da7480c360 removed the commented out code from unifycr_get_chunk_list() shown below. This left a function stub behind that should be fully implemented or removed if it's not needed.

 /* get a list of chunks for a given file (useful for RDMA, etc.) */
 chunk_list_t *unifycr_get_chunk_list(char *path)
 {
#if 0
    if (unifycr_intercept_path(path)) {
        int i = 0;
        chunk_list_t *chunk_list = NULL;
        chunk_list_t *chunk_list_elem;

        /* get the file id for this file descriptor */
        /* Rag: We decided to use the path instead.. Can add flexibility to support both */
        //int fid = unifycr_get_fid_from_fd(fd);
        int fid = unifycr_get_fid_from_path(path);
        if (fid < 0) {
            errno = EACCES;
            return NULL;
        }

        /* get meta data for this file */
        unifycr_filemeta_t *meta = unifycr_get_meta_from_fid(fid);
        if (meta) {

            while (i < meta->chunks) {
                chunk_list_elem = (chunk_list_t *)malloc(sizeof(chunk_list_t));

                /* get the chunk id for the i-th chunk and
                 * add it to the chunk_list */
                unifycr_chunkmeta_t *chunk_meta = &(meta->chunk_meta[i]);
                chunk_list_elem->chunk_id = chunk_meta->id;
                chunk_list_elem->location = chunk_meta->location;

                if (chunk_meta->location == CHUNK_LOCATION_MEMFS) {
                    /* update the list_elem with the memory address of this chunk */
                    chunk_list_elem->chunk_offset = unifycr_compute_chunk_buf(meta, chunk_meta->id,
                                                    0);
                    chunk_list_elem->spillover_offset = 0;
                } else if (chunk_meta->location == CHUNK_LOCATION_SPILLOVER) {
                    /* update the list_elem with the offset of this chunk in the spillover file*/
                    chunk_list_elem->spillover_offset = unifycr_compute_spill_offset(meta,
                                                        chunk_meta->id, 0);
                    chunk_list_elem->chunk_offset = NULL;
                } else {
                    /*TODO: Handle the container case.*/
                }

                /* currently using macros from utlist.h to
                 * handle link-list operations */
                LL_APPEND(chunk_list, chunk_list_elem);
                i++;
            }
            return chunk_list;
        } else {
            return NULL;
        }
    } else {
        /* file not managed by UNIFYCR */
        errno = EACCES;
        return NULL;
    }
#endif
    return NULL;
 }

nedbass avatar Dec 22 '17 18:12 nedbass

This will be dropped with https://github.com/LLNL/UnifyCR/pull/241/commits/3fc6eb2fe2d24a494ec235558a0d48cb9a1a58ec

adammoody avatar Dec 17 '18 20:12 adammoody