All of lore.kernel.org
 help / color / mirror / Atom feed
* bio size is always 4096
@ 2013-05-13 15:32 neha naik
  2013-05-14  5:28 ` Pranay Srivastava
  0 siblings, 1 reply; 2+ messages in thread
From: neha naik @ 2013-05-13 15:32 UTC (permalink / raw)
  To: kernelnewbies

Hi,
   I was under the impression that when the bio comes to a block device
driver its size is variable. But, after writing a block device driver i
realized that such is not the case and it always is 4096.
Does this mean that by default if i don't use any merge function the bio
will always have size 4096(meaning it will have only 1 page!!!!).


Regards,
Neha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130513/dad7d6ae/attachment.html 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bio size is always 4096
  2013-05-13 15:32 bio size is always 4096 neha naik
@ 2013-05-14  5:28 ` Pranay Srivastava
  0 siblings, 0 replies; 2+ messages in thread
From: Pranay Srivastava @ 2013-05-14  5:28 UTC (permalink / raw)
  To: kernelnewbies

Hi Neha

On 5/13/13, neha naik <nehanaik27@gmail.com> wrote:
> Hi,
>    I was under the impression that when the bio comes to a block device
> driver its size is variable. But, after writing a block device driver i
> realized that such is not the case and it always is 4096.

Your Filesystem block size is usually page size so from file system
point of view your bios would be that of block size that the
filesystem understands. Try having a file system block size other than
PAGE_SIZE (must be multiple of 512 and <=PAGE_SIZE) though.

> Does this mean that by default if i don't use any merge function the bio
> will always have size 4096(meaning it will have only 1 page!!!!).

I guess it's not about that if you don't use a merge function. Bios
would be given by file system to your driver depending on the block
size of the file system. Now there would most probably be a mismatch
of granularity of file system block size and your device's block size.

If every thing is default and File System block size == PAGE_SIZE and
by default the block size for your device is taken to be 512 (kernel
always works in 512 bytes for block device). This means 4096/512 = 8
sectors per bio.

Actually if you see this,

--------> set_min_blocksize

This would make it clear that the block size of the file system would
be larger of the block size of block size of your device and the block
size of your file system. I guess while formatting the mkfs would also
try to match it like that or it may be fixed.

You can change the block size of your device by doing
blk_queue_logical_block_size before you make you add your disk. Again,
if you do this your request handling function must be able to
translate everything to/from 512 bytes since for kernel everything is
in 512 size sectors.

So you can check
 a) By changing the block size of file system first.
 b) By changing the block size of device.
 c) Do both
By changing i mean don't use PAGE_SIZE for file system and don't use
512 bytes for device's block size.

>
>
> Regards,
> Neha
>

    ---P.K.S
-- 
Pranay Srivastava

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-14  5:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-13 15:32 bio size is always 4096 neha naik
2013-05-14  5:28 ` Pranay Srivastava

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.