All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] udf: use ext2_find_next_bit
@ 2010-02-23 14:11 Akinobu Mita
  2010-02-24 16:21 ` Jan Kara
  0 siblings, 1 reply; 12+ messages in thread
From: Akinobu Mita @ 2010-02-23 14:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Akinobu Mita, Jan Kara

Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
in little endian bitmap region.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jan Kara <jack@suse.cz>
---
 fs/udf/balloc.c |   50 ++------------------------------------------------
 1 files changed, 2 insertions(+), 48 deletions(-)

diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 82372e3..05347f4 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -31,55 +31,9 @@
 #define udf_clear_bit(nr, addr) ext2_clear_bit(nr, addr)
 #define udf_set_bit(nr, addr) ext2_set_bit(nr, addr)
 #define udf_test_bit(nr, addr) ext2_test_bit(nr, addr)
-#define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size)
+#define udf_find_first_one_bit(addr, size) ext2_find_first_bit(addr, size)
 #define udf_find_next_one_bit(addr, size, offset) \
-		find_next_one_bit(addr, size, offset)
-
-#define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x)
-#define leNUM_to_cpup(x, y) xleNUM_to_cpup(x, y)
-#define xleNUM_to_cpup(x, y) (le ## x ## _to_cpup(y))
-#define uintBPL_t uint(BITS_PER_LONG)
-#define uint(x) xuint(x)
-#define xuint(x) __le ## x
-
-static inline int find_next_one_bit(void *addr, int size, int offset)
-{
-	uintBPL_t *p = ((uintBPL_t *) addr) + (offset / BITS_PER_LONG);
-	int result = offset & ~(BITS_PER_LONG - 1);
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= (BITS_PER_LONG - 1);
-	if (offset) {
-		tmp = leBPL_to_cpup(p++);
-		tmp &= ~0UL << offset;
-		if (size < BITS_PER_LONG)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= BITS_PER_LONG;
-		result += BITS_PER_LONG;
-	}
-	while (size & ~(BITS_PER_LONG - 1)) {
-		tmp = leBPL_to_cpup(p++);
-		if (tmp)
-			goto found_middle;
-		result += BITS_PER_LONG;
-		size -= BITS_PER_LONG;
-	}
-	if (!size)
-		return result;
-	tmp = leBPL_to_cpup(p);
-found_first:
-	tmp &= ~0UL >> (BITS_PER_LONG - size);
-found_middle:
-	return result + ffz(~tmp);
-}
-
-#define find_first_one_bit(addr, size)\
-	find_next_one_bit((addr), (size), 0)
+		ext2_find_next_bit(addr, size, offset)
 
 static int read_block_bitmap(struct super_block *sb,
 			     struct udf_bitmap *bitmap, unsigned int block,
-- 
1.6.0.6


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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-23 14:11 [PATCH] udf: use ext2_find_next_bit Akinobu Mita
@ 2010-02-24 16:21 ` Jan Kara
  2010-02-25  1:38   ` Akinobu Mita
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Kara @ 2010-02-24 16:21 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-kernel, Jan Kara

On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
> in little endian bitmap region.
> 
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: Jan Kara <jack@suse.cz>
  I've looked at the code and I think this is wrong. UDF uses 1 for free
block in the bitmap and 0 for used one. So you need to use
generic_find_next_le_bit...
  Something like the patch below?

								Honza

-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR
---

>From bfc8c674188d4be5856e445f9b57e1b7a3dbff6d Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 24 Feb 2010 17:18:57 +0100
Subject: [PATCH] udf: Use generic function for bit searching

Use generic_find_next_le_bit to search for bits in bitmap so
that we don't duplicate code unnecessarily.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/udf/balloc.c |   51 ++-------------------------------------------------
 1 files changed, 2 insertions(+), 49 deletions(-)

diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 82372e3..f5ff06c 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -31,55 +31,8 @@
 #define udf_clear_bit(nr, addr) ext2_clear_bit(nr, addr)
 #define udf_set_bit(nr, addr) ext2_set_bit(nr, addr)
 #define udf_test_bit(nr, addr) ext2_test_bit(nr, addr)
-#define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size)
 #define udf_find_next_one_bit(addr, size, offset) \
-		find_next_one_bit(addr, size, offset)
-
-#define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x)
-#define leNUM_to_cpup(x, y) xleNUM_to_cpup(x, y)
-#define xleNUM_to_cpup(x, y) (le ## x ## _to_cpup(y))
-#define uintBPL_t uint(BITS_PER_LONG)
-#define uint(x) xuint(x)
-#define xuint(x) __le ## x
-
-static inline int find_next_one_bit(void *addr, int size, int offset)
-{
-	uintBPL_t *p = ((uintBPL_t *) addr) + (offset / BITS_PER_LONG);
-	int result = offset & ~(BITS_PER_LONG - 1);
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= (BITS_PER_LONG - 1);
-	if (offset) {
-		tmp = leBPL_to_cpup(p++);
-		tmp &= ~0UL << offset;
-		if (size < BITS_PER_LONG)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= BITS_PER_LONG;
-		result += BITS_PER_LONG;
-	}
-	while (size & ~(BITS_PER_LONG - 1)) {
-		tmp = leBPL_to_cpup(p++);
-		if (tmp)
-			goto found_middle;
-		result += BITS_PER_LONG;
-		size -= BITS_PER_LONG;
-	}
-	if (!size)
-		return result;
-	tmp = leBPL_to_cpup(p);
-found_first:
-	tmp &= ~0UL >> (BITS_PER_LONG - size);
-found_middle:
-	return result + ffz(~tmp);
-}
-
-#define find_first_one_bit(addr, size)\
-	find_next_one_bit((addr), (size), 0)
+		generic_find_next_le_bit((unsigned long *)addr, size, offset)
 
 static int read_block_bitmap(struct super_block *sb,
 			     struct udf_bitmap *bitmap, unsigned int block,
@@ -356,7 +309,7 @@ repeat:
 				break;
 			}
 		} else {
-			bit = udf_find_next_one_bit((char *)bh->b_data,
+			bit = udf_find_next_one_bit(bh->b_data,
 						    sb->s_blocksize << 3,
 						    group_start << 3);
 			if (bit < sb->s_blocksize << 3)
-- 
1.6.4.2


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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-24 16:21 ` Jan Kara
@ 2010-02-25  1:38   ` Akinobu Mita
  2010-02-25  8:50     ` Geert Uytterhoeven
  2010-03-01 10:52     ` Jan Kara
  0 siblings, 2 replies; 12+ messages in thread
From: Akinobu Mita @ 2010-02-25  1:38 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-kernel

2010/2/25 Jan Kara <jack@suse.cz>:
> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
>> in little endian bitmap region.
>>
>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>> Cc: Jan Kara <jack@suse.cz>
>  I've looked at the code and I think this is wrong. UDF uses 1 for free
> block in the bitmap and 0 for used one. So you need to use
> generic_find_next_le_bit...
>  Something like the patch below?

According to include/asm-generic/bitops/ext2-non-atomic.h,
generic_find_next_le_bit() == ext2_find_next_bit().

So, is there any difference between my patch and yours?
Or am I missing something?

BTW, I realized that udf_find_first_one_bit() macro is not used.
So you can remove it in this patch.

>                                                                Honza
>
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
> ---
>
> From bfc8c674188d4be5856e445f9b57e1b7a3dbff6d Mon Sep 17 00:00:00 2001
> From: Jan Kara <jack@suse.cz>
> Date: Wed, 24 Feb 2010 17:18:57 +0100
> Subject: [PATCH] udf: Use generic function for bit searching
>
> Use generic_find_next_le_bit to search for bits in bitmap so
> that we don't duplicate code unnecessarily.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/udf/balloc.c |   51 ++-------------------------------------------------
>  1 files changed, 2 insertions(+), 49 deletions(-)
>
> diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
> index 82372e3..f5ff06c 100644
> --- a/fs/udf/balloc.c
> +++ b/fs/udf/balloc.c
> @@ -31,55 +31,8 @@
>  #define udf_clear_bit(nr, addr) ext2_clear_bit(nr, addr)
>  #define udf_set_bit(nr, addr) ext2_set_bit(nr, addr)
>  #define udf_test_bit(nr, addr) ext2_test_bit(nr, addr)
> -#define udf_find_first_one_bit(addr, size) find_first_one_bit(addr, size)
>  #define udf_find_next_one_bit(addr, size, offset) \
> -               find_next_one_bit(addr, size, offset)
> -
> -#define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x)
> -#define leNUM_to_cpup(x, y) xleNUM_to_cpup(x, y)
> -#define xleNUM_to_cpup(x, y) (le ## x ## _to_cpup(y))
> -#define uintBPL_t uint(BITS_PER_LONG)
> -#define uint(x) xuint(x)
> -#define xuint(x) __le ## x
> -
> -static inline int find_next_one_bit(void *addr, int size, int offset)
> -{
> -       uintBPL_t *p = ((uintBPL_t *) addr) + (offset / BITS_PER_LONG);
> -       int result = offset & ~(BITS_PER_LONG - 1);
> -       unsigned long tmp;
> -
> -       if (offset >= size)
> -               return size;
> -       size -= result;
> -       offset &= (BITS_PER_LONG - 1);
> -       if (offset) {
> -               tmp = leBPL_to_cpup(p++);
> -               tmp &= ~0UL << offset;
> -               if (size < BITS_PER_LONG)
> -                       goto found_first;
> -               if (tmp)
> -                       goto found_middle;
> -               size -= BITS_PER_LONG;
> -               result += BITS_PER_LONG;
> -       }
> -       while (size & ~(BITS_PER_LONG - 1)) {
> -               tmp = leBPL_to_cpup(p++);
> -               if (tmp)
> -                       goto found_middle;
> -               result += BITS_PER_LONG;
> -               size -= BITS_PER_LONG;
> -       }
> -       if (!size)
> -               return result;
> -       tmp = leBPL_to_cpup(p);
> -found_first:
> -       tmp &= ~0UL >> (BITS_PER_LONG - size);
> -found_middle:
> -       return result + ffz(~tmp);
> -}
> -
> -#define find_first_one_bit(addr, size)\
> -       find_next_one_bit((addr), (size), 0)
> +               generic_find_next_le_bit((unsigned long *)addr, size, offset)
>
>  static int read_block_bitmap(struct super_block *sb,
>                             struct udf_bitmap *bitmap, unsigned int block,
> @@ -356,7 +309,7 @@ repeat:
>                                break;
>                        }
>                } else {
> -                       bit = udf_find_next_one_bit((char *)bh->b_data,
> +                       bit = udf_find_next_one_bit(bh->b_data,
>                                                    sb->s_blocksize << 3,
>                                                    group_start << 3);
>                        if (bit < sb->s_blocksize << 3)
> --
> 1.6.4.2
>
>

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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-25  1:38   ` Akinobu Mita
@ 2010-02-25  8:50     ` Geert Uytterhoeven
  2010-02-25 14:29       ` Akinobu Mita
  2010-03-01 10:52     ` Jan Kara
  1 sibling, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2010-02-25  8:50 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: Jan Kara, linux-kernel, Linux-Next

On Thu, Feb 25, 2010 at 02:38, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> 2010/2/25 Jan Kara <jack@suse.cz>:
>> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
>>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
>>> in little endian bitmap region.

Is any of this in linux-next now?

http://kisskb.ellerman.id.au/kisskb/buildresult/2208481/
| fs/udf/balloc.c:274: error: implicit declaration of function
'generic_find_next_le_bit'

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-25  8:50     ` Geert Uytterhoeven
@ 2010-02-25 14:29       ` Akinobu Mita
  2010-02-28 10:04         ` Geert Uytterhoeven
  0 siblings, 1 reply; 12+ messages in thread
