All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <liubo2009@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: <chris.mason@oracle.com>, <dave@jikos.cz>
Subject: [PATCH] Btrfs: use do_div to avoid compile errors on 32bit box
Date: Fri, 19 Aug 2011 17:48:44 +0800	[thread overview]
Message-ID: <1313747324-27477-1-git-send-email-liubo2009@cn.fujitsu.com> (raw)

When doing div operation of u64 type, we need to be careful and use do_div
to avoid compile ERROR on 32bit box:

"ERROR: "__udivdi3" [fs/btrfs/btrfs.ko] undefined!
make[1]: *** [__modpost] Error 1

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 80d6148..9b495ce 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6796,14 +6796,14 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr)
 	index = get_block_group_index(block_group);
 	if (index == 0) {
 		dev_min = 4;
-		min_free /= 2;
+		do_div(min_free, 2);
 	} else if (index == 1) {
 		dev_min = 2;
 	} else if (index == 2) {
 		min_free *= 2;
 	} else if (index == 3) {
 		dev_min = fs_devices->rw_devices;
-		min_free /= dev_min;
+		do_div(min_free, dev_min);
 	}
 
 	mutex_lock(&root->fs_info->chunk_mutex);
-- 
1.6.5.2


             reply	other threads:[~2011-08-19  9:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-19  9:48 Liu Bo [this message]
2011-08-19 13:22 ` [PATCH] Btrfs: use do_div to avoid compile errors on 32bit box Josef Bacik
2011-08-20  1:35   ` liubo
2011-08-20  1:34 Liu Bo
2011-08-20  1:46 ` liubo

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=1313747324-27477-1-git-send-email-liubo2009@cn.fujitsu.com \
    --to=liubo2009@cn.fujitsu.com \
    --cc=chris.mason@oracle.com \
    --cc=dave@jikos.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.