Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ffs Add a special case for nrpos=1 to cbtorpos(). T...



details:   https://anonhg.NetBSD.org/src/rev/bc01b943b5f1
branches:  trunk
changeset: 525364:bc01b943b5f1
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Wed Apr 10 14:31:07 2002 +0000

description:
Add a special case for nrpos=1 to cbtorpos().  This massively reduces CPU usage
by newfs(8) -- and fsck_ffs(8) on a relatively empty file system.  There is
still one divide left in the inner loops, to calculate cylno values.

diffstat:

 sys/ufs/ffs/fs.h |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r 07cc93afd41d -r bc01b943b5f1 sys/ufs/ffs/fs.h
--- a/sys/ufs/ffs/fs.h  Wed Apr 10 14:23:59 2002 +0000
+++ b/sys/ufs/ffs/fs.h  Wed Apr 10 14:31:07 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fs.h,v 1.24 2002/04/10 07:46:10 mycroft Exp $  */
+/*     $NetBSD: fs.h,v 1.25 2002/04/10 14:31:07 mycroft Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -477,7 +477,8 @@
 #define        cbtocylno(fs, bno) \
     (fsbtodb(fs, bno) / (fs)->fs_spc)
 #define        cbtorpos(fs, bno) \
-    ((fsbtodb(fs, bno) % (fs)->fs_spc / (fs)->fs_nsect * (fs)->fs_trackskew + \
+    ((fs)->fs_nrpos <= 1 ? 0 : \
+     (fsbtodb(fs, bno) % (fs)->fs_spc / (fs)->fs_nsect * (fs)->fs_trackskew + \
       fsbtodb(fs, bno) % (fs)->fs_spc % (fs)->fs_nsect * (fs)->fs_interleave) % \
      (fs)->fs_nsect * (fs)->fs_nrpos / (fs)->fs_npsect)
 



Home | Main Index | Thread Index | Old Index