xfs
[Top] [All Lists]

Re: SGI XFS on ppc

To: Thomas Graichen <graichen@xxxxxxxxxxxxx>, thomas.graichen@xxxxxxxxxxxxx
Subject: Re: SGI XFS on ppc
From: Steve Lord <lord@xxxxxxx>
Date: Thu, 03 Aug 2000 15:28:25 -0500
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: Message from Thomas Graichen <news-innominate.list.sgi.xfs@innominate.de> of "03 Aug 2000 15:08:46 GMT." <news2mail-8mc1tu$ob3$1@mate.bln.innominate.de>
Sender: owner-linux-xfs-announce@xxxxxxxxxxx
> Steve Lord <lord@xxxxxxx> wrote:
> 
> > This is a bit of a shock in the dark, but here goes.....
> 
> > there are two things you can try:
> 
> > 1. in xfs_bit.c try undefining _MIPS_SIM after the header file includes.
> >    (we need to generalize the name of this define - it is a hang over from
> >     the irix code). Undefining it will cause all the masking code to
> >    use 32 bit quantities.
> 
> does not change anything
> 
> >    An alternative in this file is to try putting LL at the end of the 64
> >    bit constants. I do not know how well the ppc compiler copes with
> >    constants like this - if this turns out to be the problem then we will
> >    need to look all over XFS for constants which are not explicitly typed
> >    to be 64 bit.
> 
> LL does not change anything too
> 
> t
> 

So I am officially stumped, one comment on your earlier email though,
 %ll does not work for long long in the kernel as you pointed out, but %L
does. 

We know that the code:

        fields &= ~(1LL << f);

should do the right thing, which tends to imply xfs_lowbit64 is messing
up somehow - or the casting being used around the call to it is
messing up.

It might be worth the pain of pulling this into a user space program
and stepping though it in a debugger.

So instead of trying to understand what is wrong with that code, try
this code instead, it is a bit more simplistic in its approach - it
works on ia32, let me know how the ppc does.

Steve

void
xfs_xlatesb(void *data, xfs_sb_t *sb, int dir, xfs_arch_t arch,
            __int64_t fields)
{
    xfs_caddr_t     buf_ptr;
    xfs_caddr_t     mem_ptr;
    __uint64_t      mask;
    int             f;

    ASSERT(dir);
    ASSERT(fields);

    if (!fields)
        return;

    buf_ptr=(xfs_caddr_t)data;
    mem_ptr=(xfs_caddr_t)sb;

    mask = 1LL;
    f = 0;
    while (fields) {
        int             first;
        int             size;
        
        if (!(fields & mask)) {
                mask <<= 1;
                f++;
                continue;
        }

        first = xfs_sb_info[f].offset;
        size = xfs_sb_info[f + 1].offset - first;

        ASSERT(xfs_sb_info[f].type==0 || xfs_sb_info[f].type==1);

        if (arch == ARCH_NOCONVERT || size==1 || xfs_sb_info[f].type==1) {
            if (dir>0) {
                bcopy(buf_ptr + first, mem_ptr + first, size);
            } else {
                bcopy(mem_ptr + first, buf_ptr + first, size);
            }
        } else {
            switch (size) {
                case 2:
                    INT_COPY(*(__uint16_t*)(buf_ptr+first),
                             *(__uint16_t*)(mem_ptr+first), dir, arch);
                    break;
                case 4:
                    INT_COPY(*(__uint32_t*)(buf_ptr+first),
                             *(__uint32_t*)(mem_ptr+first), dir, arch);
                    break;
                case 8:
                    INT_COPY(*(__uint64_t*)(buf_ptr+first),
                             *(__uint64_t*)(mem_ptr+first), dir, arch);
                    break;
                default:
                    ASSERT(0);
            }
        }
        fields &= ~mask;
        mask <<= 1;
        f++;
    }

}



<Prev in Thread] Current Thread [Next in Thread>