Commit Graph

2123 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
2b1c6615bc Fix mmap(2) on ZFS after some changes in VM subsystem.
Submitted by:	alc
Reported by:	kris (originally) and many others
Tested with:	fsx
MFC after:	1 week
2008-03-15 23:23:04 +00:00
Attilio Rao
81c794f998 Axe the 'thread' argument from VOP_ISLOCKED() and lockstatus() as it is
always curthread.

As KPI gets broken by this patch, manpages and __FreeBSD_version will be
updated by further commits.

Tested by:	Andrea Barberio <insomniac at slackware dot it>
2008-02-25 18:45:57 +00:00
Attilio Rao
628f51d275 Introduce some functions in the vnode locks namespace and in the ffs
namespace in order to handle lockmgr fields in a controlled way instead
than spreading all around bogus stubs:
- VN_LOCK_AREC() allows lock recursion for a specified vnode
- VN_LOCK_ASHARE() allows lock sharing for a specified vnode

In FFS land:
- BUF_AREC() allows lock recursion for a specified buffer lock
- BUF_NOREC() disallows recursion for a specified buffer lock

Side note: union_subr.c::unionfs_node_update() is the only other function
directly handling lockmgr fields. As this is not simple to fix, it has
been left behind as "sole" exception.
2008-02-24 16:38:58 +00:00
Pawel Jakub Dawidek
79bc018dd7 - Reduce how much ZFS caches by default. This is another change to mitigate
'kmem_map too small panics'.
- Print two warnings if there is not enough memory and not enough address
  space.
- Improve comment.
2008-01-24 11:24:16 +00:00
Pawel Jakub Dawidek
44ce1efd91 Change type of kmem_used() and kmem_size() functions to uint64_t, so it
doesn't overflow in arc.c in this check:

	if (kmem_used() > (kmem_size() * 4) / 5)
		return (1);

With this bug ZFS almost doesn't cache.

Only 32bit machines are affected that have vm.kmem_size set to values >=1GB.

Reported by:	David Taylor <davidt@yadt.co.uk>
2008-01-24 11:21:54 +00:00
Attilio Rao
22db15c06f VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used in
conjuction with 'thread' argument passing which is always curthread.
Remove the unuseful extra-argument and pass explicitly curthread to lower
layer functions, when necessary.

KPI results broken by this change, which should affect several ports, so
version bumping and manpage update will be further committed.

Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
2008-01-13 14:44:15 +00:00
Attilio Rao
cb05b60a89 vn_lock() is currently only used with the 'curthread' passed as argument.
Remove this argument and pass curthread directly to underlying
VOP_LOCK1() VFS method. This modify makes the code cleaner and in
particular remove an annoying dependence helping next lockmgr() cleanup.
KPI results, obviously, changed.

Manpage and FreeBSD_version will be updated through further commits.

As a side note, would be valuable to say that next commits will address
a similar cleanup about VFS methods, in particular vop_lock1 and
vop_unlock.

Tested by:	Diego Sardina <siarodx at gmail dot com>,
		Andrea Di Pasquale <whyx dot it at gmail dot com>
2008-01-10 01:10:58 +00:00
John Birrell
35a04710d7 Remove some compatibility stuff that we now get from the Solaris header. 2007-11-29 00:15:08 +00:00
John Birrell
b468fe2bce * Check endianness the FreeBSD way.
* Use LBOLT rather than lbolt to avoid a clash with a FreeBSD global
  variable.
2007-11-28 22:16:00 +00:00
John Birrell
9587fed572 Fix a prototype definition. 2007-11-28 22:13:28 +00:00
John Birrell
da9085a1c0 Check endianness the FreeBSD way. 2007-11-28 22:12:21 +00:00
John Birrell
47b288c152 Include an extra header to get this to compile cleanly. 2007-11-28 22:11:39 +00:00
John Birrell
57438287ab Add more OpenSolaris compatibility headers. 2007-11-28 21:50:40 +00:00
John Birrell
eca148b637 Remove an extern that is defined elsewhere. 2007-11-28 21:50:05 +00:00
John Birrell
edadde229a Add compatibility cruft moved from under _SOLARIS_C_SOURCE in sys/types.h 2007-11-28 21:49:16 +00:00
John Birrell
35ba7f225f Remove a typedef which was just a hack to avoid including vmem.h.
That typedef breaks other Solaris code.
2007-11-28 21:48:25 +00:00
John Birrell
773f4e3849 Add a missing volatile so that the code compiles cleanly. 2007-11-28 21:47:09 +00:00
John Birrell
4fc8feafc7 Rename the definition of lbolt to LBOLT to avoid a clash with a global
variable in FreeBSD. Until now lbolt in sys/proc.h has been #ifdef'ed
out based on _SOLARIS_C_SOURCE, but that is going away now.
2007-11-28 21:44:17 +00:00
Pawel Jakub Dawidek
4d4daf5901 Warn if kmem_map size is set to less than 512MB. Previous warning was a bit
pointless, because default is set to something around 300MB and also
insufficient.