From: Akinobu Mita @ 2010-02-25 14:29 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Jan Kara, linux-kernel, Linux-Next

2010/2/25 Geert Uytterhoeven <geert@linux-m68k.org>:
> On Thu, Feb 25, 2010 at 02:38, Akinobu Mita <akinobu.mita@gmail.com> wrote:
>> 2010/2/25 Jan Kara <jack@suse.cz>:
>>> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
>>>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
>>>> in little endian bitmap region.
>
> Is any of this in linux-next now?
>
> http://kisskb.ellerman.id.au/kisskb/buildresult/2208481/
> | fs/udf/balloc.c:274: error: implicit declaration of function
> 'generic_find_next_le_bit'

Yep, Jan's patch caused the build breakage.

Because generic_find_next_le_bit() is not available for all
archtectures. So we should use ext2_find_next_bit() here.

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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-25 14:29       ` Akinobu Mita
@ 2010-02-28 10:04         ` Geert Uytterhoeven
  2010-02-28 14:07           ` Geert Uytterhoeven
  2010-02-28 14:07             ` Geert Uytterhoeven
  0 siblings, 2 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2010-02-28 10:04 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: Jan Kara, linux-kernel, Linux-Next

On Thu, Feb 25, 2010 at 15:29, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> 2010/2/25 Geert Uytterhoeven <geert@linux-m68k.org>:
>> On Thu, Feb 25, 2010 at 02:38, Akinobu Mita <akinobu.mita@gmail.com> wrote:
>>> 2010/2/25 Jan Kara <jack@suse.cz>:
>>>> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
>>>>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
>>>>> in little endian bitmap region.
>>
>> Is any of this in linux-next now?
>>
>> http://kisskb.ellerman.id.au/kisskb/buildresult/2208481/
>> | fs/udf/balloc.c:274: error: implicit declaration of function
>> 'generic_find_next_le_bit'
>
> Yep, Jan's patch caused the build breakage.
>
> Because generic_find_next_le_bit() is not available for all
> archtectures. So we should use ext2_find_next_bit() here.

