mirror of https://github.com/schoebel/mars
copy: safeguard writeout flag
This commit is contained in:
parent
b53b3777d4
commit
7c59774177
|
@ -77,10 +77,10 @@
|
||||||
|
|
||||||
#include "mars_copy.h"
|
#include "mars_copy.h"
|
||||||
|
|
||||||
int mars_copy_overlap = 1;
|
/* Always leave at 1, disable only for throughput _testing_.
|
||||||
EXPORT_SYMBOL_GPL(mars_copy_overlap);
|
* 0 = ONLY FOR EXPERTS => may lead to INCONSISTENCIES
|
||||||
|
* 1 = only obey the start order, but not the completion order
|
||||||
/* Always leave at 1, disable only for throughput _testing_ */
|
*/
|
||||||
int mars_copy_strict_write_order = 1;
|
int mars_copy_strict_write_order = 1;
|
||||||
|
|
||||||
int mars_copy_timeout = 180;
|
int mars_copy_timeout = 180;
|
||||||
|
@ -795,6 +795,17 @@ restart:
|
||||||
if (READ_ONCE(st->active[1])) {
|
if (READ_ONCE(st->active[1])) {
|
||||||
goto idle;
|
goto idle;
|
||||||
}
|
}
|
||||||
|
/* Attention! overlapped IO behind EOF could
|
||||||
|
* lead to temporary inconsistent state of the
|
||||||
|
* file, because the write order may be different from
|
||||||
|
* strict O_APPEND behaviour.
|
||||||
|
*
|
||||||
|
* Notice: temporary inconsistencies _behind_ EOF
|
||||||
|
* cannot be compensated by the page cache.
|
||||||
|
* If the machine crashes right during such a
|
||||||
|
* temporary inconsistency, unnecessary DefectiveLog
|
||||||
|
* (or similar) is likely to appear.
|
||||||
|
*/
|
||||||
/* start writeout */
|
/* start writeout */
|
||||||
status = _make_mref(brick, index, 1, mref0->ref_data,
|
status = _make_mref(brick, index, 1, mref0->ref_data,
|
||||||
pos, pos + mref0->ref_len,
|
pos, pos + mref0->ref_len,
|
||||||
|
@ -805,13 +816,13 @@ restart:
|
||||||
next_state = COPY_STATE_RESET;
|
next_state = COPY_STATE_RESET;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Attention! overlapped IO behind EOF could
|
/*
|
||||||
* lead to temporary inconsistent state of the
|
* Attention: set the writeout flag _after_ actual
|
||||||
* file, because the write order may be different from
|
* IO had been started.
|
||||||
* strict O_APPEND behaviour.
|
|
||||||
*/
|
*/
|
||||||
if (mars_copy_overlap)
|
if (mars_copy_strict_write_order)
|
||||||
st->writeout = true;
|
WRITE_ONCE(st->writeout, true);
|
||||||
|
|
||||||
next_state = COPY_STATE_WRITTEN;
|
next_state = COPY_STATE_WRITTEN;
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
goto label_COPY_STATE_WRITTEN;
|
goto label_COPY_STATE_WRITTEN;
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#define INPUT_B 1
|
#define INPUT_B 1
|
||||||
#define COPY_INPUT_NR 2
|
#define COPY_INPUT_NR 2
|
||||||
|
|
||||||
extern int mars_copy_overlap;
|
|
||||||
extern int mars_copy_strict_write_order;
|
extern int mars_copy_strict_write_order;
|
||||||
extern int mars_copy_timeout;
|
extern int mars_copy_timeout;
|
||||||
extern int mars_copy_read_prio;
|
extern int mars_copy_read_prio;
|
||||||
|
|
|
@ -655,7 +655,6 @@ struct ctl_table mars_table[] = {
|
||||||
VEC_INT_ENTRY("mem_alloc_max", brick_mem_alloc_count, 0600, BRICK_MAX_ORDER+1),
|
VEC_INT_ENTRY("mem_alloc_max", brick_mem_alloc_count, 0600, BRICK_MAX_ORDER+1),
|
||||||
#endif
|
#endif
|
||||||
INT_ENTRY("io_flying_count", mars_global_io_flying, 0400),
|
INT_ENTRY("io_flying_count", mars_global_io_flying, 0400),
|
||||||
INT_ENTRY("copy_overlap", mars_copy_overlap, 0600),
|
|
||||||
INT_ENTRY("copy_strict_write_order", mars_copy_strict_write_order, 0600),
|
INT_ENTRY("copy_strict_write_order", mars_copy_strict_write_order, 0600),
|
||||||
INT_ENTRY("copy_timeout", mars_copy_timeout, 0600),
|
INT_ENTRY("copy_timeout", mars_copy_timeout, 0600),
|
||||||
INT_ENTRY("copy_read_prio", mars_copy_read_prio, 0600),
|
INT_ENTRY("copy_read_prio", mars_copy_read_prio, 0600),
|
||||||
|
|
Loading…
Reference in New Issue