MFC after:	3 days
2007-11-07 14:44:31 +00:00
Pawel Jakub Dawidek
232a80f675 Remove unused header.
MFC after:	3 days
2007-11-05 22:18:34 +00:00
Pawel Jakub Dawidek
a33b7a8f5f If setting a state to anything but open state, close access to vdev.
This fixes replacing drive in place, eg. zpool replace tank da1 da1.
Before it complained that device is already open.

MFC after:	1 week
2007-11-05 21:30:48 +00:00
Pawel Jakub Dawidek
171eb887e9 Remove "zfs:" prefix from lock and condvar names and also skip non-letter
characters (mostly "&"). Because top(1) shows only first six characters of
wait channel, without this change we saw only one meaningful character.

Requested by:	kris & others
MFC after:	1 week
2007-11-05 18:40:55 +00:00
Ulf Lilleengen
6509baf851 - Add sysctl for sizeof(znode_t), which will be used by fstat(1).
Approved by:	pjd (mentor)
2007-11-02 00:35:05 +00:00
Pawel Jakub Dawidek
ef2d58b58f Call zil_commit() (if ZIL is not disabled) after every non-read request
(BIO_WRITE and BIO_FLUSH) as it is done is Solaris. The difference is
that Solaris calls it only for sync requests, but we can't say in GEOM
is the request is sync or async, so we do it for every request.

MFC after:	1 week
2007-11-01 11:04:21 +00:00
Pawel Jakub Dawidek
4f2398ea17 - Move crfree() outside MNT_ILOCK()/MNT_IUNLOCK() to eliminate a LOR:
1st 0xc4cea568 struct mount mtx (struct mount mtx) @ /usr/src/sys/modules/zfs/../../compat/opensolaris/kern/opensolaris_vfs.c:209
  2nd 0xc3ee9010 sleep mtxpool (sleep mtxpool) @ /usr/src/sys/kern/kern_resource.c:1266
- Move crdup() outside MNT_ILOCK()/MNT_IUNLOCK(), as it can sleep.

Reported by:	Olli Hauer <ohauer@gmx.de>
MFC after:	3 days
2007-11-01 08:58:29 +00:00
Julian Elischer
3745c395ec Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0  so that we can eventually MFC the
new kthread_xxx() calls.
2007-10-20 23:23:23 +00:00
Andrew Thompson
1fe1be1535 ZFS_LOG adds a newline by itself.
Pointed out by:	pjd
2007-10-14 16:14:32 +00:00
Andrew Thompson
9528621759 Print the ZFS ereport to the console if vfs.zfs.debug is set to help diagnose
problems with zfs-on-root since devd isnt running yet.

Reviewed by:	pjd
2007-10-14 07:58:50 +00:00
Pawel Jakub Dawidek
e8bd23b460 Fix lock leak leading to the 'System call <name> returning with 1 locks held'
panic.

Reported by:	kris
Approved by:	re (kensmith)
2007-10-04 17:51:59 +00:00
Pawel Jakub Dawidek
a95a61fc19 Now that we have CDDLed code in the tree, add CDDL license.
Discussed with:	core
Approved by:	re (kensmith)
2007-09-23 07:04:50 +00:00
Pawel Jakub Dawidek
a3c8c2e60f Reduce the limit of vnodes on i386 when ZFS is loaded to 3/4 of the original
value, so we don't run out of KVA. The default vnodes limit fits better for
UFS, but ZFS allocated more file system specific memory for a vnode than UFS.

