linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "Jörn Engel" <joern@logfs.org>
Cc: Andi Drebes <lists-receive@programmierforen.de>,
	Jeff Garzik <jeff@garzik.org>,
	linux-fsdevel@vger.kernel.org, Karel Zak <kzak@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	Phillip Lougher <phillip@lougher.demon.co.uk>
Subject: Re: [PATCH 1/2] Make cramfs little endian only
Date: Thu, 6 Dec 2007 09:35:39 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.0.9999.0712060932300.13796@woody.linux-foundation.org> (raw)
In-Reply-To: <20071206164711.GB3738@lazybastard.org>



On Thu, 6 Dec 2007, Jörn Engel wrote:
> 
> How about shifting and masking _before_ converting to host endianness?
> 
> 	static inline u32 cramfs_offset(struct cramfs_inode *inode)
> 	{
> 		return le32_to_cpu(node->namelen_offset >> CRAMFS_NAMELEN_WIDTH);
> 	}

Stop this idiocy. The code I sent out was correct. You're just making it 
worse.

"le32_to_cpu()" is a no-op on little-endian machines. So your change won't 
make any difference there. But the point is, that if we want the disk 
layout to be the *same* for both big-endian and little-endian, we need to 
switch the word as it is loaded from memory, and not do *any* operations 
on it before we've done that equalization.

This is not something unusual. It's bog-standard procedure for a lot of 
filesystems. And sparse will help you (and would have complained about 
your code that tries to shift a little-endian entity before changing it 
into a CPU-endian one).

			Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2007-12-06 17:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-04 11:59 [PATCH 0/2] Make cramfs little endian only Andi Drebes
2007-12-04 12:01 ` [PATCH 1/2] " Andi Drebes
2007-12-04 15:34   ` Jörn Engel
2007-12-04 20:37     ` Andi Drebes
2007-12-04 20:58       ` Linus Torvalds
2007-12-04 21:31         ` Andi Drebes
2007-12-04 22:35           ` Linus Torvalds
2007-12-04 22:58             ` Jeff Garzik
2007-12-05 21:57               ` Andi Drebes
2007-12-05 22:21                 ` Linus Torvalds
2007-12-05 22:41                   ` Jörn Engel
2007-12-06 16:38                     ` Andi Drebes
2007-12-06 16:27                   ` Andi Drebes
2007-12-06 16:47                     ` Jörn Engel
2007-12-06 17:35                       ` Linus Torvalds [this message]
2007-12-06 17:31                     ` Linus Torvalds
2007-12-06 22:37                       ` Andi Drebes
2007-12-04 20:11   ` Andrew Morton
2007-12-04 20:58     ` Andi Drebes
2007-12-04 12:02 ` [PATCH 2/2] Update documentation Andi Drebes

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=alpine.LFD.0.9999.0712060932300.13796@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=jeff@garzik.org \
    --cc=joern@logfs.org \
    --cc=kzak@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lists-receive@programmierforen.de \
    --cc=phillip@lougher.demon.co.uk \
    /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).