Hi All,

I'm using SLES11 (kernel 2.6.32)


I recently did a dummy code for block device driver where the whole disk is 
made of pages in memory. I have some query regarding usage of some of the 
functions,

I've absolutely no idea what the first 2 do. What I was trying to do was that I 
wanted the block layer to give my driver requests which are aligned according 
to my device's minimum sector size. Since I wanted to play with the driver I 
chose 1024 bytes instead of 512, however I've tried with 2048 bytes device 
sector size as well and all seems well :D

Now the problem is kernel wants to give everything in 512 byte but I want to 
receive everything aligned properly according to my device's sector size. So I 
looked in kernel code and I thought I could use the functions below...

1. blk_limits_io_min: 
No clue about this one, in-fact the device didn't got added when I used this.


2. blk_queue_physical_block_size:
This one checks the logical block size before it sets physical block size 
itself. But not really sure about it's purpose

3. blk_queue_logical_block_size:
I think this is the one responsible that I get requests properly aligned to 
device's sector size? Not really sure...


4. set_capacity:
There's also a callback in block_device_operations by this name? However this 
function just sets the size of part0 of the gendisk. I've not seen the callback 
being called upon, I used some print statements and I never see them. So what's 
the purpose of the callback?

Lastly:
There's a field gd->start in gendisk which apparently sets the start of data 
sector? But why would block layer be bothered with that? Is this used by 
filesystems since application programs certainly can write to sector 0 as well 
right?


And a couple more :P ,

When I try to use fdisk on the disk, it seems to create partition table (I 
think), however when it tries to read the partition table again I get invalid 
argument to ioctl. So I think I'm missing an ioctl call in my driver correct? 
I've none yet though. 

However this issue aside, if I'm able to create a partition then my driver 
should be able to handle additional disks correct? And it would follow the same 
operations when I added my module and called add_disk the first time correct? 

Thanks a lot for reading!




Regards,
Pranay Kr. Srivastava
pranay.shrivast...@hcl.com
Software Engineer
ERS,HCL Technologies
A-5, Sector 24, Noida 201301, U.P. (India)



::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information 
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in 
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on 
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the 
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written 
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please 
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and 
other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to