From e6894cabb7224db95780dc8dff9cf8eb9783a8e9 Mon Sep 17 00:00:00 2001 From: Hyogi Sim Date: Thu, 21 Mar 2019 10:58:21 -0400 Subject: [PATCH] Fix the chunk calculation bug in PR292. - in filemeta_get_chunkmeta: chunk limit should be calculated by (max_chunks+spillover_max_chunks) --- client/src/unifycr-fixed.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/src/unifycr-fixed.c b/client/src/unifycr-fixed.c index 19b8d8766..9dc4e101a 100644 --- a/client/src/unifycr-fixed.c +++ b/client/src/unifycr-fixed.c @@ -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]; }