Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] [patch] avoid long long division in _hash_fn
@ 2005-02-21 17:11 Lars Marowsky-Bree
  2005-02-22 10:38 ` Philipp Reisner
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Marowsky-Bree @ 2005-02-21 17:11 UTC (permalink / raw)
  To: drbd-dev

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@suse.de>

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Drbd-dev] [patch] avoid long long division in _hash_fn
  2005-02-21 17:11 [Drbd-dev] [patch] avoid long long division in _hash_fn Lars Marowsky-Bree
@ 2005-02-22 10:38 ` Philipp Reisner
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Reisner @ 2005-02-22 10:38 UTC (permalink / raw)
  To: drbd-dev

Am Montag, 21. Februar 2005 18:11 schrieb Lars Marowsky-Bree:
> 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@suse.de>

Both patches found their way into SVN...

-phil
-- 
: Dipl-Ing Philipp Reisner                      Tel +43-1-8178292-50 :
: LINBIT Information Technologies GmbH          Fax +43-1-8178292-82 :
: Schönbrunnerstr 244, 1120 Vienna, Austria    http://www.linbit.com :

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-22 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-21 17:11 [Drbd-dev] [patch] avoid long long division in _hash_fn Lars Marowsky-Bree
2005-02-22 10:38 ` Philipp Reisner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox