Skip to content

Commit

Permalink
more code cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Caputi <[email protected]>
  • Loading branch information
Tom Caputi committed Jun 21, 2017
1 parent bbae52c commit dca9200
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,6 @@ extern void delay(clock_t ticks);
#define MSEC_TO_TICK(msec) ((msec) / (MILLISEC / hz))
#define USEC_TO_TICK(usec) ((usec) / (MICROSEC / hz))
#define NSEC_TO_TICK(usec) ((usec) / (NANOSEC / hz))
#define TICK_TO_MSEC(tick) ((tick) * (1000 / hz))

#define gethrestime_sec() time(NULL)
#define gethrestime(t) \
Expand Down
16 changes: 9 additions & 7 deletions module/zfs/dsl_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2611,13 +2611,13 @@ scan_io_queue_issue(dsl_scan_io_queue_t *queue, list_t *io_list)
dsl_scan_t *scn = queue->q_scn;
scan_io_t *sio;
int64_t bytes_issued = 0;
boolean_t pauseed = B_FALSE;
boolean_t paused = B_FALSE;

while ((sio = list_head(io_list)) != NULL) {
blkptr_t bp;

if (scan_io_queue_check_pause(scn)) {
pauseed = B_TRUE;
paused = B_TRUE;
break;
}

Expand Down Expand Up @@ -2645,7 +2645,7 @@ scan_io_queue_issue(dsl_scan_io_queue_t *queue, list_t *io_list)
ASSERT3U(queue->q_zio_bytes, >=, bytes_issued);
atomic_add_64(&queue->q_zio_bytes, -bytes_issued);

return (pauseed);
return (paused);
}

/*
Expand Down Expand Up @@ -2749,18 +2749,20 @@ scan_io_queues_run_one(void *arg)
scan_io_t *sio = NULL;
list_t sio_list;
const range_seg_t *rs;
boolean_t pauseed = B_FALSE;
boolean_t paused = B_FALSE;

ASSERT(queue->q_scn->scn_is_sorted);

list_create(&sio_list, sizeof (scan_io_t),
offsetof(scan_io_t, sio_nodes.sio_list_node));
mutex_enter(q_lock);

/* reset per-queue scan statistics for this txg */
queue->q_avg_seg_size_this_txg = 0;
queue->q_segs_this_txg = 0;
queue->q_avg_zio_size_this_txg = 0;
queue->q_zios_this_txg = 0;
queue->q_dummy_zios_this_txg = 0;

/* loop until we have run out of time or zios */
while ((rs = scan_io_queue_fetch_ext(queue)) != NULL) {
Expand Down Expand Up @@ -2795,18 +2797,18 @@ scan_io_queues_run_one(void *arg)

/* issuing zio's can take a long time so drop the queue lock. */
mutex_exit(q_lock);
pauseed = scan_io_queue_issue(queue, &sio_list);
paused = scan_io_queue_issue(queue, &sio_list);
mutex_enter(q_lock);

/* invalidate the in-flight I/O range */
bzero(&queue->q_issuing_rs, sizeof (queue->q_issuing_rs));
cv_broadcast(&queue->q_cv);

/*
* If we were pauseed in the middle of processing, requeue
* If we were paused in the middle of processing, requeue
* any unfinished zios and exit.
*/
if (pauseed)
if (paused)
break;
}

Expand Down

0 comments on commit dca9200

Please sign in to comment.