diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-24 08:27:02 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-24 08:27:02 -0700 |
commit | 12bac708e6242b0ccd969519582b2938d78289bb (patch) | |
tree | 4cf804bcf1a3afb90044f8b33405ea6713c8731e /include | |
parent | 60911731fe7fd4ec4d088fc1a48a56c9fb14103f (diff) | |
parent | d9ba7615bfd8bb06f79c853f9dfff9e93a837941 (diff) | |
download | linux-12bac708e6242b0ccd969519582b2938d78289bb.tar.bz2 |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
GFS2: Ensure that the inode goal block settings are updated
GFS2: Fix bug in block allocation
bitops: Add __ffs64 bitop
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bitops.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 61829139795a..c05a29cb9bb2 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -112,6 +112,25 @@ static inline unsigned fls_long(unsigned long l) return fls64(l); } +/** + * __ffs64 - find first set bit in a 64 bit word + * @word: The 64 bit word + * + * On 64 bit arches this is a synomyn for __ffs + * The result is not defined if no bits are set, so check that @word + * is non-zero before calling this. + */ +static inline unsigned long __ffs64(u64 word) +{ +#if BITS_PER_LONG == 32 + if (((u32)word) == 0UL) + return __ffs((u32)(word >> 32)) + 32; +#elif BITS_PER_LONG != 64 +#error BITS_PER_LONG not 32 or 64 +#endif + return __ffs((unsigned long)word); +} + #ifdef __KERNEL__ #ifdef CONFIG_GENERIC_FIND_FIRST_BIT |