Skip to content

Commit

Permalink
Fix the chunk calculation bug in PR292.
Browse files Browse the repository at this point in the history
- in filemeta_get_chunkmeta: chunk limit should be calculated by
  (max_chunks+spillover_max_chunks)
  • Loading branch information
sandrain authored and adammoody committed Mar 21, 2019
1 parent 0e88d9d commit e6894ca
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion client/src/unifycr-fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@ unifycr_chunkmeta_t* filemeta_get_chunkmeta(const unifycr_filemeta_t* meta,
int cid)
{
unifycr_chunkmeta_t* chunkmeta = NULL;
uint64_t limit = 0;

if (meta && (cid >= 0 && cid < unifycr_max_chunks)) {
if (unifycr_use_memfs) {
limit += unifycr_max_chunks;
}

if (unifycr_use_spillover) {
limit += unifycr_spillover_max_chunks;
}

if (meta && (cid >= 0 && cid < limit)) {
chunkmeta = &unifycr_chunkmetas[meta->chunkmeta_idx + cid];
}

Expand Down

0 comments on commit e6894ca

Please sign in to comment.