Don't touch vnodes limit if we detect it was tuned by system administrator
and restore original value when ZFS is unloaded.

This isn't final fix, but before we implement something better, this will
help to stabilize ZFS under heavy load on i386.

Approved by:	re (bmah)
2007-09-10 19:58:14 +00:00
Pawel Jakub Dawidek
ef0ffc1c6f After dfr@ vnode leak fix, we can allow ARC to consume more memory.
Tested by:	kris
Approved by:	re (bmah)
2007-09-10 18:12:27 +00:00
Pawel Jakub Dawidek
6bc581fcf0 Use CTLFLAG_RDTUN for tunable sysctls.
Approved by:	re (bmah)
2007-09-01 06:23:42 +00:00
Pawel Jakub Dawidek
70eaa4219c Some ZFS threads needs stack larger than the default 8kB, so use 16kB of
alternate stack if the default is smaller than 16kB.

Approved by:	re (rwatson)
2007-08-16 20:33:20 +00:00
Pawel Jakub Dawidek
aa222db26f Update assertion after revision 1.23.
Reviewed by:	dfr
Approved by:	re (rwatson)
2007-07-24 15:00:43 +00:00
Doug Rabson
2dc26b36c8 Correct a reference-counting mistake in the ZFS code which led to abnormal
memory usage and pessimal cache performance.

Reviewed by: pjd
Approved by: re (rwatson)
2007-07-09 09:03:49 +00:00
Doug Rabson
7761242694 In zfs_vget, if we fail to translate an inode number to the corresponding
vnode, make sure we return an error code to the caller.

Reviewed by: pjd
Approved by: re
2007-06-27 12:00:24 +00:00
Robert Watson
32f9753cfb Eliminate now-unused SUSER_ALLOWJAIL arguments to priv_check_cred(); in
some cases, move to priv_check() if it was an operation on a thread and
no other flags were present.

Eliminate caller-side jail exception checking (also now-unused); jail
privilege exception code now goes solely in kern_jail.c.

We can't yet eliminate suser() due to some cases in the KAME code where
a privilege check is performed and then used in many different deferred
paths.  Do, however, move those prototypes to priv.h.

Reviewed by:	csjp
Obtained from:	TrustedBSD Project
2007-06-12 00:12:01 +00:00
Marcel Moolenaar
6d63683c41 Add my copyright.
Requested by: pjd@
2007-06-08 16:20:03 +00:00
Pawel Jakub Dawidek
3b7917d766 - Reduce number of atomic operations needed to be implemented in asm by
implementing some of them using existing ones.
- Allow to compile ZFS on all archs and use atomic operations surrounded
  by global mutex on archs we don't have or can't have all atomic
  operations needed by ZFS.
2007-06-08 12:35:47 +00:00
Pawel Jakub Dawidek
083c4dd695 Missing atomic operations for ZFS/ia64.
Submitted by:	marcel
2007-06-08 12:26:30 +00:00
David Malone
041b706b2f Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export.
The type must always be an int or an unsigned int.

Remove the instances where a sizeof(variable) is passed to stop
people accidently cut and pasting these examples.

In a few places this was sysctl_handle_int was being used on 64 bit
types, which would truncate the value to be exported.  In these
cases use sysctl_handle_quad to export them and change the format
to Q so that sysctl(1) can still print them.
2007-06-04 18:25:08 +00:00
Pawel Jakub Dawidek
b166b92692 Reimplement traverse() helper function:
1. Pass locking flags to VFS_ROOT().
2. Check v_mountedhere while the vnode is locked.
3. Always return locked vnode on success.

Change 1 fixes problem reported by Stephen M. Rumble - after
zfs_vfsops.c,1.9 change, zfs_root() no longer locks the vnode
unconditionally and traverse() didn't pass right lock type to
VFS_ROOT(). The result was that kernel paniced when .zfs/ directory
was accessed via NFS.
2007-06-04 11:31:46 +00:00
Konstantin Belousov
9e223287c0 Revert UF_OPENING workaround for CURRENT.
Change the VOP_OPEN(), vn_open() vnode operation and d_fdopen() cdev operation
argument from being file descriptor index into the pointer to struct file.

