This doesn't compute the block size, it computes the number of block in a block device. I think it would be useful to add a generic helper (e.g. in blkdev.h) as this calculation seems to be open coded in various places.
- Re: [PATCH] target/iblock: use ilog2 to compute block si... Christoph Hellwig
- Re: [PATCH] target/iblock: use ilog2 to compute blo... Arnd Bergmann