diff options
author | ZhangZhen | 2014-02-26 03:32:41 +0100 |
---|---|---|
committer | Jan Kara | 2014-03-04 12:19:03 +0100 |
commit | e878167af92fda03eb3a8597eec24128d4d47c43 (patch) | |
tree | 27eb1888379fd6e6a182ea0d01401140c9819ba4 /fs/ext2 | |
parent | ext3: remove an unneeded check in ext3_new_blocks() (diff) | |
download | kernel-qcow2-linux-e878167af92fda03eb3a8597eec24128d4d47c43.tar.gz kernel-qcow2-linux-e878167af92fda03eb3a8597eec24128d4d47c43.tar.xz kernel-qcow2-linux-e878167af92fda03eb3a8597eec24128d4d47c43.zip |
ext2/3: use prandom_u32() instead of get_random_bytes()
Many of the uses of get_random_bytes() do not actually need
cryptographically secure random numbers. Replace those uses with a
call to prandom_u32(), which is faster and which doesn't consume
entropy from the /dev/random driver.
The commit dd1f723bf56bd96efc9d90e9e60dc511c79de48f has made that for
ext4, and i did the same for ext2/3.
Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/ialloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 7cadd823bb31..7d66fb0e4cca 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c @@ -284,7 +284,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) int best_ndir = inodes_per_group; int best_group = -1; - get_random_bytes(&group, sizeof(group)); + group = prandom_u32(); parent_group = (unsigned)group % ngroups; for (i = 0; i < ngroups; i++) { group = (parent_group + i) % ngroups; |