Commit Graph

58 Commits

Author SHA1 Message Date
hannken 2b3efeeac5 Persistent snapshots do not need to allocate the variable softc elements. 2008-09-18 10:52:14 +00:00
hannken 8de1a273e1 Replace the fss unmount hook with a vfs_hook.
fssvar.h:       struct device * -> device_t.
fss.c:          establish unmount hook on first attach, remove on last detach.
vfs_syscalls.c: remove the call of fss_umount_hook().
vfs_trans.c:    destroy cow handlers on unmount as fstrans_unmount() will be
                called before vfs_hooks.
2008-09-17 14:49:25 +00:00
hannken fce2c1d412 Create fss(4) devices on first open and destroy on last close of an
unconfigured device.  That removes the compile-time constant number
of useable devices.
While here, add disk_busy()/disk_unbusy() instrumentation.

Reviewed by: Quentin Garnier <cube@netbsd.org>
2008-09-14 16:10:19 +00:00
hannken d5a365311b Remove FSS_STATISTICS. It was never documented and has no real value.
While here, modify fss_error() to no longer use variable arguments.

No functional changes.
2008-09-14 10:12:14 +00:00
hannken dee5129905 - Replace simple_lock/ltsleep/wakeup with mutex/cv.
- Replace malloc/free with kmem_alloc/kmem_free.
- Use bdev_ioctl() instead of bdevsw_lookup()/(*d_ioctl)().
- Be more fair to readers by cleaning the cache one slot at a time.
2008-09-12 10:56:14 +00:00
hannken 31cd18f961 fss_copy_on_write(): return error if reading the snapshotted device failed.
fss_read_cluster():  use nestiobuf for reading.
fss_bs_thread():     dont read the snapshotted device if a request is
                     completely covered by backing store.
2008-09-11 09:37:53 +00:00
hannken 83e3e8b863 Use (*bdev->d_ioctl)() to get the size of the block device the file system
is mounted on.  VOP_IOCTL() without VOP_OPEN() is wrong and we cannot
open a block device twice.

Fixes PR #39405
2008-08-26 13:04:55 +00:00
hannken 8c66a4c56f Fail requests from pagedaemon that need to copy-on-write. 2008-08-15 10:31:24 +00:00
hannken 93d3ff0e45 Deny read/write access to snapshot vnodes. We use fss(4) to read from
snapshots.  With this policy in place:

- Separate the snapshot vnode lock from the snapshot common lock.
  Snapshots no longer need recursive vnode locks.

- Use a mutex (si_snaplock) to serialize creation, deletion, reading and
  writing of snapshots.

- Move ffs_read() for snapshots into ffs_snapshot.c.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>

While here change ffs_copyonwrite() to fail requests from pagedaemon that need
to copy-on-write.
2008-08-12 10:14:37 +00:00
hannken ca4c4b49e1 Stop reusing a buffer obtained with getiobuf(). 2008-07-08 14:57:03 +00:00
mlelstv cc60ba374c fix copy&paste error 2008-06-17 15:05:15 +00:00
mlelstv b0199ee162 One more place to mark an iobuf busy before use. 2008-06-17 15:04:12 +00:00
reinoud f6a70673ba Mark a buffer `busy` in getnewbuf() when it came from the pool_cache since
its not on a free list.

Also change buf_init() to not automatically mark buffers `busy' since this
only makes sense for bufcache buffers.

Mark all buf_init'd buffers 'busy' on the places where they ought to be
flagged as such to not confuse the buffer cache.

Fixes PR 38923.
2008-06-17 14:53:10 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
pooka db06a930e6 Remove cn_lwp from struct componentname. curlwp should be used
from on.  The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
2007-12-08 19:29:36 +00:00
ad 598ab03ad0 Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
2007-12-05 07:06:50 +00:00
hannken d556dc98b0 Fscow_run(): add a flag "bool data_valid" to note still valid data.
Buffers run through copy-on-write are marked B_COWDONE.  This condition
is valid until the buffer has run through bwrite() and gets cleared from
biodone().

Welcome to 4.99.39.

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
2007-12-02 13:56:15 +00:00
pooka 61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
rmind f499d5e662 Use PRI_BIO for kthreads instead of PINOD. Fixes a missed case of priority
inversion, which caused LFS to fire some assertions.

Reported by Kurt Schreiner on <current-users>.
2007-11-10 18:53:57 +00:00
ad 7dad9f7391 Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
2007-10-10 20:42:20 +00:00
hannken 3856acafe2 Update the file system copy-on-write handler.
- Instead of hooking the handler on the specdev of a mounted file system
  hook directly on the `struct mount'.

