Re: reading 1 hardsector size, not one block size

From: Alexander Viro (viro@math.psu.edu)
Date: Sat Sep 30 2000 - 03:02:04 EST


On Sat, 30 Sep 2000, Andre Hedrick wrote:

> Can you tell me how to get/do this request? (seriously).
>
> read(32 sectors, beginning at LBA 50)
>
> How can one do this through the FS-layer?

<blinks> WTF does FS have to that? But anyway, the most trivial way is
to have the driver set blk_size[major][minor] to sector size and do

        fd = open("your_device_name",O_RDONLY);
        lseek(fd, 25600, 0);
        read(fd, buf, 16384);

Driver will get a sequence of requests in its queue. Requests will have
->rq_dev set to your device, ->sector from 50 to 81 and ->nr_sectors == 1
(provided that they will not get merged, indeed). It's up to the driver
to decide what to do with them. For the rest of kernel device is just a
linear array of blocks. Where/how do you get the data for block number n
is entirely up to the driver. You get to decide how to interpret these
numbers - upper layers simply do not give a damn. If you treat
req->sector==50 as "access sector with LBA==50" - that's it.

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



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:26 EST