public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Tom Rini <trini@kernel.crashing.org>
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@transmeta.com>,
	Marcelo Tosatti <marcelo@conectiva.com.br>
Subject: Re: [PATCH] Fix fs/fat/inode.c when compiled with gcc-3.0.x
Date: Thu, 10 Jan 2002 22:52:03 -0500	[thread overview]
Message-ID: <3C3E6163.2E4ECB03@mandrakesoft.com> (raw)
In-Reply-To: <20020111034703.GK13931@cpe-24-221-152-185.az.sprintbbd.net>

Tom Rini wrote:
> 
> Hello.  Currently when fs/fat/inode.c is compiled with gcc-3.0.x, there
> are to lines which will cause a __divdi3 call to be used.  But on most
> archs, there isn't currently a __divdi3 implementation in the kernel, so
> FAT will no longer link (or load as a module).  The easy fix (pointed
> out by Andrew Morton) is to replace the divide by 512 with a shift right
> by 9, which has the same effect but doesn't use a divide.
> 
> This is vs 2.4.18-pre3, but applies to 2.5.2-pre9 as well (and probably
> pre10 too..)
> 
> --
> Tom Rini (TR1265)
> http://gate.crashing.org/~trini/
> 
> ===== fs/fat/inode.c 1.10 vs edited =====
> --- 1.10/fs/fat/inode.c Wed Nov 21 15:12:16 2001
> +++ edited/fs/fat/inode.c       Thu Jan 10 15:40:11 2002
> @@ -406,7 +406,7 @@
>         }
>         inode->i_blksize = 1 << sbi->cluster_bits;
>         inode->i_blocks = ((inode->i_size + inode->i_blksize - 1)
> -                          & ~(inode->i_blksize - 1)) / 512;
> +                          & ~(inode->i_blksize - 1)) >> 9;
>         MSDOS_I(inode)->i_logstart = 0;
>         MSDOS_I(inode)->mmu_private = inode->i_size;
> 

wow, I always assumed the compiler was smart enough to replace a "/ 512"
with a shift.

	Jeff



-- 
Jeff Garzik      | Alternate titles for LOTR:
Building 1024    | Fast Times at Uruk-Hai
MandrakeSoft     | The Took, the Elf, His Daughter and Her Lover
                 | Samwise Gamgee: International Hobbit of Mystery

  reply	other threads:[~2002-01-11  3:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-11  3:47 [PATCH] Fix fs/fat/inode.c when compiled with gcc-3.0.x Tom Rini
2002-01-11  3:52 ` Jeff Garzik [this message]
2002-01-11  4:29   ` Linus Torvalds
2002-01-11 15:29     ` Tom Rini
2002-01-11 18:09       ` Linus Torvalds
2002-01-11 18:17         ` Tom Rini
2002-01-11 18:40           ` Linus Torvalds
2002-01-12  0:35             ` Denis Vlasenko
2002-01-11 22:25     ` Richard Henderson

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=3C3E6163.2E4ECB03@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=torvalds@transmeta.com \
    --cc=trini@kernel.crashing.org \
    /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