Reposting as first post didn't make to the list :)
ATAPI block devices support a command READ_CAPACITY that returns "Last
Logical Block Address" and "Block Length in Bytes".
Given that "Block Length in Bytes" is returned 512 which is equal to
kernel sector size; is value returned by "Last Logical Block Address"
used in set_capacity function of the block device driver?
My 512 MB mass storage device returns "Last Logical Block Address" as
0xF5FFF. But if I use this value as
set_capacity(my_disk, 0xF5FFF);
I get following kinds of error/warning messages:
p1 exceeds device capacity
attempt to access beyond end of device
MY_DEVICE: rw=0, want=1007616, limit=1007615
I tried to analyze kernel source code printing these messages. These
messages are from fs/partitions/check.c file. In this file a piece of
source code evaluates following expression:
if (from + size > get_capacity(disk)) {
printk(" %s: p%d exceeds device capacity\n", disk->disk_name, p);
}
'from' and 'size' are sector start address and sector size
respectively. These values are read from partition on the device
(partition was created by a working driver on Linux). Since my device
driver is able to find partition correctly, I believe 'from' and
'size' should also be read correctly. Therefore possibility is that
get_capacity is returning lesser disk capacity than actual which was
set by set_capacity.
How to determine what argument value should be used in set_capacity function?
Thanks
-Lal
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