Re: Trapping Block I/O

From: Fawad Lateef
Date: Fri Sep 23 2005 - 12:38:44 EST


On 9/23/05, Block Device <blockdevice@xxxxxxxxx> wrote:
>
> I need to trap _all_ the I/O going to each and every block device
> in the system. I used jprobes to trap calls to generic_make_request.
> Is this the correct/only place to do such a thing ?
> Or do I have to monitor the q->make_request_fn for every device ?
>

Yes, generic_make_request or monitoring q->make_request_fn can trap
the _all_ I/O tpo block devices but other approach might be a little
bit odd/difficult but through that you can get every request to block
device .... the approach is you create a block device and then create
that block device as a wrapper on your device, now use your block
device and in its request function (can alter the data and sectors
etc) and calls generic_make_request for the original device on which
you created wrapper .... So by doing this you can easily monitor
requests (similar to this approach is used in LVM/RAID) ......


--
Fawad Lateef
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/