[Drbd-dev] [patch] avoid long long division in _hash_fn

Lars Marowsky-Bree lmb at suse.de
Mon Feb 21 18:11:10 CET 2005


sector_t might be 64 bit, but long long divisions aren't supported in
kernel space in i386. This patch adds a straightforward cast to avoid an
unresolved symbol for __umoddi3.

Index: drbd/drbd_main.c
===================================================================
--- drbd/drbd_main.c    (revision 1763)
+++ drbd/drbd_main.c    (working copy)
@@ -164,7 +164,7 @@
 
 STATIC unsigned int tl_hash_fn(drbd_dev *mdev, sector_t sector)
 {
-       return (sector>>HT_SHIFT) % mdev->tl_hash_s;
+       return (unsigned int)(sector>>HT_SHIFT) % mdev->tl_hash_s;
 }
 
 
@@ -367,7 +367,7 @@
 
 STATIC unsigned int ee_hash_fn(drbd_dev *mdev, sector_t sector)
 {
-       return (sector>>HT_SHIFT) % mdev->ee_hash_s;
+       return (unsigned int)(sector>>HT_SHIFT) % mdev->ee_hash_s;
 }
 
 STATIC int overlaps(sector_t s1, int l1, sector_t s2, int l2)


Sincerely,
    Lars Marowsky-Brée <lmb at suse.de>

-- 
High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX Products GmbH - A Novell Business



More information about the drbd-dev mailing list