mirror of https://github.com/schoebel/mars
copy: fix / improve IO debugging
This commit is contained in:
parent
94e1ac2ad0
commit
3f3a4c365a
|
@ -304,7 +304,7 @@ int _make_mref(struct copy_brick *brick, int index, int queue, void *data, loff_
|
||||||
if (queue == 0) {
|
if (queue == 0) {
|
||||||
GET_STATE(brick, index).len = mref->ref_len;
|
GET_STATE(brick, index).len = mref->ref_len;
|
||||||
} else if (unlikely(mref->ref_len < GET_STATE(brick, index).len)) {
|
} else if (unlikely(mref->ref_len < GET_STATE(brick, index).len)) {
|
||||||
MARS_DBG("shorten len %d < %d\n", mref->ref_len, brick->st[index].len);
|
MARS_DBG("shorten len %d < %d at index %d\n", mref->ref_len, GET_STATE(brick, index).len, index);
|
||||||
GET_STATE(brick, index).len = mref->ref_len;
|
GET_STATE(brick, index).len = mref->ref_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ int _next_state(struct copy_brick *brick, int index, loff_t pos)
|
||||||
struct copy_state *st;
|
struct copy_state *st;
|
||||||
char state;
|
char state;
|
||||||
char next_state;
|
char next_state;
|
||||||
bool do_restart;
|
bool do_restart = false;
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -360,9 +360,22 @@ int _next_state(struct copy_brick *brick, int index, loff_t pos)
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
state = next_state;
|
state = next_state;
|
||||||
do_restart = false;
|
|
||||||
|
|
||||||
MARS_IO("index = %d state = %d pos = %lld table[0]=%p table[1]=%p\n", index, state, pos, st->table[0], st->table[1]);
|
MARS_IO("ENTER index=%d state=%d pos=%lld table[0]=%p table[1]=%p active[0]=%d active[1]=%d writeout=%d prev=%d len=%d error=%d do_restart=%d\n",
|
||||||
|
index,
|
||||||
|
state,
|
||||||
|
pos,
|
||||||
|
st->table[0],
|
||||||
|
st->table[1],
|
||||||
|
st->active[0],
|
||||||
|
st->active[1],
|
||||||
|
st->writeout,
|
||||||
|
st->prev,
|
||||||
|
st->len,
|
||||||
|
st->error,
|
||||||
|
do_restart);
|
||||||
|
|
||||||
|
do_restart = false;
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case COPY_STATE_RESET:
|
case COPY_STATE_RESET:
|
||||||
|
@ -562,8 +575,6 @@ restart:
|
||||||
do_restart = (state != next_state);
|
do_restart = (state != next_state);
|
||||||
|
|
||||||
idle:
|
idle:
|
||||||
MARS_IO("index = %d next_state = %d pos = %lld table[0]=%p table[1]=%p\n", index, next_state, pos, st->table[0], st->table[1]);
|
|
||||||
|
|
||||||
if (unlikely(progress < 0)) {
|
if (unlikely(progress < 0)) {
|
||||||
st->error = progress;
|
st->error = progress;
|
||||||
MARS_WRN("progress = %d\n", progress);
|
MARS_WRN("progress = %d\n", progress);
|
||||||
|
@ -574,6 +585,21 @@ idle:
|
||||||
} else if (st->state != next_state) {
|
} else if (st->state != next_state) {
|
||||||
progress++;
|
progress++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MARS_IO("LEAVE index=%d state=%d next_state=%d table[0]=%p table[1]=%p active[0]=%d active[1]=%d writeout=%d prev=%d len=%d error=%d progress=%d\n",
|
||||||
|
index,
|
||||||
|
st->state,
|
||||||
|
next_state,
|
||||||
|
st->table[0],
|
||||||
|
st->table[1],
|
||||||
|
st->active[0],
|
||||||
|
st->active[1],
|
||||||
|
st->writeout,
|
||||||
|
st->prev,
|
||||||
|
st->len,
|
||||||
|
st->error,
|
||||||
|
progress);
|
||||||
|
|
||||||
// save the resulting state
|
// save the resulting state
|
||||||
st->state = next_state;
|
st->state = next_state;
|
||||||
return progress;
|
return progress;
|
||||||
|
|
Loading…
Reference in New Issue