LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Gaudenz Steinlin <gaudenz@soziologie.ch>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>, Christoph Hellwig <hch@lst.de>,
	xfs-masters@oss.sgi.com, Eric Sandeen <sandeen@sandeen.net>,
	xfs@oss.sgi.com,
	linux-kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [xfs-masters] Re: filesystem corruption on xfs after 2.6.25-rc1 (bisected, powerpc related?)
Date: Tue, 26 Feb 2008 19:11:32 +0100	[thread overview]
Message-ID: <1204049492.13162.265.camel@johannes.berg> (raw)
In-Reply-To: <20080226114419.GA5353@soziologie.ch>

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

> I debuged this a bit further by testing the 4 changed functions
> individually. The problem only occurs with the new version of
> xfs_lowbit64. 

Eh, uh, of course. Now that I look at that code it becomes obvious.

find_first_bit() works on unsigned longs, not 64-bit quantities, so
find_first_bit((unsigned long *)&t, 64) isn't equivalent to finding the
lowest bit set in a 64-bit quantity.

Think of the memory layout of a 64-bit word:

LE:	low 32 bits | high 32 bits
BE:	high 32 bits | low 32 bits

Take a look at the start of include/asm-powerpc/bitops.h, and note how
bitops don't define the memory layout at all :)

So find_first_bit(&t, 64) on BE will give you the number of the first
bit of the 32-bit rotated quantity, ie. of ((t<<32) | (t>>32)).

The problem doesn't happen with highbit64 because fls64 was specifically
coded for this purpose.

You really need to keep xfs_lowbit64 defined as it was before, or, maybe
even better, define ffs64 in parallel to fls64.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2008-02-27 11:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-25 11:23 filesystem corruption on xfs after 2.6.25-rc1 (bisected, powerpc related?) Gaudenz Steinlin
2008-02-25 11:34 ` Johannes Berg
2008-02-25 18:15 ` [xfs-masters] " Eric Sandeen
2008-02-25 23:42   ` Rafael J. Wysocki
2008-02-25 23:48     ` Eric Sandeen
2008-02-25 23:52       ` Rafael J. Wysocki
2008-02-25 23:57         ` [xfs-masters] " Christoph Hellwig
2008-02-26  0:13           ` Rafael J. Wysocki
2008-02-26  7:34             ` Gaudenz Steinlin
2008-02-26 11:44             ` Gaudenz Steinlin
2008-02-26 18:11               ` Johannes Berg [this message]
2008-02-28 14:40                 ` Eric Sandeen
2008-02-26 20:05               ` Eric Sandeen
2008-02-26 20:59                 ` Mark Goodwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1204049492.13162.265.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=andi@firstfloor.org \
    --cc=gaudenz@soziologie.ch \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=sandeen@sandeen.net \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).