Disk IO statistics for all disks



What's new

01/25/02  Updated patches for 2.5.2 and 2.4.17


The problem

This work is intended to extend the gathering of disk statistics to include major numbers greater than 15.

In the current implementation, the disk io statistics is done by a global static data buffer, whose size is limited by DK_MAX_MAJOR.  This causes /proc/stat only reports disk io statistics for major <16. 


Possible Solutions

Two approaches have been proposed here:

1.   The first method is based on current implement. The idea of this approach is: dynamically allocate a disk statistics structure when a new block device is registered.  A global array  (kstat.dkdrive_info[MAX_DEVBLK]) is used to hold the address of the statistics structures for all block devices.  The  disk statistics lookup is kept the same as before: indexed by the major number and the disk number.  Noticed that the disk number is abstained by calling the disk_index() function.  Doing so could support disk statistics for every major without cost too much memory.

Patch is available here. In addition, in order to make disk index lookup work for more disks,  the corresponding changes in disk_index() is taken from linux-2.4.10-ac kernel and  included in this patch.  The patch is posted on linux kernel mail list and lse-tech mail list.  Here is the discussions.

2.  The second way to do statistics for all disks is,  moving statistics data into request queue structure.  The statistics data structure is allocated and initialized when the corresponding block request queue is initialized.  Every device has a request queue associated with it.  In this way the statistics information is self-contained in the controller itself, and it avoid the lookup when doing the statistics,  since the request queue data structure is already there when the statistics is about to collect.

Patch was created and posted to linux kernel mail list and lse-tech mail list.  Here is the discussions.


Patches

Array method(first method) :

Patch for 2.4.14 ,
Patch for 2.4.17 ,
Patch for 2.5.2

Request_queue method (second method):
Patch for 2.4.14 ,
Patch for 2.4.17 ,
Patch for 2.5.2



Related discusstions

Jesse Barnes posted his sard patch on lse-tech. It exports a lot info to /proc/partitions that user level utilities can collect for analysis.  His patch is here.


Contact

Please send your comments to Mingming Cao regarding to this work. Welcome any feedbacks.