Introduce a dynamic minimum to dsk_reserve_chunks ...

... such that the total reserve is no less than 2MB.

This is required for stable operation of LRU when the log is full.

Ref #28
parent e17e841f
...@@ -92,6 +92,18 @@ stvfe_tune_check(struct stvfe_tune *tune) ...@@ -92,6 +92,18 @@ stvfe_tune_check(struct stvfe_tune *tune)
tune->mem_reserve_chunks = l; tune->mem_reserve_chunks = l;
} }
// 2MB
if (tune->chunk_exponent < 21U) {
l = 1U << (21U - tune->chunk_exponent);
if (tune->dsk_reserve_chunks < l) {
fprintf(stderr,"fellow: dsk_reserve_chunks raised from "
"%u to %u (x %zu) for minimum size of 2MB\n",
tune->dsk_reserve_chunks, l,
(size_t)1 << tune->chunk_exponent);
tune->dsk_reserve_chunks = l;
}
}
sz = tune->dsksz >> (tune->chunk_exponent + 3); sz = tune->dsksz >> (tune->chunk_exponent + 3);
assert(sz <= UINT_MAX); assert(sz <= UINT_MAX);
l = (unsigned)sz; l = (unsigned)sz;
......
...@@ -612,7 +612,7 @@ fellow storage can be fine tuned: ...@@ -612,7 +612,7 @@ fellow storage can be fine tuned:
- unit: scalar - unit: scalar
- default: 4 - default: 4
- minimum: 2 - minimum: 2 MB / chunk_bytes
- maximum: dsksize / 8 / chunk_bytes - maximum: dsksize / 8 / chunk_bytes
specifies a number of chunks to reserve on disk. The reserve is used specifies a number of chunks to reserve on disk. The reserve is used
...@@ -623,6 +623,9 @@ fellow storage can be fine tuned: ...@@ -623,6 +623,9 @@ fellow storage can be fine tuned:
fixed log space is full, might momentarily require additional space fixed log space is full, might momentarily require additional space
before making room. before making room.
The value is always raised to a dynamic minimum such that the disk
reserve is at least 2MB.
The value is capped suck that the number of reserved chunks times The value is capped suck that the number of reserved chunks times
the chunk size does not exceed 1/8 of the disk size. the chunk size does not exceed 1/8 of the disk size.
......
...@@ -548,7 +548,7 @@ fellow storage can be fine tuned: ...@@ -548,7 +548,7 @@ fellow storage can be fine tuned:
- unit: scalar - unit: scalar
- default: 4 - default: 4
- minimum: 2 - minimum: 2 MB / chunk_bytes
- maximum: dsksize / 8 / chunk_bytes - maximum: dsksize / 8 / chunk_bytes
specifies a number of chunks to reserve on disk. The reserve is used specifies a number of chunks to reserve on disk. The reserve is used
...@@ -559,6 +559,9 @@ fellow storage can be fine tuned: ...@@ -559,6 +559,9 @@ fellow storage can be fine tuned:
fixed log space is full, might momentarily require additional space fixed log space is full, might momentarily require additional space
before making room. before making room.
The value is always raised to a dynamic minimum such that the disk
reserve is at least 2MB.
The value is capped suck that the number of reserved chunks times The value is capped suck that the number of reserved chunks times
the chunk size does not exceed 1/8 of the disk size. the chunk size does not exceed 1/8 of the disk size.
......
...@@ -230,10 +230,6 @@ client c5 -repeat 1 { ...@@ -230,10 +230,6 @@ client c5 -repeat 1 {
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.body == "" expect resp.body == ""
txreq -url "/tune" -hdr "dsk-reserve-chunks: 1"
rxresp
expect resp.status == 400
expect resp.body == "Value of dsk_reserve_chunks is too small, minimum is 2"
} -start } -start
client c6 -repeat 1 { client c6 -repeat 1 {
......
...@@ -235,10 +235,6 @@ client c5 -repeat 1 { ...@@ -235,10 +235,6 @@ client c5 -repeat 1 {
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.body == "" expect resp.body == ""
txreq -url "/tune" -hdr "dsk-reserve-chunks: 1"
rxresp
expect resp.status == 400
expect resp.body == "Value of dsk_reserve_chunks is too small, minimum is 2"
} -start } -start
client c6 -repeat 1 { client c6 -repeat 1 {
......
...@@ -238,10 +238,6 @@ client c5 -repeat 1 { ...@@ -238,10 +238,6 @@ client c5 -repeat 1 {
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.body == "" expect resp.body == ""
txreq -url "/tune" -hdr "dsk-reserve-chunks: 1"
rxresp
expect resp.status == 400
expect resp.body == "Value of dsk_reserve_chunks is too small, minimum is 2"
} -start } -start
client c6 -repeat 1 { client c6 -repeat 1 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment