Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs Prefer cprng_fast32 over random. A good distribu...
details: https://anonhg.NetBSD.org/src/rev/97829c8a3a32
branches: trunk
changeset: 802285:97829c8a3a32
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Sep 08 20:52:37 2014 +0000
description:
Prefer cprng_fast32 over random. A good distribution even in the lower
bits beat any minor performance advantage randomo(9) might have,
especially given the disk IO involved.
diffstat:
sys/ufs/ffs/ffs_alloc.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r d992b51af46b -r 97829c8a3a32 sys/ufs/ffs/ffs_alloc.c
--- a/sys/ufs/ffs/ffs_alloc.c Mon Sep 08 19:24:16 2014 +0000
+++ b/sys/ufs/ffs/ffs_alloc.c Mon Sep 08 20:52:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_alloc.c,v 1.146 2014/07/25 08:24:31 dholland Exp $ */
+/* $NetBSD: ffs_alloc.c,v 1.147 2014/09/08 20:52:37 joerg Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.146 2014/07/25 08:24:31 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.147 2014/09/08 20:52:37 joerg Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -90,6 +90,7 @@
#include <sys/syslog.h>
#include <sys/vnode.h>
#include <sys/wapbl.h>
+#include <sys/cprng.h>
#include <miscfs/specfs/specdev.h>
#include <ufs/ufs/quota.h>
@@ -697,7 +698,7 @@
* Force allocation in another cg if creating a first level dir.
*/
if (ITOV(pip)->v_vflag & VV_ROOT) {
- prefcg = random() % fs->fs_ncg;
+ prefcg = cprng_fast32() % fs->fs_ncg;
mincg = prefcg;
minndir = fs->fs_ipg;
for (cg = prefcg; cg < fs->fs_ncg; cg++)
Home |
Main Index |
Thread Index |
Old Index