block size check in __getblk_slow

piyush moghe pmkernel at gmail.com
Mon Jun 27 04:53:24 EDT 2011


Hi All,

I am new to linux kernel code and interested in filesystems and block I/O.

While going through the block read code ( in __bread function ) I found that
when we try to read the block ( __getblk ) we first check for the block
buffer page in page cache ( using __find_get_block function ) and if not we
do a slow path ( using __getblk_slow function which checks page in cache
again and if not found again then allocate a buffer page in cache ).

Now my problem is, as part of __getblk_slow  we compare block size with bdev
logical block size and also check that block size should not be less than
512 and not greater than PAGE_SIZE ( 4K, for PAGE_SHIFT set to 13 )
 although these all checks can be moved to upper level function i.e __getblk
and that too before calling __find_get_block ( to find block in page cache )
so as to avoid looking for block in page cache if the size is invalid.

Please let me know your comments on this.

Regards,
Piyush Moghe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110627/954c1be9/attachment.html 


More information about the Kernelnewbies mailing list