Commit Graph

272 Commits

Author SHA1 Message Date
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
kristerw fa033b67e7 Softdep is mature enough that it shouldn't define DEBUG and DIAGNOSTIC
unconditionally.
2002-11-30 20:27:50 +00:00
scw 7009056578 Quell an uninitialised variable warning. 2002-11-24 11:09:13 +00:00
wiz 29d58d0333 s/sqiud/squid/ in comment, reported by skrueger at europe com. 2002-11-04 16:59:37 +00:00
dbj 1d1cd19e5f use be32toh instead of ntohl, etc. 2002-11-02 19:31:09 +00:00
kristerw 58efa0630e Removed unused variables doclusterread and doclusterwrite. 2002-11-01 21:11:43 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
dbj 43395bd5a8 Add support for the Apple UFS variation on ffs
This is the bulk of PR #17345

The general approach is to use a run time deteriminable value
for DIRBLKSIZ.  Additional allowances are included for using
MAXSYMLINKLEN with FS_42INODEFMT and a shift in the cylinder group
cluster summary count array.  Support is added for managing
the Apple UFS volume label.
2002-09-28 20:11:05 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
simonb ad2a80f193 Move a brace that is in the wrong position when changes from FreeBSD
were added in rev 1.51.  This may fix the "N lost blocks" problem some
people have noticed.
Reviewed by fvdl.
2002-09-26 21:35:27 +00:00
christos 6f3945a88d MNT_GETARGS support 2002-09-21 18:10:34 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
thorpej 139cdc3125 Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.
2002-08-25 20:21:33 +00:00
soren 178d83d503 Die, qaddr_t, die! - mnt_data in struct mount is already effectively
a void *, so stop pretending otherwise.
2002-07-30 07:40:07 +00:00
fredette 10d4232908 Fixed a printf argument type. 2002-07-06 15:39:07 +00:00
scw 881a4dcac0 Cast pointers first to uintptr_t before casting to register_t.
On SH-5, sizeof(register_t) is always 8, even if sizeof(void *) is 4
as is the case when compiling for ILP32.
2002-07-05 13:49:26 +00:00
jdolecek 20644ff75f clear_inodedeps(): use CIRCLEQ_FOREACH() appropriately 2002-06-18 20:24:31 +00:00
chs ea4c4a989f allow read-only mounts even if we can't read the last fragment of the fs.
this enables one to recover data from a failing disk (where the read failure
is a hardware problem) while avoiding corrupting the fs further (in the case
where the read failure is due to a misconfiguration).
2002-06-09 16:46:49 +00:00
chs fffb1de109 get the units right when computing a blkno in the ENOSPC path
for allocations involving indirect blocks.
spotted by Trevin Beattie <trevin@xmission.com>.
2002-06-05 05:23:51 +00:00
matt fed7110558 Commit out code that's no longer used. 2002-05-14 02:46:22 +00:00
chs dcc6963777 for softdep vnodes, always write together the pages for any block that
might have a dependency , since the accounting doesn't work otherwise.
fixes PRs 15364 16336 16448.
2002-05-05 17:00:06 +00:00
mycroft fd303c4dc5 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.
2002-04-10 14:31:07 +00:00
mycroft afc5d40400 Use blkstofrags() and fragstoblks(). Use &(NBBY-1) rather than %NBBY.
Switch off of fs_fragshift rather than fs_frag (generates better jump tables).
2002-04-10 08:05:11 +00:00
mycroft 0a9b835878 Use fsbtodb() rather than multiplying by NSPF(). 2002-04-10 07:46:10 +00:00
enami 89cf6e2727 Hold an extra reference if updating and args.fspec == NULL. 2002-04-01 07:51:58 +00:00
christos e356d686bb Fixes from enami:
- If VOP_ACCESS fails when updating mount, we will vrele() twice.

- The check for update-only flags in mp->mnt_flag when not updating
  case is bogus.  If we really want to check, we need to see flags in
  ufs_args, but I'm not sure if it is really necessary.

- The credential passed to ffs_reload was credential of when looking
  up mount point, but now it is credential of when looking up device
  node.  Anyway, it may be current process's credential.
2002-04-01 01:52:44 +00:00
christos 919d9f5617 PR/16136: Chris Jepeway: Bogus entry in /etc/fstab can panic kernel. 2002-03-31 20:53:25 +00:00
wiz 358ed3f6d4 Fix a typo, a KNF-nit, and simplify a printf format string. 2002-03-18 13:38:52 +00:00
chs c1d184702f when mounting a filesystem, read the last block in the filesystem
to verify that the device is at least as big as the superblock claims
the filesystem is supposed to be, and if it's not then fail the mount.
this should help reduce the type of confusion reported in PR 13228.
2002-03-17 00:02:34 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
pooka 360cafaddb Don't add fs->fs_pendingblocks to f_bavail twice. It's already included
in f_bfree, which is added to f_bavail.

Fixes problem with statfs reporting too much free space for filesystems
which have files pending to be freed by softdeps.
2002-02-28 21:59:23 +00:00