Proposed and reviewed by:	jhb
Reviewed by:	daichi (unionfs)
Approved by:	re (kensmith)
2007-05-31 11:51:53 +00:00
Pawel Jakub Dawidek
5750956634 Adjust va_mask for setattr. FreeBSD doesn't have va_mask, so we initialize it
based on individual fields beeing set. This doesn't work for setattr replay,
because va_type is set there, so we add AT_TYPE flag to va_mask, which won't
be accepted by zfs_setattr().

Reported by:	kris
2007-05-28 02:37:43 +00:00
Pawel Jakub Dawidek
a906fff9c5 Because we allocate componentname structures on stack, bzero() them before
use just in case.
2007-05-28 00:26:20 +00:00
Pawel Jakub Dawidek
0d99488ded There are too many false positive LORs reported by WITNESS, so when ZFS
debug is turned off, initialize locks with NOWITNESS flag.
At some point I'll get back to them, we would probably need BLESSING
functionality, which is currently turned off by default.
2007-05-26 21:37:14 +00:00
Pawel Jakub Dawidek
fbd08bbe6a DNLC_NO_VNODE can't be NULL.
Reported by:	ru
2007-05-24 13:44:45 +00:00
Pawel Jakub Dawidek
f92dd5c2d9 Initialize ZFS a bit earlier and block root mounting until
initialization is complete. This fixes some root-on-ZFS
configurations.

Reported by:	Bruno Damour <freebsd.ruomad@free.fr>
Tested by:	Bruno Damour <freebsd.ruomad@free.fr>
2007-05-24 07:43:00 +00:00
Pawel Jakub Dawidek
d4c4dfe96f FreeBSD's namecache works quite well with ZFS, so remove DNLC. 2007-05-23 21:33:02 +00:00
Pawel Jakub Dawidek
4282c449dc All objects we create using GFS are directories, so initialize d_type
properly, but add XXX comment saying that it can eventually change in
the future.
2007-05-23 21:27:47 +00:00
Pawel Jakub Dawidek
124427f96d Lock vnode on lookup. This fixes ZIL replay for rmdir/unlink/rename.
Reported by:	des
2007-05-22 21:22:25 +00:00
Pawel Jakub Dawidek
68e752c31c Increase debug level - this message is not that important. 2007-05-09 22:32:49 +00:00
Pawel Jakub Dawidek
6a7309390f - Add missing lock destruction and remove duplicate initializations.
With this change it is possible to unload zfs.ko module from
  WITNESS-enabled kernel.
- Remove bogus comment.
2007-05-06 19:05:37 +00:00
Pawel Jakub Dawidek
7baf73a6c2 Use provider's ident to handle situations when disks are moved around
and show up with different names: first try to open provider using
remembered name and compare its ident, if equal, this is our provider,
if not equal or there is no provider with such name, find provider with
remembered ident and don't care about the name.
2007-05-06 01:39:39 +00:00
Pawel Jakub Dawidek
fab3f4465e MFp4: We don't need to cover vnode_pager_setsize() with the z_map_lock. 2007-05-06 01:27:54 +00:00
Pawel Jakub Dawidek
57504dcfaf Share-lock a vnode where possible. 2007-05-02 01:03:10 +00:00
Pawel Jakub Dawidek
5bec66402b When parent directory has to be unlocked, lock it back with the same lock
type. Before this change, if directory was shared-locked, it was relocked
exclusively.
2007-05-02 00:41:44 +00:00
Pawel Jakub Dawidek
9167141244 Lock vnode using cn_lkflags in case the caller wants the vnode to be
shared-locked.
2007-05-02 00:39:52 +00:00
Pawel Jakub Dawidek
04748b1b2e The getnewvnode() function sets LK_NOSHARE by default, so if we want to
support shared vnodes locking, we need to remove that flag.
Also add LK_CANRECURSE flag as found in nfsclient.
2007-05-02 00:22:12 +00:00
Pawel Jakub Dawidek
0775674bbc ZFS should update timestamps upon the creat() of an existing file.
Obtained from:	OpenSolaris
Bug:		http://bugs.opensolaris.org/view_bug.do?bug_id=6465105
2007-05-02 00:18:22 +00:00
Pawel Jakub Dawidek
6de6bff649 - Lock vnode with flags passed in as argument in zfs_vget() and zfs_root().
Pointed out by:	ups
  Also reported by:	kris