- Rename from `vn_cow_*' to `fscow_*' and move to `kern/vfs_trans.c'.  Use
  `mount_*specific' instead of clobbering `struct mount' or `struct specinfo'.

- Replace the hand-made reader/writer lock with a krwlock.

- Keep `vn_cow_*' functions and mark as obsolete.

- Welcome to NetBSD 4.99.32 - `struct specinfo' changed size.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
2007-10-07 13:38:53 +00:00
ad eb171eaaa7 It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:50:17 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
ad 9abeea588a Replace some uses of lockmgr() / simplelocks. 2007-02-15 15:40:50 +00:00
hannken 1b9c6382e3 New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE.  This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
2007-01-19 14:49:08 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
ad 3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
hannken 3d3a6761ea fss_bs_thread: add FSS_LOCK() in two error cases so the lock is held
on top of the loop.

From Christian Ehrhardt (netbsd-kern AT c--e.de) via tech-kern@
2006-04-13 15:56:53 +00:00
chs 3b7a4338db use lockmgr() instead of bespoke code for mutual exclusion in fss_ioctl().
only take the lock when we actually need it (and particularly not for
unknown cmds that are just going to fail immediately).  fixes PR 33060.
2006-03-14 15:07:29 +00:00
yamt e86cc25701 don't set b_rawblkno unnecessarily.
it will be set by device strategy routine.
2006-01-11 00:49:59 +00:00
yamt ea494c18a9 fss_cluster_iodone: don't call brelvp on non-buffercache buf. 2006-01-07 01:11:42 +00:00
yamt 2addc3084c remove B_EINTR as it isn't used anymore. 2006-01-07 00:26:58 +00:00
yamt 690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
hannken 366a53ff0c Run all i/o from or to backing store through fss_bs_io().
Replace VOP_BMAP()/VOP_BALLOC() by vn_rdwr()/VOP_PUTPAGES().

Inspired by discussion on tech-kern@
2005-10-24 14:25:06 +00:00
yamt aec75b1cc6 - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
  have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
  from sys/bufq.h to sys/bufq_impl.h.
  (is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c.  (not tested)
2005-10-15 17:29:10 +00:00
hannken 6cb4c22637 Support user controllable flags for the snapshot driver:
- Add FSSIOFSET and FSSIOFGET ioctl() to set/get the flags.
- Add FSS_UNCONFIG_ON_CLOSE flag to unconfigure the snapshot device
  on the last close.

Reviewed by: Jason R. Thorpe <thorpej@netbsd.org>
2005-04-17 16:28:26 +00:00
hannken e97aafbc0b When a snapshot gets unconfigured always clear `FSS_BS_ALLOC'. 2005-04-17 11:39:52 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
hannken 78f7fe0941 - Unlock backing store vnode in case of error.
- 32 -> sizeof()*NBBY
2005-02-09 15:12:19 +00:00
hannken 3404c7af50 Move the inclusion of <sys/bufq.h> from fss.c to fssvar.h to make
an FSS-enabled kernel compile again.
2004-10-29 15:39:38 +00:00
yamt 05f25dcc2a move buffer queue related stuffs from buf.h to their own header, bufq.h. 2004-10-28 07:07:35 +00:00
hannken 7a5be5a9ff - Add flag L_COWINPROGRESS to struct lwp to avoid recursion when
doing copy-on-write.

- Change VFS_SNAPSHOT() to return the snapshot vnode locked.

- Make the IO path for copy-on-write and snapshot-read more lightweight.
  Avoids deadlocks where vn_rdwr(...READ...) has a shared lock and needs
  to copy-on-write.
  Avoids deadlocks/panics where to clean pages the copy-on-write needs
  to allocate pages for its VOP_PUTPAGES().

L_COWINPROGRESS part approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-06-20 18:55:58 +00:00