All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390: fix ext2_find_next_bit
@ 2008-08-21  6:18 Eric Sandeen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sandeen @ 2008-08-21  6:18 UTC (permalink / raw)
  To: linux-s390, Martin Schwidefsky
  Cc: ext4 development, Jan Glauber, Josef 'Jeff' Sipek

(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.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
--

Index: linux-2.6/arch/s390/include/asm/bitops.h
===================================================================
--- linux-2.6.orig/arch/s390/include/asm/bitops.h	2008-08-11 16:23:58.000000000 -0500
+++ linux-2.6/arch/s390/include/asm/bitops.h	2008-08-21 00:49:40.950176518 -0500
@@ -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)




^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] s390: fix ext2_find_next_bit
@ 2008-08-21  6:15 Eric Sandeen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sandeen @ 2008-08-21  6:15 UTC (permalink / raw)
  To: Martin Schwidefsky
  Cc: Jan Glauber, ext4 development, Josef 'Jeff' Sipek

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.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
--

Index: linux-2.6/arch/s390/include/asm/bitops.h
===================================================================
--- linux-2.6.orig/arch/s390/include/asm/bitops.h	2008-08-11 16:23:58.000000000 -0500
+++ linux-2.6/arch/s390/include/asm/bitops.h	2008-08-21 00:49:40.950176518 -0500
@@ -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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-21  6:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-21  6:18 [PATCH] s390: fix ext2_find_next_bit Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2008-08-21  6:15 Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.