Most architectures use the definitions in asm-generic, so they're OK.
M68k doesn't. S390 is also affected, and I think arm as well (but there's no
arm all-modconfig build in linux-next, so I'm not 100% sure).

I'm cooking a patch...

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-28 10:04         ` Geert Uytterhoeven
@ 2010-02-28 14:07             ` Geert Uytterhoeven
  2010-02-28 14:07             ` Geert Uytterhoeven
  1 sibling, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2010-02-28 14:07 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: Jan Kara, linux-kernel, Linux-Next, linux-m68k

On Sun, Feb 28, 2010 at 11:04, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Feb 25, 2010 at 15:29, Akinobu Mita <akinobu.mita@gmail.com> wrote:
>> 2010/2/25 Geert Uytterhoeven <geert@linux-m68k.org>:
>>> On Thu, Feb 25, 2010 at 02:38, Akinobu Mita <akinobu.mita@gmail.com> wrote:
>>>> 2010/2/25 Jan Kara <jack@suse.cz>:
>>>>> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
>>>>>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
>>>>>> in little endian bitmap region.
>>>
>>> Is any of this in linux-next now?
>>>
>>> http://kisskb.ellerman.id.au/kisskb/buildresult/2208481/
>>> | fs/udf/balloc.c:274: error: implicit declaration of function
>>> 'generic_find_next_le_bit'
>>
>> Yep, Jan's patch caused the build breakage.
>>
>> Because generic_find_next_le_bit() is not available for all
>> archtectures. So we should use ext2_find_next_bit() here.
>
> Most architectures use the definitions in asm-generic, so they're OK.
> M68k doesn't. S390 is also affected, and I think arm as well (but there's no
> arm all-modconfig build in linux-next, so I'm not 100% sure).
>
> I'm cooking a patch...

>From c9b5c7e6ef2092be822778a0b6b3d3032c058f5b Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Sun, 28 Feb 2010 13:06:27 +0100
Subject: [PATCH] m68k: Implement generic_find_next_{zero_,}le_bit()

linux-next:
fs/udf/balloc.c: In function 'udf_bitmap_new_block':
fs/udf/balloc.c:274: error: implicit declaration of function
'generic_find_next_le_bit'

Convert ext2_find_next_{zero_,}bit() into generic_find_next_{zero_,}le_bit(),
and wrap the ext2_find_next_{zero_,}bit() around the latter.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/include/asm/bitops_mm.h |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/include/asm/bitops_mm.h
b/arch/m68k/include/asm/bitops_mm.h
index 9bde784..b4ecdaa 100644
--- a/arch/m68k/include/asm/bitops_mm.h
+++ b/arch/m68k/include/asm/bitops_mm.h
@@ -365,6 +365,10 @@ static inline int minix_test_bit(int nr, const void *vaddr)
 #define ext2_set_bit_atomic(lock, nr, addr)	test_and_set_bit((nr) ^
24, (unsigned long *)(addr))
 #define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24,
(unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr)
^ 24, (unsigned long *)(addr))
+#define ext2_find_next_zero_bit(addr, size, offset) \
+	generic_find_next_zero_le_bit((unsigned long *)addr, size, offset)
+#define ext2_find_next_bit(addr, size, offset) \
+	generic_find_next_le_bit((unsigned long *)addr, size, offset)

 static inline int ext2_test_bit(int nr, const void *vaddr)
 {
@@ -394,10 +398,9 @@ static inline int ext2_find_first_zero_bit(const
void *vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }

-static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
-					  unsigned offset)
+static inline unsigned long generic_find_next_zero_le_bit(const
unsigned long *addr,
+		unsigned long size, unsigned long offset)
 {
-	const unsigned long *addr = vaddr;
 	const unsigned long *p = addr + (offset >> 5);
 	int bit = offset & 31UL, res;

@@ -437,10 +440,9 @@ static inline int ext2_find_first_bit(const void
*vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }

-static inline int ext2_find_next_bit(const void *vaddr, unsigned size,
-				     unsigned offset)
+static inline unsigned long generic_find_next_le_bit(const unsigned long *addr,
+		unsigned long size, unsigned long offset)
 {
-	const unsigned long *addr = vaddr;
 	const unsigned long *p = addr + (offset >> 5);
 	int bit = offset & 31UL, res;

-- 
1.6.0.4

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-28 10:04         ` Geert Uytterhoeven
@ 2010-02-28 14:07           ` Geert Uytterhoeven
  2010-02-28 14:07             ` Geert Uytterhoeven
  1 sibling, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2010-02-28 14:07 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: Jan Kara, linux-kernel, Linux-Next, linux-m68k

