Skip to contentSkip to conversation

s390: fix ext2_find_next_bit

PATCH New Eric Sandeen 1 participant 1 message Aug 21, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390: fix ext2_find_next_bit

(oops, left off the s390 list on the first send)

The following changes get ext4 on s390 up and running for me.

the switch from ffs to __ffs changes where we start counting (if the first bit is set, is that "0" or "1?" ext2 wants to start counting with "0") and the rest is, honestly, just lifted from the stock find_next_bit() implementation.

--

arch/s390/include/asm/bitops.h +3 -3
Index: linux-2.6/arch/s390/include/asm/bitops.h
===================================================================
@@ -862,10 +862,10 @@ static inline int ext2_find_next_bit(voi
 	p = addr + offset / __BITOPS_WORDSIZE;
 	if (bit) {
 		/*
-		 * s390 version of ffz returns __BITOPS_WORDSIZE
-		 * if no zero bit is present in the word.
+		 * s390 version of ffs returns __BITOPS_WORDSIZE
+		 * if no set bit is present in the word.
 		 */
-		set = ffs(__load_ulong_le(p, 0) >> bit) + bit;
+		set = __ffs(__load_ulong_le(p, 0) & (~0UL << bit));
 		if (set >= size)
 			return size + offset;
 		if (set < __BITOPS_WORDSIZE)