summaryrefslogtreecommitdiffstats
path: root/sys/ufs
Commit message (Collapse)AuthorAgeFilesLines
* Within ufs, the ffs_sync and ffs_fsync functions did not alwaysmckusick2002-10-252-4/+11
| | | | | | | | | | | | check for and/or report I/O errors. The result is that a VFS_SYNC or VOP_FSYNC called with MNT_WAIT could loop infinitely on ufs in the presence of a hard error writing a disk sector or in a filesystem full condition. This patch ensures that I/O errors will always be checked and returned. This patch also ensures that every call to VFS_SYNC or VOP_FSYNC with MNT_WAIT set checks for and takes appropriate action when an error is returned. Sponsored by: DARPA & NAI Labs.
* We must be careful to avoid recursive copy-on-write faults whenmckusick2002-10-231-1/+14
| | | | | | trying to clean up during disk-full senarios. Sponsored by: DARPA & NAI Labs.
* Missplaced FREE_LOCK causes a panic when hit while taking a snapshot.mckusick2002-10-231-1/+1
| | | | Sponsored by: DARPA & NAI Labs.
* This update further fine tunes the locking of snapshot vnodes inmckusick2002-10-221-12/+21
| | | | | | | | | the ffs_copyonwrite routine to avoid a deadlock between the syncer daemon trying to sync out a snapshot vnode and the bufdaemon trying to write out a buffer containing the snapshot inode. With any luck this will be the last snapshot race condition. Sponsored by: DARPA & NAI Labs.
* This update is a performance improvement when allocating blocks onmckusick2002-10-221-0/+12
| | | | | | | | | | | | | a full filesystem. Previously, if the allocation failed, we had to fsync the file before rolling back any partial allocation of indirect blocks. Most block allocation requests only need to allocate a single data block and if that allocation fails, there is nothing to unroll. So, before doing the fsync, we check to see if any rollback will really be necessary. If none is necessary, then we simply return. This update eliminates the flurry of disk activity that got triggered whenever a filesystem would run out of space. Sponsored by: DARPA & NAI Labs.
* This checkin reimplements the io-request priority hack in a waymckusick2002-10-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that works in the new threaded kernel. It was commented out of the disksort routine earlier this year for the reasons given in kern/subr_disklabel.c (which is where this code used to reside before it moved to kern/subr_disk.c): ---------------------------- revision 1.65 date: 2002/04/22 06:53:20; author: phk; state: Exp; lines: +5 -0 Comment out Kirks io-request priority hack until we can do this in a civilized way which doesn't cause grief. The problem is that it is not generally safe to cast a "struct bio *" to a "struct buf *". Things like ccd, vinum, ata-raid and GEOM constructs bio's which are not entrails of a struct buf. Also, curthread may or may not have anything to do with the I/O request at hand. The correct solution can either be to tag struct bio's with a priority derived from the requesting threads nice and have disksort act on this field, this wouldn't address the "silly-seek syndrome" where two equal processes bang the diskheads from one edge to the other of the disk repeatedly. Alternatively, and probably better: a sleep should be introduced either at the time the I/O is requested or at the time it is completed where we can be sure to sleep in the right thread. The sleep also needs to be in constant timeunits, 1/hz can be practicaly any sub-second size, at high HZ the current code practically doesn't do anything. ---------------------------- As suggested in this comment, it is no longer located in the disk sort routine, but rather now resides in spec_strategy where the disk operations are being queued by the thread that is associated with the process that is really requesting the I/O. At that point, the disk queues are not visible, so the I/O for positively niced processes is always slowed down whether or not there is other activity on the disk. On the issue of scaling HZ, I believe that the current scheme is better than using a fixed quantum of time. As machines and I/O subsystems get faster, the resolution on the clock also rises. So, ten years from now we will be slowing things down for shorter periods of time, but the proportional effect on the system will be about the same as it is today. So, I view this as a feature rather than a drawback. Hence this patch sticks with using HZ. Sponsored by: DARPA & NAI Labs. Reviewed by: Poul-Henning Kamp <phk@critter.freebsd.dk>
* Rename _POSIX_FOO_PRESENT and friends from POSIX.1e to _PC_FOO_PRESENTrwatson2002-10-201-3/+3
| | | | | | | and related friends. This would have been corrected had POSIX.1e progressed to a standard. Pointed out by: wollman
* Implement _POSIX_ACL_PATH_MAX, which returns the maximum number of ACLrwatson2002-10-201-0/+10
| | | | | | | entries for a file system node using pathconf(). Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Teach UFS to respond to pathconf() tests for _POSIX_ACL_EXTENDED andrwatson2002-10-201-0/+20
| | | | | | | | _POSIX_MAC_PRESENT based on available mount flags, if the services are available. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Clarify that the UFS1 extended attribute configuration steps do not applyrwatson2002-10-191-2/+2
| | | | | | | to UFS2 file systems. Submitted by: jedgar Obtained from: TrustedBSD Project
* Fix a file-rewrite performance case for UFS[2]. When rewriting portionsdillon2002-10-183-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of a file in chunks that are less then the filesystem block size, if the data is not already cached the system will perform a read-before-write. The problem is that it does this on a block-by-block basis, breaking up the I/Os and making clustering impossible for the writes. Programs such as INN using cyclic file buffers suffer greatly. This problem is only going to get worse as we use larger and larger filesystem block sizes. The solution is to extend the sequential heuristic so UFS[2] can perform a far larger read and readahead when dealing with this case. (note: maximum disk write bandwidth is 27MB/sec thru filesystem) (note: filesystem blocksize in test is 8K (1K frag)) dd if=/dev/zero of=test.dat bs=1k count=2m conv=notrunc Before: (note half of these are reads) tty da0 da1 acd0 cpu tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id 0 76 14.21 598 8.30 0.00 0 0.00 0.00 0 0.00 0 0 7 1 92 0 76 14.09 813 11.19 0.00 0 0.00 0.00 0 0.00 0 0 9 5 86 0 76 14.28 821 11.45 0.00 0 0.00 0.00 0 0.00 0 0 8 1 91 After: (note half of these are reads) tty da0 da1 acd0 cpu tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id 0 76 63.62 434 26.99 0.00 0 0.00 0.00 0 0.00 0 0 18 1 80 0 76 63.58 424 26.30 0.00 0 0.00 0.00 0 0.00 0 0 17 2 82 0 76 63.82 438 27.32 0.00 0 0.00 0.00 0 0.00 1 0 19 2 79 Reviewed by: mckusick Approved by: re X-MFC after: immediately (was heavily tested in -stable for 4 months)
* Update extended attribute readme file to note that no special configurationrwatson2002-10-181-1/+6
| | | | | | | | is required to use EAs with UFS2, and that UFS2 is recommend for EA use for a variety of reasons. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Update instructions for ACLs given recent tunefs, mount changes. Alsorwatson2002-10-181-5/+33
| | | | | | | | note that UFS2 doesn't require explicit extended attribute configuration, and is recommends for this and other reasons if you plan to use ACLs. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Use 'size_t' instead of 'int' for the result of sizeof().rwatson2002-10-181-1/+1
|
* With the revised single-lock method used in snapshots, themckusick2002-10-181-1/+0
| | | | | | BA_NOWAIT flag is no longer needed. Sponsored by: DARPA & NAI Labs.
* Change locking so that all snapshots on a particular filesystem sharemckusick2002-10-161-42/+91
| | | | | | | | | | | | | | | a common lock. This change avoids a deadlock between snapshots when separate requests cause them to deadlock checking each other for a need to copy blocks that are close enough together that they fall into the same indirect block. Although I had anticipated a slowdown from contention for the single lock, my filesystem benchmarks show no measurable change in throughput on a uniprocessor system with three active snapshots. I conjecture that this result is because every copy-on-write fault must check all the active snapshots, so the process was inherently serial already. This change removes the last of the deadlocks of which I am aware in snapshots. Sponsored by: DARPA & NAI Labs.
* Push most UFS ACL behavior behind a check for MNT_ACLS, permitting ACLsrwatson2002-10-152-101/+129
| | | | | | | | | | | | to be administratively disabled as needed on UFS/UFS2 file systems. This also has the effect of preventing the slightly more expensive ACL code from running on non-ACL file systems, avoiding storage allocation for ACLs that may be read from disk. MNT_ACLS may be set at mount-time using mount -o acls, or implicitly by setting the FS_ACLS flag using tunefs. On UFS1, you may also have to configure ACL store. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* If the FS_MULTILABEL flag is set in a UFS or UFS2 superblock,rwatson2002-10-151-0/+17
| | | | | | | | | | | | | | automatically set MNT_MULTILABEL in the mount flags. If FS_ACLS is set in a UFS or UFS2 superblock, automatically set MNT_ACLS in the mount flags. If either of these flags is set, but the appropriate kernel option to support the features associated with the flag isn't available, then print a warning at mount-time. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* When reading or writing the extended attributes of a special devicemckusick2002-10-142-5/+38
| | | | | | | | | | | | or fifo in UFS2, the normal ufs_strategy routine needs to be used rather than the spec_strategy or fifo_strategy routine. Thus the ffsext_strategy routine is interposed in the ffs_vnops vectors for special devices and fifo's to pick off this special case. Otherwise it simply falls through to the usual spec_strategy or fifo_strategy routine. Submitted by: Robert Watson <rwatson@FreeBSD.org> Sponsored by: DARPA & NAI Labs.
* Fix two memory leaks in error conditions involving the UFS ACL code:rwatson2002-10-141-0/+4
| | | | | | | | if failures occur, make sure that we release both the default ACL and access ACL storage during new object creation. Spotted by: phk and his pet flexelint Sponsored by: DARPA, Network Associates Laboratories
* Define two new superblock file system flags:rwatson2002-10-141-0/+10
| | | | | | | | | | | FS_ACLS Administrative enable/disable of extended ACL support FS_MULTILABEL Administrative flag to indicate to the MAC Framework that objects in the file system are individually labeled using extended attributes. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Reviewed by: (in principal) mckusick, phk
* Regularize the vop_stdlock'ing protocol across all the filesystemsmckusick2002-10-142-4/+2
| | | | | | | | | | | | | | | | | | | | that use it. Specifically, vop_stdlock uses the lock pointed to by vp->v_vnlock. By default, getnewvnode sets up vp->v_vnlock to reference vp->v_lock. Filesystems that wish to use the default do not need to allocate a lock at the front of their node structure (as some still did) or do a lockinit. They can simply start using vn_lock/VOP_UNLOCK. Filesystems that wish to manage their own locks, but still use the vop_stdlock functions (such as nullfs) can simply replace vp->v_vnlock with a pointer to the lock that they wish to have used for the vnode. Such filesystems are responsible for setting the vp->v_vnlock back to the default in their vop_reclaim routine (e.g., vp->v_vnlock = &vp->v_lock). In theory, this set of changes cleans up the existing filesystem lock interface and should have no function change to the existing locking scheme. Sponsored by: DARPA & NAI Labs.
* Change iov_base's type from `char *' to the standard `void *'. Allmike2002-10-111-1/+1
| | | | | uses of iov_base which assume its type is `char *' (in order to do pointer arithmetic) have been updated to cast iov_base to `char *'.
* Fix build of 64 bit platforms.mux2002-10-091-2/+3
|
* When creating a snapshot, create a list of initially allocated blocks.mckusick2002-10-091-1/+3
| | | | | | | | | | | | Whenever doing a copy-on-write check, first look in the list of initially allocated blocks to see if it is there. If so, no further check is needed. If not, fall through and do the full check. This change eliminates one of two known deadlocks caused by snapshots. Handling the second deadlock will be the subject of another check-in. This change also reduces the cost of the copy-on-write check by speeding up the verification of frequently checked blocks. Sponsored by: DARPA & NAI Labs.
* When creating a snapshot, create a list of initially allocated blocks.mckusick2002-10-091-7/+135
| | | | | | | | | | | | Whenever doing a copy-on-write check, first look in the list of initially allocated blocks to see if it is there. If so, no further check is needed. If not, fall through and do the full check. This change eliminates one of two known deadlocks caused by snapshots. Handling the second deadlock will be the subject of another check-in. This change also reduces the cost of the copy-on-write check by speeding up the verification of frequently checked blocks. Sponsored by: DARPA & NAI Labs.
* The appropriate units for disk block addresses are always DEV_BSIZE,mckusick2002-10-091-8/+1
| | | | | | | | | | | | even when the underlying device has a larger sector size. Therefore, the filesystem code should not (and with this patch does not) try to use the underlying sector size when doing disk block address calculations. This patch fixes problems in -current when using the swap-based memory-disk device (mdconfig -a -t swap ...). This bugfix is not relevant to -stable as -stable does not have the memory-disk device. Sponsored by: DARPA & NAI Labs.
* - Remove LK_INTERLOCK from the vn_lock() in ffs_snapshot().jeff2002-10-081-1/+1
| | | | | Pointy hat to: me Found by: green
* Mark two places where an unsigned number is checked "if (foo < 0)" withphk2002-10-021-0/+2
| | | | | | | | an XXX comment. Somebody[TM] should look at this in some detail. Spotted by: FlexeLint
* size_t is not a struct (fix mislabelling in a comment).dd2002-10-022-2/+2
|
* Fix some harmless mis-indents.phk2002-10-011-1/+1
| | | | Spotted by: FlexeLint
* When spamming me with a printf(9), under DIAGNOSTIC, at least be nice enoughjmallett2002-09-281-1/+1
| | | | | | | to include a newline. MFC after: 4 days Sponsored by: Bright Path Solutions
* Be consistent about "static" functions: if the function is markedphk2002-09-283-36/+36
| | | | | | static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512
* Make it a tad easier to deal with struct inode in userland programs whichphk2002-09-271-1/+1
| | | | | | fondle /dev/kmem by using "struct cdev *" instead of "dev_t". Requsted by: jake
* Use our mount-credential if we get a NOCRED when we try to write out EAphk2002-09-271-0/+2
| | | | | | | | | space back to disk. This is wrong in many ways, but not as wrong as a panic. Pancied on: rwatson & jmallet Sponsored by: DARPA & NAI Labs.
* - Convert locks to use standard macros.jeff2002-09-254-7/+28
| | | | | | - Lock access to the buflists. - Document broken locking. - Use vrefcnt().
* - Document broken locking.jeff2002-09-251-3/+2
| | | | - Use vrefcnt().
* - Lock accesses to v_usecount.jeff2002-09-252-7/+11
| | | | - Convert interlock locks to use standard macros.
* - Don't use the interlock to protect v_writecount.jeff2002-09-251-6/+5
|
* We don't need to #include <sys/disklabel.h>.phk2002-09-201-2/+0
| | | | | | We don't need to #include <sys/disklabel.h> second time either. Sponsored by: DARPA & NAI Labs.
* VOP_FSYNC() requires that it's vnode argument be locked, which nfs_link()truckman2002-09-191-11/+4
| | | | | | | | | | wasn't doing. Rather than just lock and unlock the vnode around the call to VOP_FSYNC(), implement rwatson's suggestion to lock the file vnode in kern_link() before calling VOP_LINK(), since the other filesystems also locked the file vnode right away in their link methods. Remove the locking and and unlocking from the leaf filesystem link methods. Reviewed by: rwatson, bde (except for the unionfs_link() changes)
* intmax_t is printed with %jd, not %lld.obrien2002-09-191-7/+7
|
* Remove any VOP_PRINT that redundantly prints the tag.njl2002-09-181-4/+2
| | | | | | Move lockmgr_printinfo() into vprint() for everyone's benefit. Suggested by: bde
* Remove all use of vnode->v_tag, replacing with appropriate substitutes.njl2002-09-142-4/+4
| | | | | | | | | | | | v_tag is now const char * and should only be used for debugging. Additionally: 1. All users of VT_NTS now check vfsconf->vf_type VFCF_NETWORK 2. The user of VT_PROCFS now checks for the new flag VV_PROCDEP, which is propagated by pseudofs to all child vnodes if the fs sets PFS_PROCDEP. Suggested by: phk Reviewed by: bde, rwatson (earlier version)
* vfs_syscalls.c:bde2002-09-101-52/+6
| | | | | | | | | | | | | | | | | | | | | | Changed rename(2) to follow the letter of the POSIX spec. POSIX requires rename() to have no effect if its args "resolve to the same existing file". I think "file" can only reasonably be read as referring to the inode, although the rationale and "resolve" seem to say that sameness is at the level of (resolved) directory entries. ext2fs_vnops.c, ufs_vnops.c: Replaced code that gave the historical BSD behaviour of removing one link name by checks that this code is now unreachable. This fixes some races. All vnodes needed to be unlocked for the removal, and locking at another level using something like IN_RENAME was not even attempted, so it was possible for rename(x, y) to return with both x and y removed even without any unlink(2) syscalls (one process can remove x using rename(x, y) and another process can remove y using rename(y, x)). Prodded by: alfred MFC after: 8 weeks PR: 42617
* Implement the VOP_OPENEXTATTR() and VOP_CLOSEEXTATTR() methods.phk2002-09-052-31/+192
| | | | | | | | Use extattr_check_cred() to check access to EAs. This is still a WIP. Sponsored by: DARPA & NAI Labs.
* Use canonical extattr_check_cred() instead of private implementation of thephk2002-09-051-39/+3
| | | | | | same policy. Sponsored by: DARPA & NAI Labs.
* Fix credentials check: do not leak ENOATTR until we know if they'rephk2002-09-051-12/+15
| | | | | | supposed to know. Sponsored by: DARPA & NAI Labs.
* Include <sys/malloc.h> instead of depending on namespace pollution 2bde2002-09-051-9/+11
| | | | | | | | | layers deep in <sys/proc.h> or <sys/vnode.h>. Include <sys/vmmeter.h> instead of depending on namespace pollution in <sys/pcpu.h>. Sorted includes as much as possible.
* Since we have vp and td cached in local variables, use those insteadrwatson2002-09-011-1/+1
| | | | | | | of derefencing the VOP arguments again when calling the UFS code. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
OpenPOWER on IntegriCloud