2005-10-25 09:43:28

by Block Device

[permalink] [raw]
Subject: Block I/O sizes

Hi,

I've added a jprobe to generic_make_request and am print(k)ing the
bio->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


2005-10-25 10:15:10

by Fawad Lateef

[permalink] [raw]
Subject: Re: Block I/O sizes

On 10/25/05, Block Device <[email protected]> wrote:
> 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 ?
>

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

2005-10-25 14:12:37

by Fawad Lateef

[permalink] [raw]
Subject: Re: Block I/O sizes

On 10/25/05, Block Device <[email protected]> wrote:
>
> >On 10/25/05, Fawad Lateef <[email protected]> wrote:
>>
> > So, I don't think bi_sector in some case contains block_nr or
> > sector_nr, rather it always keeps sector_nr (CMIIW)
>
> Thanks, I realized I was not checking it correctly. It is always in
> terms of sectors as you
> say.
>
> > 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