block: Seperate read and write statistics of in_flight requests v2
Commita9327cac44
added seperate read and write statistics of in_flight requests. And exported the number of read and write requests in progress seperately through sysfs. But Corrado Zoccolo <czoccolo@gmail.com> reported getting strange output from "iostat -kx 2". Global values for service time and utilization were garbage. For interval values, utilization was always 100%, and service time is higher than normal. So this was reverted by commit0f78ab9899
The problem was in part_round_stats_single(), I missed the following: if (now == part->stamp) return; - if (part->in_flight) { + if (part_in_flight(part)) { __part_stat_add(cpu, part, time_in_queue, part_in_flight(part) * (now - part->stamp)); __part_stat_add(cpu, part, io_ticks, (now - part->stamp)); With this chunk included, the reported regression gets fixed. Signed-off-by: Nikanth Karthikesan <knikanth@suse.de> -- Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
committed by
Jens Axboe
parent
23e018a1b0
commit
316d315bff
@@ -130,7 +130,7 @@ struct mapped_device {
|
||||
/*
|
||||
* A list of ios that arrived while we were suspended.
|
||||
*/
|
||||
atomic_t pending;
|
||||
atomic_t pending[2];
|
||||
wait_queue_head_t wait;
|
||||
struct work_struct work;
|
||||
struct bio_list deferred;
|
||||
@@ -453,13 +453,14 @@ static void start_io_acct(struct dm_io *io)
|
||||
{
|
||||
struct mapped_device *md = io->md;
|
||||
int cpu;
|
||||
int rw = bio_data_dir(io->bio);
|
||||
|
||||
io->start_time = jiffies;
|
||||
|
||||
cpu = part_stat_lock();
|
||||
part_round_stats(cpu, &dm_disk(md)->part0);
|
||||
part_stat_unlock();
|
||||
dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending);
|
||||
dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]);
|
||||
}
|
||||
|
||||
static void end_io_acct(struct dm_io *io)
|
||||
@@ -479,8 +480,9 @@ static void end_io_acct(struct dm_io *io)
|
||||
* After this is decremented the bio must not be touched if it is
|
||||
* a barrier.
|
||||
*/
|
||||
dm_disk(md)->part0.in_flight = pending =
|
||||
atomic_dec_return(&md->pending);
|
||||
dm_disk(md)->part0.in_flight[rw] = pending =
|
||||
atomic_dec_return(&md->pending[rw]);
|
||||
pending += atomic_read(&md->pending[rw^0x1]);
|
||||
|
||||
/* nudge anyone waiting on suspend queue */
|
||||
if (!pending)
|
||||
@@ -1785,7 +1787,8 @@ static struct mapped_device *alloc_dev(int minor)
|
||||
if (!md->disk)
|
||||
goto bad_disk;
|
||||
|
||||
atomic_set(&md->pending, 0);
|
||||
atomic_set(&md->pending[0], 0);
|
||||
atomic_set(&md->pending[1], 0);
|
||||
init_waitqueue_head(&md->wait);
|
||||
INIT_WORK(&md->work, dm_wq_work);
|
||||
init_waitqueue_head(&md->eventq);
|
||||
@@ -2088,7 +2091,8 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible)
|
||||
break;
|
||||
}
|
||||
spin_unlock_irqrestore(q->queue_lock, flags);
|
||||
} else if (!atomic_read(&md->pending))
|
||||
} else if (!atomic_read(&md->pending[0]) &&
|
||||
!atomic_read(&md->pending[1]))
|
||||
break;
|
||||
|
||||
if (interruptible == TASK_INTERRUPTIBLE &&
|
||||
|
Reference in New Issue
Block a user