Commit Graph

25 Commits

Author SHA1 Message Date
hannken 05e91bfee8 fss(4): Allow FSSIOCSET to set the initial flags. Add a new flag
"FSS_UNLINK_ON_CREATE" to unlink the backing store before
        the snapshot gets created.

With this change dump(8) no longer dumps the zero-sized, but named
snapshot it is working on.  Same applies to fsck_ffs(8).
2011-02-24 09:38:57 +00:00
hannken 374700a3d9 Remove unused fss_softc member sc_bs_size. 2010-04-05 09:30:46 +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 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
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
xtraeme 0f546319ca sys/simplelock.h is required now. 2008-01-04 21:33:17 +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 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
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
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
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +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
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
wiz f05e6f1a3a occured -> occurred. From Peter Postma. 2004-02-24 15:12:51 +00:00
hannken 142e9d5deb Add a generic copy-on-write hook to add/remove functions that will be
called with every buffer written through spec_strategy().

Used by fss(4). Future file-system-internal snapshots will need them too.

Welcome to 1.6ZK

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-02-14 00:00:56 +00:00
hannken 3db4e2acd8 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:06:48 +00:00
hannken 067a3b897d Update the file system snapshot driver:
- Document the kernel thread.
- Rename some functions and variables.
- Return EROFS where appropriate.
- Use shifts instead of 64-bit divide.
- Use a simple_lock to make it MP-safe.
- Add M_CANFAIL to malloc to avoid panic on large cluster size.
- Allow sparse file for backing store and use VOP_BALLOC() to allocate
  space. Default size of backing store is the size of the file system.
2004-01-11 19:05:26 +00:00
hannken fbae381aaa The file system snapshot pseudo driver.
Uses a hook in spec_strategy() to save data written from a mounted
file system to its block device and a hook in dounmount().

Not enabled by default in any kernel config.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-12-10 11:40:11 +00:00