On Sun, Feb 28, 2010 at 11:04, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Feb 25, 2010 at 15:29, Akinobu Mita <akinobu.mita@gmail.com> wrote:
>> 2010/2/25 Geert Uytterhoeven <geert@linux-m68k.org>:
>>> On Thu, Feb 25, 2010 at 02:38, Akinobu Mita <akinobu.mita@gmail.com> wrote:
>>>> 2010/2/25 Jan Kara <jack@suse.cz>:
>>>>> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
>>>>>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
>>>>>> in little endian bitmap region.
>>>
>>> Is any of this in linux-next now?
>>>
>>> http://kisskb.ellerman.id.au/kisskb/buildresult/2208481/
>>> | fs/udf/balloc.c:274: error: implicit declaration of function
>>> 'generic_find_next_le_bit'
>>
>> Yep, Jan's patch caused the build breakage.
>>
>> Because generic_find_next_le_bit() is not available for all
>> archtectures. So we should use ext2_find_next_bit() here.
>
> Most architectures use the definitions in asm-generic, so they're OK.
> M68k doesn't. S390 is also affected, and I think arm as well (but there's no
> arm all-modconfig build in linux-next, so I'm not 100% sure).
>
> I'm cooking a patch...

>From c9b5c7e6ef2092be822778a0b6b3d3032c058f5b Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Sun, 28 Feb 2010 13:06:27 +0100
Subject: [PATCH] m68k: Implement generic_find_next_{zero_,}le_bit()

