From: Jens Axboe Date: Fri, 3 Feb 2006 11:55:49 +0000 (+0100) Subject: [PATCH] blkparse: don't let ->cur_depth go below zero X-Git-Tag: blktrace-0.99.1~72^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=65f2deb557a13728eb4662037609a0820b3fd1bf;p=blktrace.git [PATCH] blkparse: don't let ->cur_depth go below zero This can happen if we miss traces, so check for it. --- diff --git a/blkparse.c b/blkparse.c index 8a9f6d7..7da67a6 100644 --- a/blkparse.c +++ b/blkparse.c @@ -1250,7 +1250,12 @@ static void dump_trace_fs(struct blk_io_trace *t, struct per_dev_info *pdi, log_generic(pci, t, "S"); break; case __BLK_TA_REQUEUE: - pdi->cur_depth[w]--; + /* + * can happen if we miss traces, don't let it go + * below zero + */ + if (pdi->cur_depth[w]) + pdi->cur_depth[w]--; account_requeue(t, pci, w); log_queue(pci, t, "R"); break; @@ -1262,7 +1267,8 @@ static void dump_trace_fs(struct blk_io_trace *t, struct per_dev_info *pdi, log_issue(pdi, pci, t, "D"); break; case __BLK_TA_COMPLETE: - pdi->cur_depth[w]--; + if (pdi->cur_depth[w]) + pdi->cur_depth[w]--; account_c(t, pci, w, t->bytes); log_complete(pdi, pci, t, "C"); break;