It depends on the specific type of driver and device. For a SCSI device, SCSI commands go to the device driver. They are generated at the SCSI level and sent to the device by the device driver, then to the device.
There is a big abstraction from the sys_write system call until the data has been transferred to the device, and the device driver itself cannot even know what it is writing.
For your editing, look at blktrace: http://linux.die.net/man/8/blktrace
Ok, another answer; You will like it better. This happens in generic_make_request. Comments are sufficiently outlined: http://lxr.linux.no/#linux+v2.6.32/block/blk-core.c#L1380
The biostructure in this function, seen here: http://lxr.linux.no/#linux+v2.6.32/include/linux/bio.h#L58
shows bio_vec, which is a list of things going to the device.
q-> make_request_fn (q, bio); is the actual call to a function pointer in the device itself.
http://lxr.linux.no/#linux+v2.6.32/include/linux/types.h#L126
Shows how indexes are used to write to a section. It should be noted that this is not just used for recording.
Whirlwind
source share