- Add comments where I'm not sure if LK_RETRY should be used.
2007-05-02 00:09:34 +00:00
Pawel Jakub Dawidek
d1d7399da5 MFp4: Remove LK_RETRY flag when locking vnode in zfs_lookup, we don't want
dead vnodes here.

Suggested by:	kib
2007-05-01 13:58:56 +00:00
Pawel Jakub Dawidek
80ae748326 White space fixes. 2007-05-01 13:32:22 +00:00
Pawel Jakub Dawidek
7555fddd83 Add a comment explaining why we call dmu_write() unconditionally, even if
uiomove() fails, especially that it is different from what OpenSolaris
does (I'm not entirely sure they are right).

Suggested by:	darrenr
2007-05-01 12:09:45 +00:00
Pawel Jakub Dawidek
2f51d93626 - Define d_type for ".", ".." and ".zfs" directories.
- Add a TODO comment where d_type is still noe defined.
2007-04-29 23:28:07 +00:00
Pawel Jakub Dawidek
b9f28e4a35 Oops, correct important typo in last commit. 2007-04-29 23:12:00 +00:00
Pawel Jakub Dawidek
2c965e1956 Avoid freeing NULL pointer in case of an error. 2007-04-29 23:08:24 +00:00
Pawel Jakub Dawidek
f2c9356328 Fix two use-after-free cases. 2007-04-29 00:41:29 +00:00
Pawel Jakub Dawidek
c28672efcc MFp4: Optimize mappedwrite() and mappedread() functions to write/read as much
non-mapped data as possible at once and not page-by-page. Which this change we
combain I/Os, but also saves many VM_OBJECT_UNLOCK()/VM_OBJECT_LOCK()
operations.

Simple 'fsx -l 33554432 -o 524288 -N 10000 /tank/fsx' test shows ~23%
performance increase.
2007-04-26 17:07:50 +00:00
Pawel Jakub Dawidek
171c4b21e2 - Always try to write one whole page at a time.
- vm_page_undirty() is enough (instead of vm_page_set_validclean()), but it has
  to be called before we write the data in case someone makes page dirty after
  our write, but before our vm_page_undirty() call.
- Always dmu_write, not matter if uiomove() succeeded, because it could
  partially be ok and we would lose some changes.

All good ideas from:	ups
2007-04-26 12:58:17 +00:00
Pawel Jakub Dawidek
caa93cc3a0 MFV: Free znodes immediatelly, allowing the ARC to hold onto less memory.
Full description at:	http://bugs.opensolaris.org/view_bug.do?bug_id=6543706
2007-04-26 10:08:54 +00:00
Pawel Jakub Dawidek
5da1b1ed71 MFV: Functions name change. 2007-04-26 09:38:20 +00:00
Pawel Jakub Dawidek
1e788bd7e5 ZIL (ZFS Intent Log) can be safely turned on and off at run time, because
it is only used when dataset is beeing mounted to decide if log should also
be opened.
2007-04-24 19:02:51 +00:00
Pawel Jakub Dawidek
8b384c52c0 MFp4: Now that ZFS can use FreeBSD's namecache, turn it off by default and
turn off DNLC, but don't remove DNLC yet just in case.
2007-04-24 16:59:20 +00:00
Pawel Jakub Dawidek
f13f738876 MFp4: Rearange the code so vobject is destroyed from reclaim() method like
in all other file system on FreeBSD (instead from inactive() method).

A nice side-effect of this change, except that it speedups file system
when mmaped file are often open/closed, is that it makes FreeBSD's
namecache work:)
2007-04-24 16:57:53 +00:00
Pawel Jakub Dawidek
0cdad5e228 MFp4: Once page is written successfully, we should clear the dirty bits.
This fixes slow operations on mmaped files, because without this fix,
pages were written to disk multiple times.

If one is looking for even greater speed up for such operation, he should
disable ZIL (by setting vfs.zfs.zil_disable to 1 in /boot/loader.conf).
Disabling ZIL makes fsx run ~9 times faster.
2007-04-24 16:53:01 +00:00
Pawel Jakub Dawidek
71ce4c9c10 MFp4: Reduce diff against vendor. 2007-04-24 16:49:01 +00:00
Pawel Jakub Dawidek
692fd5a7b9 MFp4: We have stronger 'lock already initialized' check now, so we can
reduce diff against the vendor by removing bzero of this mutex.
2007-04-24 16:45:42 +00:00
Bruce A. Mah
9100d31299 Mostly-cosmetic fixes in low-memory warning messages:
o Fix linewrap issues.

