summaryrefslogtreecommitdiffstats
path: root/sbin/newfs
Commit message (Collapse)AuthorAgeFilesLines
* Fix diskless clients by removing the code for calculating the minimumroberto2001-10-181-13/+1
| | | | | | | value for cpg. The change was bogus. Submitted by: bde MFC after: 2 days
* Document the optimal block:fragment ratio, per discussiondougb2001-10-151-0/+3
| | | | | | on -arch and cvs-all. Reviewed by: dillon
* Following the discussion in -arch and the submission of a patch by bde, hereroberto2001-10-042-11/+20
| | | | | | | it is. I added the manpage change. Submitted by: bde MFC after: 1 week
* Handle snprintf() returning < 0 (not just -1)brian2001-08-201-2/+2
| | | | MFC after: 2 weeks
* Handle snprintf() returning -1.brian2001-08-201-0/+2
| | | | MFC after: 2 weeks
* Silence non-constant format string warnings by marking functionskris2001-08-191-3/+3
| | | | | | | as __printflike()/__printf0like(), adding const, or adding missing "%s" format strings, as appropriate. MFC after: 2 weeks
* Remove whitespace at EOL.dd2001-07-151-7/+7
|
* mdoc(7) police: removed HISTORY info from the .Os call.ru2001-07-101-1/+1
|
* mdoc(7) police: remove extraneous .Pp before and/or after .Sh.dd2001-07-091-2/+0
|
* Don't link ${BINDIR}/newfs to nowhere.bde2001-05-301-3/+1
| | | | | Don't clutter this Makefile (not to mention the error output) with $(BDECFLAGS}.
* Remove -DMFS from CFLAGS.dd2001-05-291-1/+1
|
* Remove all references to MFS.dd2001-05-291-92/+2
|
* A more complete removal of MFS related code.phk2001-05-293-312/+59
| | | | XXX: This program badly needs a style(9) + BDECFLAGS treatment.
* Initial cleanout of MFS from newfs. More complete wash needed.phk2001-05-292-6/+3
|
* sprintf() -> snprintf()kris2001-04-242-3/+3
| | | | | Partially submitted by: "Andrew R. Reiter" <arr@watson.org> Obtained from: OpenBSD
* Add a missing argument to an error message format string.kris2001-04-171-1/+1
|
* Add information about the new options to newfs and tunefs which set thenik2001-04-101-0/+6
| | | | | expected average file size and number of files per directory. Could do with some fleshing out.
* Directory layout preference improvements from Grigoriy Orlov <gluk@ptci.ru>.mckusick2001-04-102-4/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | His description of the problem and solution follow. My own tests show speedups on typical filesystem intensive workloads of 5% to 12% which is very impressive considering the small amount of code change involved. ------ One day I noticed that some file operations run much faster on small file systems then on big ones. I've looked at the ffs algorithms, thought about them, and redesigned the dirpref algorithm. First I want to describe the results of my tests. These results are old and I have improved the algorithm after these tests were done. Nevertheless they show how big the perfomance speedup may be. I have done two file/directory intensive tests on a two OpenBSD systems with old and new dirpref algorithm. The first test is "tar -xzf ports.tar.gz", the second is "rm -rf ports". The ports.tar.gz file is the ports collection from the OpenBSD 2.8 release. It contains 6596 directories and 13868 files. The test systems are: 1. Celeron-450, 128Mb, two IDE drives, the system at wd0, file system for test is at wd1. Size of test file system is 8 Gb, number of cg=991, size of cg is 8m, block size = 8k, fragment size = 1k OpenBSD-current from Dec 2000 with BUFCACHEPERCENT=35 2. PIII-600, 128Mb, two IBM DTLA-307045 IDE drives at i815e, the system at wd0, file system for test is at wd1. Size of test file system is 40 Gb, number of cg=5324, size of cg is 8m, block size = 8k, fragment size = 1k OpenBSD-current from Dec 2000 with BUFCACHEPERCENT=50 You can get more info about the test systems and methods at: http://www.ptci.ru/gluk/dirpref/old/dirpref.html Test Results tar -xzf ports.tar.gz rm -rf ports mode old dirpref new dirpref speedup old dirprefnew dirpref speedup First system normal 667 472 1.41 477 331 1.44 async 285 144 1.98 130 14 9.29 sync 768 616 1.25 477 334 1.43 softdep 413 252 1.64 241 38 6.34 Second system normal 329 81 4.06 263.5 93.5 2.81 async 302 25.7 11.75 112 2.26 49.56 sync 281 57.0 4.93 263 90.5 2.9 softdep 341 40.6 8.4 284 4.76 59.66 "old dirpref" and "new dirpref" columns give a test time in seconds. speedup - speed increasement in times, ie. old dirpref / new dirpref. ------ Algorithm description The old dirpref algorithm is described in comments: /* * Find a cylinder to place a directory. * * The policy implemented by this algorithm is to select from * among those cylinder groups with above the average number of * free inodes, the one with the smallest number of directories. */ A new directory is allocated in a different cylinder groups than its parent directory resulting in a directory tree that is spreaded across all the cylinder groups. This spreading out results in a non-optimal access to the directories and files. When we have a small filesystem it is not a problem but when the filesystem is big then perfomance degradation becomes very apparent. What I mean by a big file system ? 1. A big filesystem is a filesystem which occupy 20-30 or more percent of total drive space, i.e. first and last cylinder are physically located relatively far from each other. 2. It has a relatively large number of cylinder groups, for example more cylinder groups than 50% of the buffers in the buffer cache. The first results in long access times, while the second results in many buffers being used by metadata operations. Such operations use cylinder group blocks and on-disk inode blocks. The cylinder group block (fs->fs_cblkno) contains struct cg, inode and block bit maps. It is 2k in size for the default filesystem parameters. If new and parent directories are located in different cylinder groups then the system performs more input/output operations and uses more buffers. On filesystems with many cylinder groups, lots of cache buffers are used for metadata operations. My solution for this problem is very simple. I allocate many directories in one cylinder group. I also do some things, so that the new allocation method does not cause excessive fragmentation and all directory inodes will not be located at a location far from its file's inodes and data. The algorithm is: /* * Find a cylinder group to place a directory. * * The policy implemented by this algorithm is to allocate a * directory inode in the same cylinder group as its parent * directory, but also to reserve space for its files inodes * and data. Restrict the number of directories which may be * allocated one after another in the same cylinder group * without intervening allocation of files. * * If we allocate a first level directory then force allocation * in another cylinder group. */ My early versions of dirpref give me a good results for a wide range of file operations and different filesystem capacities except one case: those applications that create their entire directory structure first and only later fill this structure with files. My solution for such and similar cases is to limit a number of directories which may be created one after another in the same cylinder group without intervening file creations. For this purpose, I allocate an array of counters at mount time. This array is linked to the superblock fs->fs_contigdirs[cg]. Each time a directory is created the counter increases and each time a file is created the counter decreases. A 60Gb filesystem with 8mb/cg requires 10kb of memory for the counters array. The maxcontigdirs is a maximum number of directories which may be created without an intervening file creation. I found in my tests that the best performance occurs when I restrict the number of directories in one cylinder group such that all its files may be located in the same cylinder group. There may be some deterioration in performance if all the file inodes are in the same cylinder group as its containing directory, but their data partially resides in a different cylinder group. The maxcontigdirs value is calculated to try to prevent this condition. Since there is no way to know how many files and directories will be allocated later I added two optimization parameters in superblock/tunefs. They are: int32_t fs_avgfilesize; /* expected average file size */ int32_t fs_avgfpdir; /* expected # of files per directory */ These parameters have reasonable defaults but may be tweeked for special uses of a filesystem. They are only necessary in rare cases like better tuning a filesystem being used to store a squid cache. I have been using this algorithm for about 3 months. I have done a lot of testing on filesystems with different capacities, average filesize, average number of files per directory, and so on. I think this algorithm has no negative impact on filesystem perfomance. It works better than the default one in all cases. The new dirpref will greatly improve untarring/removing/coping of big directories, decrease load on cvs servers and much more. The new dirpref doesn't speedup a compilation process, but also doesn't slow it down. Obtained from: Grigoriy Orlov <gluk@ptci.ru>
* Fixed style bugs in previous commit.bde2001-04-031-4/+4
|
* Document the newfs.c rev 1.33 changing the default c/g from 16 to 22.obrien2001-04-021-1/+1
|
* Fix patch merge braino.obrien2001-04-021-2/+2
|
* Allow enabling soft updates (with -U) on a new filesystem.obrien2001-04-023-6/+18
| | | | | | | [I first added this functionality, and thought to check prior art. Seeing OpenBSD had already done this, I changed my addition to reduce the diffs between the two and went with their option letter.] Obtained from: OpenBSD
* The common wisdom is to use the largest number of cylinders per group.obrien2001-03-271-3/+4
| | | | | | So bump the default from `16' to `22', which is the largest value allowed with the current default block size. This change increases the the group size from 32MB/g to 44MB/g on a 4GB SCSI disk.
* - Backout botched attempt to introduce MANSECT feature.ru2001-03-261-0/+1
| | | | - MAN[1-9] -> MAN.
* Set the default manual section for sbin/ to 8.ru2001-03-201-1/+0
|
* Make mount_mfs annoy users for 15 seconds and point them at mdconfig(8).phk2001-01-302-0/+12
|
* mdoc(7) police: fixed broken references.ru2001-01-161-1/+1
|
* The ffs superblock includes a 128-byte region for use by temporaryiedowse2001-01-151-0/+5
| | | | | | | | | | | | | | | | | | | | in-core pointers to summary information. An array in this region (fs_csp) could overflow on filesystems with a very large number of cylinder groups (~16000 on i386 with 8k blocks). When this happens, other fields in the superblock get corrupted, and fsck refuses to check the filesystem. Solve this problem by replacing the fs_csp array in 'struct fs' with a single pointer, and add padding to keep the length of the 128-byte region fixed. Update the kernel and userland utilities to use just this single pointer. With this change, the kernel no longer makes use of the superblock fields 'fs_csshift' and 'fs_csmask'. Add a comment to newfs/mkfs.c to indicate that these fields must be calculated for compatibility with older kernels. Reviewed by: mckusick
* Replace reference to replacing mkfs(8) with a paragraph actuallyeivind2001-01-151-3/+1
| | | | describing what newfs *does*.
* Prepare for mdoc(7)NG.ru2000-12-271-10/+20
|
* o Add an example for a large file system.imp2000-12-191-7/+9
| | | | | | | o Remove bug about boot blocks hating non-8k file systems. This hasn't been the case for a long time. Not Objected to by: hackers, doc
* mdoc(7) police: use the new features of the Nm macro.ru2000-11-201-3/+3
|
* Avoid use of direct troff requests in mdoc(7) manual pages.ru2000-11-101-2/+0
|
* Cast block number to off_t to avoid possible overflow bugs.jwd2000-10-241-1/+1
| | | | Pointed out by: Bruce Evans <bde@zeta.org.au>
* The write combining code in revision 1.30 needs a few additionaljwd2000-10-241-12/+25
| | | | | | | | | | touch ups. The cache needs to be flushed against block reads, and a final flush at process termination to force the backup superblocks to disk. I believe this will allow 'make release' to complete. Submitted by: Tor.Egge@fast.no
* Implement simple write combining for newfs - this is particularly usefulpeter2000-10-171-0/+37
| | | | | | for large scsi disks with WCE = 0. This yields around a 7 times speedup on elapsed newfs time on test disks here. 64k clusters seems to be the sweet spot for scsi disks using our present drivers.
* Turn dkcksum() into an __inline function.phk2000-09-161-2/+3
| | | | Change its type to u_int_16_t.
* Don't try to do anything with the /dev/rXXX device.msmith2000-05-311-4/+2
|
* Remove single-space hard sentence breaks. These degrade the qualitysheldonh2000-03-011-1/+2
| | | | | of the typeset output, tend to make diffs harder to read and provide bad examples for new-comers to mdoc.
* Add Xref to camcontrol(8) (replacing previously-removed scsiformat(8)).kris2000-01-301-0/+1
| | | | Submitted by: joerg
* Fix various man pages to stop abusing the .Bx macro to generatempp2000-01-231-1/+1
| | | | | the strings "FreeBSD" and "NetBSD". Use the .Fx or .Nx macro instead.
* Remove dead xref to scsiformat(8)kris1999-11-151-1/+0
| | | | Obtained from: OpenBSD (kind of)
* $Id$ -> $FreeBSD$peter1999-08-283-3/+3
|
* Don't print a "," after the last superblock.billf1999-08-211-3/+4
| | | | Submitted by: adrian
* Add again the ':' after the x option in th eargument list to getopt.n_hibma1999-06-191-2/+2
| | | | | | | It disappeared in rev. 1.23 newfs.c PR: 12292 Submitted by: Cy Schubert <cy@cschuber.net.gov.bc.ca>
* Describe the default values for useful options.grog1999-03-101-14/+45
| | | | Clarify which options are no longer useful.
* Fix bug in mount_mfs whereby mount_mfs would sometimes return beforedillon1999-02-092-5/+39
| | | | | | | the mount is completely active, causing the next few commands attempting to manipulate data on the mount to fail. mount_mfs's parent now tries to wait for the mount point st_dev to change before returning, indicating that the mount has gone active.
* Straightened the terminology straightening in 1.17-1.18. Fixed hardbde1998-11-291-7/+8
| | | | line breaks in rev.1.16-1.18.
* Refer to "da" rather than "sd" device.rnordier1998-11-281-2/+2
|
* Backed out previous commit. It broke fsck again. See rev.1.22 and thebde1998-10-171-3/+1
| | | | references there, and rev.1.38 of sys/ufs/ufs/ufs_disksubr.c.
OpenPOWER on IntegriCloud