Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373454
b: refs/heads/master
c: a84cd29
h: refs/heads/master
v: v3
  • Loading branch information
Sam Lang authored and Sage Weil committed May 2, 2013
1 parent 9ca8e14 commit 47cceb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8b3e1a56982d0eafff0afb0ff9e87c8b944a9bdc
refs/heads/master: a84cd29335f4ca38ca8405c1636ee3876bb292b5
8 changes: 5 additions & 3 deletions trunk/fs/ceph/mdsmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m)
{
int n = 0;
int i;
char r;

/* special case for one mds */
if (1 == m->m_max_mds && m->m_info[0].state > 0)
return 0;

/* count */
for (i = 0; i < m->m_max_mds; i++)
Expand All @@ -30,8 +33,7 @@ int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m)
return -1;

/* pick */
get_random_bytes(&r, 1);
n = r % n;
n = prandom_u32() % n;
i = 0;
for (i = 0; n > 0; i++, n--)
while (m->m_info[i].state <= 0)
Expand Down

0 comments on commit 47cceb5

Please sign in to comment.