o Fix two typos (s/Recomended/Recommended/ and s/tunning/tuning/)

o Remove a couple of extra instances of the word "of".

o Update names of kmem_size variables.

Approved by:	pjd
2007-04-23 21:52:14 +00:00
Pawel Jakub Dawidek
cfda925270 Too much diff reduction. 'cmd' has to be u_long.
Reported by:	delphij
2007-04-23 13:47:49 +00:00
Pawel Jakub Dawidek
cc7cd831b2 MFp4: Reduce diff against vendor code:
- Move FreeBSD-specific code to zfs_freebsd_*() functions in zfs_vnops.c
  and keep original functions as similar to vendor's code as possible.
- Add various includes back, now that we have them.
2007-04-23 00:52:07 +00:00
Pawel Jakub Dawidek
3698384259 Fix 'zpool status -v'. To get object number we should use ZFS_DIRENT_OBJ()
macro, as za_first_integer field also contains type. This should be fixed in
ZFS itself, but this bug is not visible on Solaris, because there, type is
not stored in za_first_integer. On the other hand it will be visible on
MacOS X.

Reported by:	Barry Pederson <bp@barryp.org>
2007-04-22 21:18:40 +00:00
Pawel Jakub Dawidek
77128a226d Fix st_rdev handling (implement it, actually).
Reported by:	gj
2007-04-22 21:16:15 +00:00
Pawel Jakub Dawidek
9de81c7273 MFp4:
@118370	Correct typo.

@118371	Integrate changes from vendor.

@118491	Show backtrace on unexpected code paths.

@118494	Integrate changes from vendor.

@118504	Fix sendfile(2). I had two ways of fixing it:
	1. Fixing sendfile(2) itself to use VOP_GETPAGES() instead of
	   hacking around with vn_rdwr(UIO_NOCOPY), which was suggested
	   by ups.
	2. Modify ZFS behaviour to handle this special case.

	Although 1 is more correct, I've choosen 2, because hack from 1
	have a side-effect of beeing faster - it reads ahead MAXBSIZE
	bytes instead of reading page by page. This is not easy to implement
	with VOP_GETPAGES(), at least not for me in this very moment.

	Reported by:	Andrey V. Elsukov <bu7cher@yandex.ru>

@118525	Reorganize the code to reduce diff.

@118526	This code path is expected. It is simply when file is opened with
	O_FSYNC flag.

	Reported by:	kris
	Reported by:	Michal Suszko <dry@dry.pl>
2007-04-21 12:02:57 +00:00
Pawel Jakub Dawidek
32371d2025 MFp4: Fix automatic snapshot mount when unprivileged user does lookup
on a snapshot directory:
- Remove PRIV_VFS_MOUNT check - regular users can mount snapshots
  via lookups on snapshot directory.
- Reset mount credential to kcred, so user won't be able to unmount
  the snapshot.
- Reset owner uid.
- Unlock vnode in case of a failure.

Reported by:	simokawa
2007-04-18 15:24:48 +00:00
Pawel Jakub Dawidek
f2c9a576db MFp4: We check for PRIV_VFS_MOUNT already in mount(2) syscall and we don't
want to do the check when snapshot is automatically mounted by an
      unprivileged user doing lookup on a snapshot directory.
2007-04-18 15:22:07 +00:00
Pawel Jakub Dawidek
35e8a7fad7 Simplify. 2007-04-17 21:58:34 +00:00
Pawel Jakub Dawidek
a1bcf4dc7b - Fix a leftover - vfs_mount_alloc() is now exported properly.
This fixes stange panics when listing .zfs/snapshot/ directory for me.
  Reported by:	simokawa
  Reported by:	Johan Hendriks <Johan@double-l.nl>
- Hide cache_purge() under FREEBSD_NAMECACHE like in other files.
- Protect mnt_flag with mount interlock.
2007-04-17 21:16:34 +00:00
Pawel Jakub Dawidek
39db4c6e0f Ignore hostid check for root-on-ZFS configurations. Making hostid available
before the root is mounted is tricky and having it in /boot/ is not really
desire.

