mirror of
https://github.com/schoebel/mars
synced 2024-12-24 23:52:46 +00:00
copy: leave lifelock when EOF position decreases
This commit is contained in:
parent
85ca001f9f
commit
d1988b3d7c
@ -57,6 +57,8 @@
|
||||
int mars_copy_overlap = 1;
|
||||
EXPORT_SYMBOL_GPL(mars_copy_overlap);
|
||||
|
||||
int mars_copy_timeout = 180;
|
||||
|
||||
int mars_copy_read_prio = MARS_PRIO_NORMAL;
|
||||
EXPORT_SYMBOL_GPL(mars_copy_read_prio);
|
||||
|
||||
@ -730,6 +732,7 @@ bool _is_done(struct copy_brick *brick)
|
||||
static int _copy_thread(void *data)
|
||||
{
|
||||
struct copy_brick *brick = data;
|
||||
struct timespec last_progress = CURRENT_TIME;
|
||||
|
||||
MARS_DBG("--------------- copy_thread %p starting\n", brick);
|
||||
brick->copy_error = 0;
|
||||
@ -746,8 +749,19 @@ static int _copy_thread(void *data)
|
||||
loff_t old_start = brick->copy_start;
|
||||
loff_t old_end = brick->copy_end;
|
||||
int progress = 0;
|
||||
|
||||
if (old_end > 0) {
|
||||
progress = _run_copy(brick);
|
||||
/* abort when no progress is made for a longer time */
|
||||
if (progress > 0) {
|
||||
last_progress = CURRENT_TIME;
|
||||
} else {
|
||||
struct timespec next_progress = CURRENT_TIME;
|
||||
|
||||
next_progress.tv_sec -= mars_copy_timeout;
|
||||
if (timespec_compare(&next_progress, &last_progress) > 0)
|
||||
brick->is_aborting = true;
|
||||
}
|
||||
}
|
||||
|
||||
wait_event_interruptible_timeout(brick->event,
|
||||
|
@ -33,6 +33,7 @@
|
||||
#define INPUT_B_COPY 3
|
||||
|
||||
extern int mars_copy_overlap;
|
||||
extern int mars_copy_timeout;
|
||||
extern int mars_copy_read_prio;
|
||||
extern int mars_copy_write_prio;
|
||||
extern int mars_copy_read_max_fly;
|
||||
|
@ -320,6 +320,7 @@ struct ctl_table mars_table[] = {
|
||||
#endif
|
||||
INT_ENTRY("io_flying_count", mars_global_io_flying, 0400),
|
||||
INT_ENTRY("copy_overlap", mars_copy_overlap, 0600),
|
||||
INT_ENTRY("copy_timeout", mars_copy_timeout, 0600),
|
||||
INT_ENTRY("copy_read_prio", mars_copy_read_prio, 0600),
|
||||
INT_ENTRY("copy_write_prio", mars_copy_write_prio, 0600),
|
||||
INT_ENTRY("copy_read_max_fly", mars_copy_read_max_fly, 0600),
|
||||
|
Loading…
Reference in New Issue
Block a user