From: Christoph Hellwig <hch@infradead.org>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Use do_div() instead of native 64-bit division in btrfs_ordered_sum_size()
Date: Wed, 23 Jul 2008 07:13:09 -0400 [thread overview]
Message-ID: <20080723111309.GA19988@infradead.org> (raw)
In-Reply-To: <1216697528.18980.34.camel@shinybook.infradead.org>
Chris, can you please put this patch in? Without it btrfs can't be
loaded on 32bit platforms.
On Mon, Jul 21, 2008 at 11:32:08PM -0400, David Woodhouse wrote:
> Prevents the compiler emitting calls to __udivdi3() from libgcc on some
> platforms:
> WARNING: "__udivdi3" [/shiny/git/btrfs-kernel-unstable/btrfs.ko] undefined!
>
> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
> ---
> Untested but ObviouslyCorrect???. Now that I can load the module, I hit a
> BUG() immediately -- but I don't think it's caused by this patch. qv.
>
> diff --git a/ordered-data.h b/ordered-data.h
> index 1794efd..1abe5f5 100644
> --- a/ordered-data.h
> +++ b/ordered-data.h
> @@ -97,9 +97,12 @@ struct btrfs_ordered_extent {
> */
> static inline int btrfs_ordered_sum_size(struct btrfs_root *root, u64 bytes)
> {
> - unsigned long num_sectors = (bytes + root->sectorsize - 1) /
> - root->sectorsize;
> - num_sectors++;
> + unsigned long num_sectors;
> +
> + bytes += root->sectorsize - 1;
> + do_div(bytes, root->sectorsize);
> + num_sectors = bytes + 1;
> +
> return sizeof(struct btrfs_ordered_sum) +
> num_sectors * sizeof(struct btrfs_sector_sum);
> }
>
> --
> David Woodhouse Open Source Technology Centre
> David.Woodhouse@intel.com Intel Corporation
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
next prev parent reply other threads:[~2008-07-23 11:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-22 3:32 [PATCH] Use do_div() instead of native 64-bit division in btrfs_ordered_sum_size() David Woodhouse
2008-07-22 3:36 ` kernel BUG at extent_map.c:275! David Woodhouse
2008-07-22 10:21 ` Chris Mason
2008-07-22 14:35 ` David Woodhouse
2008-07-22 17:03 ` Chris Mason
2008-07-22 17:41 ` David Woodhouse
2008-07-22 17:42 ` Zach Brown
2008-07-22 18:04 ` David Woodhouse
2008-07-24 14:34 ` Chris Mason
2008-07-22 18:12 ` Chris Mason
2008-07-22 14:43 ` [PATCH] Remove BUG_ON(spin_trylock()) checks which have false positives on UP David Woodhouse
2008-07-23 11:13 ` Christoph Hellwig [this message]
2008-07-23 13:28 ` [PATCH] Use do_div() instead of native 64-bit division in btrfs_ordered_sum_size() Chris Mason
2008-07-23 21:07 ` David Woodhouse
2008-07-24 0:19 ` Chris Mason
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=20080723111309.GA19988@infradead.org \
--to=hch@infradead.org \
--cc=dwmw2@infradead.org \
--cc=linux-btrfs@vger.kernel.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