Looking at the patch, you introduce a static inline blksize_bits. Wouldn't
it be a lot more efficient to change the function to say:
static inline unsigned int blksize_bits(unsigned int size)
{
return ffs(size) - 1;
}
and optionally, throw in a power of two assertion a-la:
static inline unsigned int blksize_bits(unsigned int size)
{
if (!(size & size - 1))
return ffs(size) - 1;
BUG();
}
Or am I barking mad and block sizes which are not a power of two are valid? (-;
Your version is not too happy with such beasts either but it does round
down rather than do god knows what in arch specific ffs() implementation...
Haven't looked at non-ia32 code but at least ia32's implementation fails
miserably for non-powers of two by it's design. But it should be a lot
faster than doing the while loop considering ffs() just uses a single CPU
instruction instead of the loop (on ia32 anyway).
Best regards,
Anton
-- "Nothing succeeds like success." - Alexandre Dumas-- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/ ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/