Re: How to filter the Block I/O in 2.6 kernel?

From: XiongJia Le
Date: Thu May 22 2008 - 21:20:58 EST


Hi TJ,

I am working on a small tools what can dump all occupied sectors on
the hard disk.
But at dumping time some i/o is still occuring on the disk. So I want
to write a filter in kernel.
If some sector will change at dumping time, I will dump this sector
first and before this sector changed.

I think hook syscall is not enough for me. Because at System Call
layout I can not get the address of the sector what will changed.

Thanks,
Xiongjia Le


On Fri, May 23, 2008 at 12:57 AM, TJ Easter <tjeaster@xxxxxxxxx> wrote:
> XiongJia,
> I am far from a kernel expert, but something you might consider would
> be to write a module that hooks the syscall(s) for I/O, replacing them with
> your own routines, and then passing the altered data along to the original
> syscall. I am not sure that a module will allow you that deep of access
> into the I/O paths, but it might be your easiest option. If I may ask,
> why would you want to alter data between the I/O scheduler and the actual
> disk store? Seems somewhat counter-intuitive to me.
>
> Regards,
> TJ Easter
>
> On Tue, May 20, 2008 at 11:05 PM, XiongJia Le <lexiongjia@xxxxxxxxx> wrote:
>>
>> How to filter the Block I/O in 2.6 kernel?
>>
>> I have looked some in blktrace.
>> blktrace can trace the block device I/O info. But that can't
>> filter/change this I/O.
>>
>> Is the Linux kernel have any way to filter/change a block i/o before
>> it write to hard disk?
>> I don't want to change kernel code and re-build. Is Kernel already
>> have any I/O filter interface?
>>
>> Thanks,
>> Xiongjia Le
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel"
>> in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> "Being a humanist means trying to behave decently without expectation of
> rewards or punishment after you are dead." -- Kurt Vonnegut, 1922 - 2007
> http://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x5EB6E92FE2340DEF
--
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/