Reported by:	Zephiris <zephiris@gmail.com>
2007-04-17 17:57:34 +00:00
Pawel Jakub Dawidek
8cb195f758 Uncomment forgotten check. Without this check in-place, ZFS will panic on
unload instead of returning EBUSY. This check tells if there are mounted
ZFS file systems or not. We can't unload if there are mounted file systems.

Reported by:	Andrey V. Elsukov <bu7cher@yandex.ru>
2007-04-16 10:23:24 +00:00
Pawel Jakub Dawidek
7ae6548e62 MFp4: Start DNLC after desiredvnodes variable is initialized.
Before this change if zfs.ko was loaded by the loader, DNLC was
      automatically disabled.

Reported by:	Zephiris <zephiris@gmail.com>
2007-04-15 09:10:17 +00:00
Pawel Jakub Dawidek
87e89536f1 Fix RAID-Z resilvering.
Obtained from:	OpenSolaris
2007-04-14 20:50:14 +00:00
Pawel Jakub Dawidek
d48078479c MFp4: Hmm, it seems to work now. 2007-04-14 15:01:50 +00:00
Pawel Jakub Dawidek
8aff52ca4e MFp4: Use max_ncpus, which is used in other places in the code. 2007-04-14 12:33:47 +00:00
Pawel Jakub Dawidek
8870baf005 MFp4: Add more debug, so we can see if zpool.cache was loaded or why it
wasn't loaded.
2007-04-14 12:23:03 +00:00
Pawel Jakub Dawidek
dbd490e0e2 MFp4: Allow to tune vfs.zfs.debug from loader.conf. 2007-04-14 12:21:06 +00:00
Pawel Jakub Dawidek
c98fbf0418 MFp4: - Allow to tune number of spa_zio_* threads.
- Reduce default number of spa_zio_* threads to N*spa_zio_issue
	  plus N*spa_zio_intr threads per ZIO type, where N is the number
	  of CPUs.
	- Put ZIO type number in thread's name.
2007-04-14 12:20:06 +00:00
Pawel Jakub Dawidek
bd59d85850 Fix overflow, which was causing endless loops when 32bit machine had more
than 2GB of RAM. This was because our physmem is long and 'physmem*PAGESIZE'
can be negative for more than 2GB of memory.

Reported by:	Andrey V. Elsukov <bu7cher@yandex.ru>

It is not yet tested by Andrey, so there can be other problems, but this
was definiately a bug, so I'm committing a fix now.
2007-04-13 18:50:03 +00:00
Pawel Jakub Dawidek
f0bc5ac3e1 Fix vnodes starvation caused by DNLC (ZFS name cache):
- Tune number of namecache entires better (based on desiredvnodes).
- Handle vfs_lowvnodes event by releasing requested number of name cache
  entries, but no less than 5%.

Reported by:	simokawa
2007-04-13 08:42:01 +00:00
Pawel Jakub Dawidek
6704017a15 MFp4: Synchronize with vendor (mostly 'zfs rename -r'). 2007-04-12 23:16:02 +00:00
Pawel Jakub Dawidek
1da61b3665 MFp4: Bring back comments.
Requested by:	jhb
2007-04-12 23:14:25 +00:00
Wojciech A. Koszek
f7caeade24 strchr() and strrchr() are already present in the kernel, but with less
popular names. Hence:

- comment current index() and rindex() functions, as these serve the same
  functionality as, respectively, strchr() and strrchr() from userland;
- add inlined version of strchr() and strrchr(), as we tend to use them more
  often;
- remove str[r]chr() definitions from ZFS code;

Reviewed by:	pjd
Approved by:	cognet (mentor)
2007-04-10 21:42:12 +00:00
Pawel Jakub Dawidek
1b6e2c02fe MFp4: Allow to set zfs_recover via vfs.zfs.recover from /boot/loader.conf. 2007-04-10 12:54:19 +00:00
Pawel Jakub Dawidek
5b9528e2d4 MFp4: Hide under '#ifdef _KERNEL' only what's really needed. 2007-04-10 12:52:14 +00:00
Pawel Jakub Dawidek
2d03e33170 Try to stabilize ZFS with regard to memory consumption:
- Allow to shrink ARC down to 16MB (instead of 64MB).
- Set arc_max to 1/2 of kmem_map by default.
- Start freeing things earlier when low memory situation is detected.
- Serialize execution of arc_lowmem().

