Help understanding block layer sample in LDD3

Pranay Srivastava pranjas at gmail.com
Fri Jul 29 06:56:41 EDT 2016


On Fri, Jul 29, 2016 at 4:15 PM, François <fser at code-libre.org> wrote:
> On Fri, Jul 29, 2016 at 03:58:28PM +0530, Pranay Srivastava wrote:
>>
>> I don't see req->buffer. Which version you are using?
>
> You're absolutely right. Both [1] and [2] seems to be outdated.
> I'm currently compiling and testing most of my code on a 3.19 on a 14.04 LTS ubuntu in a VM,
> rather than the actual kernel. It's simpler for me to work that way.
>
> [1] https://github.com/martinezjavier/ldd3/blob/master/sbull/sbull.c#L119
> [2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/block/biodoc.txt
>
> [...]
>>
>> If this is a memory backed block driver, then perhaps you can handle
>> multiple requests[?]. I don't think you need
>> to actually break up the same request into multiple requests.
>
> Actually, it is a shared memory based. Hence, a request might larger than the available room in
> the shared memory. This case has to be handled.

So basically you hold on to some pages[?] and use that as your disk right?
I guess setcapacity should take care of this [no?]

I think if you just take care of the proper mapping of sector(s) to
your driver then
it should be alright.

Too large request shouldn't reach your driver even when you
have the device opened as raw and not mounted it.

>
> Thanks for your input!
>
> --
> François



-- 
        ---P.K.S



More information about the Kernelnewbies mailing list