Subject: reiserfs

From: Pete Popov <[email-masked]>
Date: 24 Apr 2002 16:13:06 -0700

Has anyone been able to run reiserfs on big endian systems?

Pete

---

From: Ralf Baechle <[email-masked]>
Date: Thu, 25 Apr 2002 00:51:28 -0700

> Has anyone been able to run reiserfs on big endian systems?

I've seen reports of people running Reiserfs on MIPS but I don't know what
endianess.

  Ralf

---

From: Geert Uytterhoeven <[email-masked]>
Date: Thu, 25 Apr 2002 10:11:55 +0200 (MEST)

> I've seen reports of people running Reiserfs on MIPS but I don't know what

Some people run it on PowerPC, which is big endian as far as Linux is
concerned.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email-masked]

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

---

From: Pete Popov <[email-masked]>
Date: 25 Apr 2002 09:08:20 -0700

> Some people run it on PowerPC, which is big endian as far as Linux is

Right, but mips be hangs hard. I'll have to investigate ... MIPS LE is
fine.

Pete

---

From: George Gensure <[email-masked]>
Date: Thu, 25 Apr 2002 12:17:51 -0400

>Some people run it on PowerPC, which is big endian as far as Linux is
Jeff Mahoney, probably the lead big-endian reiserfs developer, has run 
reiserfs on (that I've seen with my own eyes) Sun and Apple (G3 or 
later).  There is no reason his code would not similarly work on 
big-endian mips machines.

-George

---

From: Pete Popov <[email-masked]>
Date: 26 Apr 2002 11:34:09 -0700

> Some people run it on PowerPC, which is big endian as far as Linux is

FYI, it turned out to be a toolchain bug (2.95.3). Versions 2.96 and 3.x
work just fine.

Pete

---

From: Alan Cox <[email-masked]>
Date: Sat, 27 Apr 2002 21:19:53 +0100 (BST)

> Has anyone been able to run reiserfs on big endian systems?

Should work on newer 2.4 kernels

---

From: Pete Popov <[email-masked]>
Date: Sat, 27 Apr 2002 13:05:53 -0700

> Should work on newer 2.4 kernels

Yes, it does. I sent an email yesterday explaining what the problem
was.  The 2.95.3 toolchain is miscompiling the cpu_to_le16 and
le16_to_cpu functions. The problem appears to be fixed in 2.96 and 3.x
so reiserfs is looking good for both, LE and BE mips systems.

Pete

---

From: Jun Sun <[email-masked]>
Date: Mon, 29 Apr 2002 10:35:54 -0700

> so reiserfs is looking good for both, LE and BE mips systems.

Here is the test case that reveals the toolchain problem.  Brave souls are 
welcome to look into it.

Apparently the bug only happens on be tools with 2.95.x.

Jun

#if 0

compile instructions:

/opt/hardhat/devkit/mips/fp_be/bin/mips_fp_be-gcc -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -g -G 0 -mno-abicalls -fno-pic -mcpu=r4600 -mips2 -Wa,--trap -pipe    -c -o try.o try.c

#endif

typedef	unsigned short __u16;
typedef	unsigned __u32;

#define ___swab16_new(x) \
({ \
        __u32 __x = (x); \
        __x = ((__u32)( \
                ((__u32)(__x) << 8) | \
                (((__u32)(__x) & (__u16)0xff00U) >> 8) )); \
        (__u16)(__x & 0xffff); \
})

#define ___swab16(x) \
({ \
        __u16 __x = (x); \
        ((__u16)( \
                (((__u16)(__x) & (__u16)0x00ffU) << 8) | \
                (((__u16)(__x) & (__u16)0xff00U) >> 8) )); \
})

#  define __swab16(x) \
(__builtin_constant_p((__u16)(x)) ? \
  ___swab16((x)) : \
   __fswab16((x)))

#ifndef __arch__swab16
#  define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); })
#endif

static __inline__ __const__ __u16 __fswab16(__u16 x)
{
	        return __arch__swab16(x);
}

#define __le16_to_cpu(x) __swab16((x))
#define le16_to_cpu __le16_to_cpu

extern __u16 x;
extern __u16 y;

void foo_old(void)
{
	if (le16_to_cpu(x) > y) 
		y = x;
}

---

From: Hiroyuki Machida <[email-masked]>
Date: Tue, 30 Apr 2002 10:04:55 +0900 (JST)

Hello, all

From: Jun Sun <[email-masked]>
Subject: Re: reiserfs
Date: Mon, 29 Apr 2002 10:35:54 -0700

> Apparently the bug only happens on be tools with 2.95.x.

I think this bug has been fixed with
     http://gcc.gnu.org/ml/gcc-patches/2000-02/msg00489.html
for gcc-3.x.

You can apply the patch included that mail to gcc-2.95.x, easily.

---
Hiroyuki Machida
Sony Corp.