I decided to setup minimum ZFS memory requirements to 512MB of RAM and 256MB of
kmem_map size. If there is less RAM or kmem_map, a warning will be printed.
World is cruel, be no better. In other words: modern file system requires
modern hardware:)

From ZFS administration guide:

"Currently the minimum amount of memory recommended to install a Solaris
 system is 512 Mbytes. However, for good ZFS performance, at least one
 Gbyte or more of memory is recommended."
2007-04-10 02:35:57 +00:00
Pawel Jakub Dawidek
52124c7f1c Reduce diff against vendor - we have now stronger check for "mutex already
initialized", so we can go back to kmem_alloc().
2007-04-10 02:19:12 +00:00
Pawel Jakub Dawidek
0404b7791b Remove unused #define. 2007-04-09 23:30:28 +00:00
Pawel Jakub Dawidek
24bda1641f Instead of detecting if lock is already initialized based on standard 1 bit
check, use more accurate 13 bits check. We had too many false-positives with
the standard check.

Reported by:	mlaier
2007-04-09 01:05:31 +00:00
Pawel Jakub Dawidek
33fc425c85 We don't have to wait for the root file system to be mounted anymore, now that
kobj KPI supports operating on files loaded by the loader.
2007-04-09 00:03:45 +00:00
Pawel Jakub Dawidek
5fc5d6ed61 Drop the Giant lock before calling zfs_domount(), which is held when
mounting root file system.
2007-04-09 00:02:11 +00:00
Pawel Jakub Dawidek
f92cb15e7b Move zpool.cache from /etc/zfs/ to /boot/zfs/, so we can keep it on
dedicated /boot/ file system and use ZFS for the root file system.
2007-04-08 23:59:39 +00:00
Pawel Jakub Dawidek
bdebccf9b9 Extend kobj compatibility KPI to support operating on files before and
after the root file system is mounted.
This is one of the changes that will allow to put root file system on ZFS.
2007-04-08 23:57:08 +00:00
Pawel Jakub Dawidek
ffe54ff0ec MFp4: Synchronize with recent OpenSolaris changes. 2007-04-08 16:29:25 +00:00
Pawel Jakub Dawidek
425d75486e - Use 'name=value' so it can be properly recognized by devd(8).
- Use only subclass as devd's type.
2007-04-08 15:55:48 +00:00
Pawel Jakub Dawidek
61cfeccd58 Take vnode pointer and hold it under znode lock, so we won't race with
zfs_reclaim(). This may or may not fix problem reported by kris, but it's
definiatelly better that way.
2007-04-08 10:29:14 +00:00
Pawel Jakub Dawidek
3dc4488c91 Move atomic.S files to directories that better fit OpenSolaris directory
layout.
2007-04-07 23:54:54 +00:00
Pawel Jakub Dawidek
e321494eca Fix libzpool compilation.
Reported by:	des
2007-04-07 23:47:14 +00:00
Pawel Jakub Dawidek
9a691cb33a Limit the number of system taskq threads to the number of CPUs.
They are only used when there is a need for reducing namecache.

Observed by:	kris, csjp
2007-04-07 21:41:11 +00:00
Dag-Erling Smørgrav
29665eac3f Fix some type mismatches.
Reviewed by:	pjd@
2007-04-07 19:11:41 +00:00
Pawel Jakub Dawidek
639fdcd852 Allow to tune maximum and minimum memory used by ARC. 2007-04-07 19:10:50 +00:00
Pawel Jakub Dawidek
a583dae953 Add missing mutex_init() which was causing assertion panic when on clone
destruction.

Reported by:	kris
2007-04-07 11:04:37 +00:00
Pawel Jakub Dawidek
f0a75d274a Please welcome ZFS - The last word in file systems.
ZFS file system was ported from OpenSolaris operating system. The code in under
CDDL license.

I'd like to thank all SUN developers that created this great piece of software.

Supported by:	Wheel LTD (http://www.wheel.pl/)
Supported by:	The FreeBSD Foundation (http://www.freebsdfoundation.org/)
Supported by:	Sentex (http://www.sentex.net/)
2007-04-06 01:09:06 +00:00