linux-next:
fs/udf/balloc.c: In function 'udf_bitmap_new_block':
fs/udf/balloc.c:274: error: implicit declaration of function
'generic_find_next_le_bit'

Convert ext2_find_next_{zero_,}bit() into generic_find_next_{zero_,}le_bit(),
and wrap the ext2_find_next_{zero_,}bit() around the latter.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/include/asm/bitops_mm.h |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/include/asm/bitops_mm.h
b/arch/m68k/include/asm/bitops_mm.h
index 9bde784..b4ecdaa 100644
--- a/arch/m68k/include/asm/bitops_mm.h
+++ b/arch/m68k/include/asm/bitops_mm.h
@@ -365,6 +365,10 @@ static inline int minix_test_bit(int nr, const void *vaddr)
 #define ext2_set_bit_atomic(lock, nr, addr)	test_and_set_bit((nr) ^
24, (unsigned long *)(addr))
 #define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24,
(unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr)
^ 24, (unsigned long *)(addr))
+#define ext2_find_next_zero_bit(addr, size, offset) \
+	generic_find_next_zero_le_bit((unsigned long *)addr, size, offset)
+#define ext2_find_next_bit(addr, size, offset) \
+	generic_find_next_le_bit((unsigned long *)addr, size, offset)

 static inline int ext2_test_bit(int nr, const void *vaddr)
 {
@@ -394,10 +398,9 @@ static inline int ext2_find_first_zero_bit(const
void *vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }

-static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
-					  unsigned offset)
+static inline unsigned long generic_find_next_zero_le_bit(const
unsigned long *addr,
+		unsigned long size, unsigned long offset)
 {
-	const unsigned long *addr = vaddr;
 	const unsigned long *p = addr + (offset >> 5);
 	int bit = offset & 31UL, res;

@@ -437,10 +440,9 @@ static inline int ext2_find_first_bit(const void
*vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }

-static inline int ext2_find_next_bit(const void *vaddr, unsigned size,
-				     unsigned offset)
+static inline unsigned long generic_find_next_le_bit(const unsigned long *addr,
+		unsigned long size, unsigned long offset)
 {
-	const unsigned long *addr = vaddr;
 	const unsigned long *p = addr + (offset >> 5);
 	int bit = offset & 31UL, res;

-- 
1.6.0.4

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH] udf: use ext2_find_next_bit
@ 2010-02-28 14:07             ` Geert Uytterhoeven
  0 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2010-02-28 14:07 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: Jan Kara, linux-kernel, Linux-Next, linux-m68k

On Sun, Feb 28, 2010 at 11:04, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Feb 25, 2010 at 15:29, Akinobu Mita <akinobu.mita@gmail.com> wrote:
>> 2010/2/25 Geert Uytterhoeven <geert@linux-m68k.org>:
>>> On Thu, Feb 25, 2010 at 02:38, Akinobu Mita <akinobu.mita@gmail.com> wrote:
>>>> 2010/2/25 Jan Kara <jack@suse.cz>:
>>>>> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
>>>>>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
>>>>>> in little endian bitmap region.
>>>
>>> Is any of this in linux-next now?
>>>
>>> http://kisskb.ellerman.id.au/kisskb/buildresult/2208481/
>>> | fs/udf/balloc.c:274: error: implicit declaration of function
>>> 'generic_find_next_le_bit'
>>
>> Yep, Jan's patch caused the build breakage.
>>
>> Because generic_find_next_le_bit() is not available for all
>> archtectures. So we should use ext2_find_next_bit() here.
>
> Most architectures use the definitions in asm-generic, so they're OK.
> M68k doesn't. S390 is also affected, and I think arm as well (but there's no
> arm all-modconfig build in linux-next, so I'm not 100% sure).
>
> I'm cooking a patch...

>From c9b5c7e6ef2092be822778a0b6b3d3032c058f5b Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Sun, 28 Feb 2010 13:06:27 +0100
Subject: [PATCH] m68k: Implement generic_find_next_{zero_,}le_bit()

linux-next:
fs/udf/balloc.c: In function 'udf_bitmap_new_block':
fs/udf/balloc.c:274: error: implicit declaration of function
'generic_find_next_le_bit'

Convert ext2_find_next_{zero_,}bit() into generic_find_next_{zero_,}le_bit(),
and wrap the ext2_find_next_{zero_,}bit() around the latter.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/include/asm/bitops_mm.h |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/include/asm/bitops_mm.h
b/arch/m68k/include/asm/bitops_mm.h
index 9bde784..b4ecdaa 100644
--- a/arch/m68k/include/asm/bitops_mm.h
+++ b/arch/m68k/include/asm/bitops_mm.h
@@ -365,6 +365,10 @@ static inline int minix_test_bit(int nr, const void *vaddr)
 #define ext2_set_bit_atomic(lock, nr, addr)	test_and_set_bit((nr) ^
24, (unsigned long *)(addr))
 #define ext2_clear_bit(nr, addr)		__test_and_clear_bit((nr) ^ 24,
(unsigned long *)(addr))
 #define ext2_clear_bit_atomic(lock, nr, addr)	test_and_clear_bit((nr)
^ 24, (unsigned long *)(addr))
+#define ext2_find_next_zero_bit(addr, size, offset) \
+	generic_find_next_zero_le_bit((unsigned long *)addr, size, offset)
+#define ext2_find_next_bit(addr, size, offset) \
+	generic_find_next_le_bit((unsigned long *)addr, size, offset)

 static inline int ext2_test_bit(int nr, const void *vaddr)
 {
@@ -394,10 +398,9 @@ static inline int ext2_find_first_zero_bit(const
void *vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }

-static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
-					  unsigned offset)
+static inline unsigned long generic_find_next_zero_le_bit(const
unsigned long *addr,
+		unsigned long size, unsigned long offset)
 {
-	const unsigned long *addr = vaddr;
 	const unsigned long *p = addr + (offset >> 5);
 	int bit = offset & 31UL, res;

@@ -437,10 +440,9 @@ static inline int ext2_find_first_bit(const void
*vaddr, unsigned size)
 	return (p - addr) * 32 + res;
 }

-static inline int ext2_find_next_bit(const void *vaddr, unsigned size,
-				     unsigned offset)
+static inline unsigned long generic_find_next_le_bit(const unsigned long *addr,
+		unsigned long size, unsigned long offset)
 {
-	const unsigned long *addr = vaddr;
 	const unsigned long *p = addr + (offset >> 5);
 	int bit = offset & 31UL, res;

-- 
1.6.0.4

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-25  1:38   ` Akinobu Mita
  2010-02-25  8:50     ` Geert Uytterhoeven
@ 2010-03-01 10:52     ` Jan Kara
  1 sibling, 0 replies; 12+ messages in thread
From: Jan Kara @ 2010-03-01 10:52 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: Jan Kara, linux-kernel

On Thu 25-02-10 10:38:25, Akinobu Mita wrote:
> 2010/2/25 Jan Kara <jack@suse.cz>:
> > On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
> >> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
> >> in little endian bitmap region.
> >>
> >> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> >> Cc: Jan Kara <jack@suse.cz>
> >  I've looked at the code and I think this is wrong. UDF uses 1 for free
> > block in the bitmap and 0 for used one. So you need to use
> > generic_find_next_le_bit...
> >  Something like the patch below?
> 
> According to include/asm-generic/bitops/ext2-non-atomic.h,
> generic_find_next_le_bit() == ext2_find_next_bit().
  Ah, I'm really sorry. I've originally misread the header and thought that
ext2_find_next_bit == generic_find_next_le_zero_bit. So my patch does
exactly the same thing as yours. I've now merged your patch so that you get
proper credit.

> BTW, I realized that udf_find_first_one_bit() macro is not used.
> So you can remove it in this patch.
  Yes, I've removed it now.

									Honza

-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

* Re: [PATCH] udf: use ext2_find_next_bit
  2010-02-28 14:07             ` Geert Uytterhoeven
@ 2010-03-01 10:54               ` Jan Kara
  -1 siblings, 0 replies; 12+ messages in thread
From: Jan Kara @ 2010-03-01 10:54 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Akinobu Mita, Jan Kara, linux-kernel, Linux-Next, linux-m68k

On Sun 28-02-10 15:07:17, Geert Uytterhoeven wrote:
> On Sun, Feb 28, 2010 at 11:04, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Thu, Feb 25, 2010 at 15:29, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> >> 2010/2/25 Geert Uytterhoeven <geert@linux-m68k.org>:
> >>> On Thu, Feb 25, 2010 at 02:38, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> >>>> 2010/2/25 Jan Kara <jack@suse.cz>:
> >>>>> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
> >>>>>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
> >>>>>> in little endian bitmap region.
> >>>
> >>> Is any of this in linux-next now?
> >>>
> >>> http://kisskb.ellerman.id.au/kisskb/buildresult/2208481/
> >>> | fs/udf/balloc.c:274: error: implicit declaration of function
> >>> 'generic_find_next_le_bit'
> >>
> >> Yep, Jan's patch caused the build breakage.
> >>
> >> Because generic_find_next_le_bit() is not available for all
> >> archtectures. So we should use ext2_find_next_bit() here.
> >
> > Most architectures use the definitions in asm-generic, so they're OK.
> > M68k doesn't. S390 is also affected, and I think arm as well (but there's no
> > arm all-modconfig build in linux-next, so I'm not 100% sure).
> >
> > I'm cooking a patch...
> 
> From c9b5c7e6ef2092be822778a0b6b3d3032c058f5b Mon Sep 17 00:00:00 2001
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Date: Sun, 28 Feb 2010 13:06:27 +0100
> Subject: [PATCH] m68k: Implement generic_find_next_{zero_,}le_bit()
> 
> linux-next:
> fs/udf/balloc.c: In function 'udf_bitmap_new_block':
> fs/udf/balloc.c:274: error: implicit declaration of function
> 'generic_find_next_le_bit'
> 
> Convert ext2_find_next_{zero_,}bit() into generic_find_next_{zero_,}le_bit(),
> and wrap the ext2_find_next_{zero_,}bit() around the latter.
  I've now used Akinobu's patch so yours isn't really needed but it's a
good cleanup anyway in my opinion.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

* Re: [PATCH] udf: use ext2_find_next_bit
@ 2010-03-01 10:54               ` Jan Kara
  0 siblings, 0 replies; 12+ messages in thread
From: Jan Kara @ 2010-03-01 10:54 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Akinobu Mita, Jan Kara, linux-kernel, Linux-Next, linux-m68k

On Sun 28-02-10 15:07:17, Geert Uytterhoeven wrote:
> On Sun, Feb 28, 2010 at 11:04, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Thu, Feb 25, 2010 at 15:29, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> >> 2010/2/25 Geert Uytterhoeven <geert@linux-m68k.org>:
> >>> On Thu, Feb 25, 2010 at 02:38, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> >>>> 2010/2/25 Jan Kara <jack@suse.cz>:
> >>>>> On Tue 23-02-10 23:11:13, Akinobu Mita wrote:
> >>>>>> Use ext2_find_next_bit (generic_find_next_le_bit) to find the set bit
> >>>>>> in little endian bitmap region.
> >>>
> >>> Is any of this in linux-next now?
> >>>
> >>> http://kisskb.ellerman.id.au/kisskb/buildresult/2208481/
> >>> | fs/udf/balloc.c:274: error: implicit declaration of function
> >>> 'generic_find_next_le_bit'
> >>
> >> Yep, Jan's patch caused the build breakage.
> >>
> >> Because generic_find_next_le_bit() is not available for all
> >> archtectures. So we should use ext2_find_next_bit() here.
> >
> > Most architectures use the definitions in asm-generic, so they're OK.
> > M68k doesn't. S390 is also affected, and I think arm as well (but there's no
> > arm all-modconfig build in linux-next, so I'm not 100% sure).
> >
> > I'm cooking a patch...
> 
> From c9b5c7e6ef2092be822778a0b6b3d3032c058f5b Mon Sep 17 00:00:00 2001
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Date: Sun, 28 Feb 2010 13:06:27 +0100
> Subject: [PATCH] m68k: Implement generic_find_next_{zero_,}le_bit()
> 
> linux-next:
> fs/udf/balloc.c: In function 'udf_bitmap_new_block':
> fs/udf/balloc.c:274: error: implicit declaration of function
> 'generic_find_next_le_bit'
> 
> Convert ext2_find_next_{zero_,}bit() into generic_find_next_{zero_,}le_bit(),
> and wrap the ext2_find_next_{zero_,}bit() around the latter.
  I've now used Akinobu's patch so yours isn't really needed but it's a
good cleanup anyway in my opinion.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

end of thread, other threads:[~2010-03-01 10:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-23 14:11 [PATCH] udf: use ext2_find_next_bit Akinobu Mita
2010-02-24 16:21 ` Jan Kara
2010-02-25  1:38   ` Akinobu Mita
2010-02-25  8:50     ` Geert Uytterhoeven
2010-02-25 14:29       ` Akinobu Mita
2010-02-28 10:04         ` Geert Uytterhoeven
2010-02-28 14:07           ` Geert Uytterhoeven
2010-02-28 14:07           ` Geert Uytterhoeven
2010-02-28 14:07             ` Geert Uytterhoeven
2010-03-01 10:54             ` Jan Kara
2010-03-01 10:54               ` Jan Kara
2010-03-01 10:52     ` Jan Kara

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.