public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ide-io.c, kernel 2.4.22 Fix for IO stats in /proc/partitions, was Re: sard/iostat disk I/O statistics/accounting for 2.5.8-pre3
@ 2003-09-15 20:21 Chad Talbott
  2003-09-21 22:47 ` J.A. Magallon
  0 siblings, 1 reply; 4+ messages in thread
From: Chad Talbott @ 2003-09-15 20:21 UTC (permalink / raw)
  To: jo-lkml, hch; +Cc: linux-kernel

I found the cause of ide disks' ios_in_flight going negative in
/proc/partitions.

It's due to unbalanced calls to up_ios and down_ios.  After an
explicit drive command, ide-io.c's ide_end_drive_cmd calls
end_that_request_last which eventually calls down_ios to decrement
ios_in_flight, however there is no corresponding call to up_ios when
the command is initiated.

My guess is that ios_in_flight goes negative when the drive is idle
because many people run hdparm in an init script, and this decrements
ios_in_flight early on.  It stays off center from there.

The following hack to ide_end_drive_cmd is a workaround, I would
rather call up_ios appropriately, so that explicit ide commands are
properly accounted.  However I'm having a hard time identifying all
the places that initiate a low-level drive command.  I'll look into a
proper fix, but someone else probably knows the ide layer better than
me.

Chad

--- linux-2.4.18-old/drivers/ide/ide-io.c	15 Sep 2003 17:41:32 -0000
+++ linux-2.4.18-new/drivers/ide/ide-io.c	15 Sep 2003 20:11:12 -0000
@@ -148,6 +148,7 @@
 	ide_hwif_t *hwif = HWIF(drive);
 	unsigned long flags;
 	struct request *rq;
+	struct completion *waiting;
 
 	spin_lock_irqsave(&io_request_lock, flags);
 	rq = HWGROUP(drive)->rq;
@@ -221,7 +222,13 @@
 	spin_lock_irqsave(&io_request_lock, flags);
 	blkdev_dequeue_request(rq);
 	HWGROUP(drive)->rq = NULL;
-	end_that_request_last(rq);
+
+	waiting = req->waiting;
+	req_finished_io(req);
+	blkdev_release_request(req);
+	if (waiting)
+		complete(waiting);
+
 	spin_unlock_irqrestore(&io_request_lock, flags);
 }
 


^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <20030924092418.A28838@devserv.devel.redhat.com>]

end of thread, other threads:[~2003-09-24 14:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-15 20:21 [PATCH] ide-io.c, kernel 2.4.22 Fix for IO stats in /proc/partitions, was Re: sard/iostat disk I/O statistics/accounting for 2.5.8-pre3 Chad Talbott
2003-09-21 22:47 ` J.A. Magallon
2003-09-23 18:09   ` Chad Talbott
     [not found] <20030924092418.A28838@devserv.devel.redhat.com>
2003-09-24 14:15 ` Stephen C. Tweedie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox