Skip to content

Commit

Permalink
drbd: rename random32() to prandom_u32()
Browse files Browse the repository at this point in the history
Use preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Akinobu Mita authored and Linus Torvalds committed Apr 30, 2013
1 parent 6d65df3 commit 38b682b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,8 @@ static struct socket *drbd_wait_for_connect(struct drbd_tconn *tconn, struct acc
rcu_read_unlock();

timeo = connect_int * HZ;
timeo += (random32() & 1) ? timeo / 7 : -timeo / 7; /* 28.5% random jitter */
/* 28.5% random jitter */
timeo += (prandom_u32() & 1) ? timeo / 7 : -timeo / 7;

err = wait_for_completion_interruptible_timeout(&ad->door_bell, timeo);
if (err <= 0)
Expand Down Expand Up @@ -953,7 +954,7 @@ static int conn_connect(struct drbd_tconn *tconn)
conn_warn(tconn, "Error receiving initial packet\n");
sock_release(s);
randomize:
if (random32() & 1)
if (prandom_u32() & 1)
goto retry;
}
}
Expand Down

0 comments on commit 38b682b

Please sign in to comment.