Skip to content
Snippets Groups Projects
Commit 0ee8fd76 authored by Iustin Pop's avatar Iustin Pop
Browse files

Update all needed node fields on f_mem change

This fixes the setFmem function which didn't compute other related
fields after free memory change. Ideally, this should be abstracted so
that add/remove Pri and similar functions could reuse it instead of
duplicating code.
parent 53f00b20
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,11 @@ setXmem t val = t { x_mem = val }
-- | Sets the free memory
setFmem :: Node -> Int -> Node
setFmem t val = t { f_mem = val }
setFmem t new_mem =
let new_n1 = computeFailN1 (r_mem t) new_mem (f_dsk t)
new_mp = (fromIntegral new_mem) / (t_mem t)
in
t { f_mem = new_mem, failN1 = new_n1, p_mem = new_mp }
-- | Given the rmem, free memory and disk, computes the failn1 status.
computeFailN1 :: Int -> Int -> Int -> Bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment