Block I/O sizes
Hi,
I've added a jprobe to generic_make_request and am print(k)ing thebio->bi_sector and
bio_sectors(bio) for every bio.
I expected that for every bio thus printed the bi_sector would be
in terms of sector size.
But this is apparently not the case.
When any fs i/o is done, the bi_sector value is in terms of fs
block size and not sector size (for the block device). When i perform raw i/o to the device ( dd for eg ), bi_sector is in terms of sectors and not fs blocks.
In both the cases though, bio_sectors(bio) returns the amount of
data written in sectors.
To me this is rather strange. Should it not be in terms of sector size always ?
Can someone please explain ?
Thanks
-BD
Quoted 11 lines · Block Device
When any fs i/o is done, the
bi_sectorvalue is in terms of fs
block size and not sector size (for the block device). When i perform raw i/o to the device ( dd for eg ),bi_sectoris in terms of sectors and not fs blocks.In both the cases though,
bio_sectors(bio)returns the amount of
data written in sectors.To me this is rather strange. Should it not be in terms of sector size always ?
Can someone please explain ?
bio_sectors is a macro which calculates nr_sectors from the bi_size field, and as far as bi_sector is concerned, I always considered and used as a sector (in terms of sector size) in my block-device drivers whether the user is performing dd or anything else. And you can also see ll_rw_blk.c in function __make_request its considering bio->bi_sector as sector like this:
sector_t sector; sector = bio->bi_sector; nr_sectors = bio_sectors(bio);
So, I don't think bi_sector in some case contains block_nr or sector_nr, rather it always keeps sector_nr (CMIIW)
And __please__ change your name from Block Device to your real name, its annoying to see Block Device as a name of a person. :(
--
Fawad Lateef
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Block Device
Quoted 5 lines · Fawad Lateef
So, I don't think
bi_sectorin some case containsblock_nrorsector_nr, rather it always keepssector_nr(CMIIW)
Quoted 9 lines
Thanks, I realized I was not checking it correctly. It is always in terms of sectors as you
say.Quoted 2 lines
And
__please__change your name from Block Device to your real name, its annoying to see Block Device as a name of a person. :(But really, my real name is block device ... I cant help it ;) !
First do reply through reply_to_all, and Second is how your real name is block device ? Are they really exists and known by your parents at that time ? :S ;)
--
Fawad Lateef