Commit Graph

302 Commits

Author SHA1 Message Date
hannken a3a898ff0f Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.

From FreeBSD with slight modifications.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-10-15 11:28:59 +00:00
dbj fe7c786886 add mnt_iflag field to struct mount for internal flags
mv MNT_GONE, MNT_UNMOUNT and MNT_WANTRDWR to this field
additonally add mnt_writeopcountupper and mnt_writeopcountlower fields
in preparation for pending write suspension support work
bump kernel version to 1.6ZD
2003-10-14 14:02:56 +00:00
thorpej f7840303a1 Whitespace nits. 2003-10-13 17:07:55 +00:00
bouyer 7b066791c8 Remove references to University of California from my copyright notices. 2003-10-05 17:48:49 +00:00
dbj 5c09d20130 Declare fs_old_flags and fs_flags as unsigned.
This fixes a bug introduced in revision 1.120 of ffs_vfsops dated 2003/09/13
which results in fs_flags having a value of 0x7fffff00 when a superblock
is updated to use the new layout.
Discussed in http://mail-index.netbsd.org/tech-kern/2003/09/28/0003.html
2003-09-29 20:34:23 +00:00
enami b50653d8aa In ffs_sbupdate(), swap the sblock after ffs_oldfscompat_write() is
applied rather than the original.
2003-09-25 23:39:17 +00:00
enami 69615345e2 Fix a recently introduced bug which prevents csum totals being copied
when an old ffs filesytem is first mounted (as a result, df reports disk
full on old ffs filesystem or mfs created by old binary).  Problem first
noticed by onoe san.
2003-09-17 02:24:33 +00:00
bouyer ff7554f54c make sure to not get flags which are for internal use only from the on-disk
superblock.
Proposed in http://mail-index.netbsd.org/tech-kern/2003/09/06/0005.html
2003-09-13 14:09:15 +00:00
bouyer 5e33ea894e Commit changes proposed in
http://mail-index.netbsd.org/tech-kern/2003/09/06/0001.html
http://mail-index.netbsd.org/tech-kern/2003/09/06/0006.html
to avoid compat problems with old ffsv1 by reuse of the old FS_SWAPPED
value for FS_FLAGS_UPDATED, and use of new, larger fields:
- Don't use FS_FLAGS_UPDATED to see if we need to update new fields from
  old fields in ffsv1 case.
