From 65f2deb557a13728eb4662037609a0820b3fd1bf Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 3 Feb 2006 12:55:49 +0100 Subject: [PATCH] [PATCH] blkparse: don't let ->cur_depth go below zero This can happen if we miss traces, so check for it. --- blkparse.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; -- 2.25.1