Explorar o código

IB/mlx4: Fix last allocated object tracking in bitmap allocator

Set last allocated object to the object after the one just allocated
before ORing in the extra top bits.  Also handle the case where this
wraps around.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Roland Dreier %!s(int64=18) %!d(string=hai) anos
pai
achega
a2cb4a98f2
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      drivers/net/mlx4/alloc.c

+ 1 - 1
drivers/net/mlx4/alloc.c

@@ -51,8 +51,8 @@ u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap)
 
 	if (obj < bitmap->max) {
 		set_bit(obj, bitmap->table);
+		bitmap->last = (obj + 1) & (bitmap->max - 1);
 		obj |= bitmap->top;
-		bitmap->last = obj + 1;
 	} else
 		obj = -1;