- when writing back the superblock, copy back the flags to the old location
  if only old flags are set (FS_FLAGS_UPDATED won't be set in this case)
  in ffsv1 case.
2003-09-13 13:47:04 +00:00
yamt 4868f89aae buffer cache mp locks. 2003-09-07 11:55:43 +00:00
itojun 761c22ff58 use arc4random instead of random (mask with INT32_MAX to avoid getting
negative numbers unexpectedly).
2003-09-05 21:58:35 +00:00
dsl 92c5eba410 Split CGSIZE definition so it can be used with 64bit fpg values.
Split cg_start so magic can be done in libsa when it is known that the
filesystem isn't UFS2.
2003-08-21 14:41:00 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
thorpej a06b275edc Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget().  Turns out
  that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
  and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
  above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
  just to appease the above.
2003-06-29 18:43:21 +00:00
enami bfbd2cd3ab Add forward declaration of struct lwp instead of struct proc. Sort those
while I'm here.
2003-06-29 05:43:56 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
fvdl 67c9fa950a OS X still seems to use the old nrpos field in the superblock, and gets
unhappy after NetBSD wrote an Apple UFS filesystem. Just set it to 0
in this case.
2003-06-12 18:50:43 +00:00
kristerw 07936511f0 The C language does not permit statements of the form
(X ? Y : Z) = 0;
even though gcc handles this by a stupid extension.

Transform these to correct C.

Approved by fvdl.
2003-05-15 20:25:31 +00:00
gmcgarry 835240b191 Print pid on error. From Greg A. Woods in PR#17393. 2003-05-04 01:52:18 +00:00
christos 7a96f65456 make sure we update fs_fsmnt. 2003-05-03 16:24:35 +00:00
fvdl 0545901d27 configdirs was changed to an array of u_int8_t, so don't compare values
to 65535.
2003-04-17 09:32:43 +00:00
christos 80ecd573c0 PR/1796: John Kohl: statfs misbehaves under chrooted environments.
- Under chroot it displays only the visible filesystems with appropriate paths.
- The statfs f_mntonname gets adjusted to contain the real path from root.
- While was there, fixed a bug in ext2fs, locking problems with vfs_getfsstat(),
  and factored out some of the vfsop statfs() code to copy_statfs_info(). This
  fixes the problem where some filesystems forgot to set fsid.
- Made coda look more like a normal fs.
2003-04-16 21:44:18 +00:00
yamt 1963d34b78 use bswap32 and bswap64 correctly.
(fs_pendingblocks and fs_pendinginodes)
2003-04-16 14:20:25 +00:00
fvdl d0152b0231 ffs_reclaim may be called while the dinode pointer in the inode structure
is still NULL (in the case of an error in ffs_vget). Check for this
condition before doing a pool_put.
2003-04-16 07:38:25 +00:00
fvdl ba400f9233 Don't cache buffers used when finding the superblock, it can lead to
seeing bogus data for the first cg with certain block/frag sizes.
From enami tsugutomo.
2003-04-12 10:35:58 +00:00
fvdl 9e0b0abaa7 Use variables for some cg accesses; makes things more readable and more
similar to FreeBSD. No functional change.
2003-04-12 10:33:17 +00:00
enami b0715b0b82 Make ffs_cg_swap() works even if same chunk is passed as new and old cg.
This is necessary to prevent newfs from dumping core when it is asked to
create a UFS1 file system of non-native endian.
2003-04-11 10:20:35 +00:00
fvdl 63ab1add00 Initialize the 'mirror' i_flags fiels in struct inode to 0. 2003-04-10 20:03:40 +00:00
fvdl 2758e6ad60 Remove some leftover diagnostic checks. 2003-04-10 20:02:36 +00:00
fvdl 4f33a6f2e1 * Use the old and new time fields in the superblock as well as a few others
to determine if this filesystem was mounted by an older kernel after
  having been mounted by a newer one, to avoid some summary mismatches.
* Reinstate support for 4.2 cylinder groups (read-only, as it was before).
2003-04-05 13:37:36 +00:00
he f8cf57f9b0 Remember to prefix the manually-swapped FS magic numbers with 0x. 2003-04-05 11:12:42 +00:00
fvdl 7847218fc1 FreeBSD revision 1.135:
When removing the last item from a non-empty worklist, the worklist
tail pointer must be updated.
2003-04-03 19:28:07 +00:00
fvdl 7d31e8f0d9 Avoid truncation of values in some macros that shift 64 bit values.
From FreeBSD.
2003-04-03 16:07:09 +00:00
fvdl 42614ed3f3 Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
2003-04-02 10:39:19 +00:00
fvdl e80c0648b1 The modified flag must be cleared before the last sbupdate call in
unmount, because ffs_flushfiles or softdep_flushfiles may have
modified the filesystem (despite VFS_SYNC having been called first).
2003-03-31 21:02:12 +00:00
dsl bd99e3429d Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK, delete casts from callers (and some to copyin/out).
2003-03-21 23:11:19 +00:00
kristerw f73d0d2d8c ffs_gop_alloc() is not used any more. Remove it.
OK:ed by Konrad Schroder.
2003-03-15 01:10:18 +00:00
perseant b397c875ae Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon.  To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:

* Create a writer daemon kernel thread whose purpose is to handle page
  writes for the pagedaemon, but which also takes over some of the
  functions of lfs_check().  This thread is started the first time an
  LFS is mounted.

* Add a "flags" parameter to GOP_SIZE.  Current values are
  GOP_SIZE_READ, meaning that the call should return the size of the
  in-core version of the file, and GOP_SIZE_WRITE, meaning that it
  should return the on-disk size.  One of GOP_SIZE_READ or
  GOP_SIZE_WRITE must be specified.

* Instead of using malloc(...M_WAITOK) for everything, reserve enough
  resources to get by and use malloc(...M_NOWAIT), using the reserves if
  necessary.  Use the pool subsystem for structures small enough that
  this is feasible.  This also obsoletes LFS_THROTTLE.

And a few that are not strictly necessary:

* Moves the LFS inode extensions off onto a separately allocated
  structure; getting closer to LFS as an LKM.  "Welcome to 1.6O."

* Unified GOP_ALLOC between FFS and LFS.

* Update LFS copyright headers to correct values.

* Actually cast to unsigned in lfs_shellsort, like the comment says.

* Keep track of which segments were empty before the previous
  checkpoint; any segments that pass two checkpoints both dirty and
  empty can be summarily cleaned.  Do this.  Right now lfs_segclean
  still works, but this should be turned into an effectless
  compatibility syscall.
2003-02-17 23:48:08 +00:00
pk 338f31f581 Make the buffer cache code MP-safe. 2003-02-05 21:38:38 +00:00
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
simonb 0adecbd12b Remove variable that is only assigned to but not referenced. 2003-01-29 03:06:40 +00:00
tsutsui daf84696c6 More printf format cleanup to reduce casts. 2003-01-26 06:42:31 +00:00
tron 5067836b9e Use PRId64 instead of hard coding "%lld" to fix build problems under
LP64 ports.
2003-01-25 18:12:31 +00:00
fvdl a138610cac The oldblks and newblks arrays are used to store direct copies of
on-disk block pointers, so they should be int32_t. Error found
by Izumi Tsutsui.
2003-01-25 16:40:28 +00:00
tron 63dda858c6 Fix printf() format strings problems caused by "daddr_t" change. 2003-01-25 12:50:38 +00:00
fvdl a3ff3a3038 Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
2003-01-24 21:55:02 +00:00
chs 822a8f2c0f several bugs:
- move calls to softdep_setup_pagecache() (which can sleep to allocate
   memory) outside the softdep lock.
 - replace the softdep_flush_indir() hack (which tries to find another
   vnode to fsync when we are holding lots of buffer-cache buffers locked
   for long periods of time) with softdep_trackbufs() (which just kicks
   the syncer and sleeps under the same circumstances).  the former method
   had a lock-ordering problem which would occasionally deadlock.
 - relax the assertion in softdep_sync_metadata() which says that we should
   never see D_ALLOCDIRECT deps for VREG vnodes.  it's ok to see those
   attached to indirect blocks.

also, there's no need to splbio() while allocating the buffer headers
to which pagecache dependencies are attached, so remove that.

fixes all the problems in PR 19288.
2003-01-01 23:08:56 +00:00
hannken c122326822 Clear IN_SPACECOUNTED on (re-)used inodes.
This cures the "unmount pending error:" on softdep umounts.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2002-12-27 16:07:13 +00:00
matt 60db16d1ff Add multiple inclusion protection for headers. Fix mismatched
variable declarations (missing const's) as needed.
2002-12-01 00:12:06 +00:00