summaryrefslogtreecommitdiffstats
path: root/sys/dev/md
Commit message (Collapse)AuthorAgeFilesLines
* Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed threadattilio2008-08-281-1/+1
| | | | | | was always curthread and totally unuseful. Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
* Remove the distinction between device minor and unit numbers.ed2008-05-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though we got rid of device major numbers some time ago, device drivers still need to provide unique device minor numbers to make_dev(). These numbers are only used inside the kernel. They are not related to device major and minor numbers which are visible in devfs. These are actually based on the inode number of the device. It would eventually be nice to remove minor numbers entirely, but we don't want to be too agressive here. Because the 8-15 bits of the device number field (si_drv0) are still reserved for the major number, there is no 1:1 mapping of the device minor and unit numbers. Because this is now unused, remove the restrictions on these numbers. The MAXMAJOR definition was actually used for two purposes. It was used to convert both the userspace and kernelspace device numbers to their major/minor pair, which is why it is now named UMINORMASK. minor2unit() and unit2minor() have now become useless. Both minor() and dev2unit() now serve the same purpose. We should eventually remove some of them, at least turning them into macro's. If devfs would become completely minor number unaware, we could consider using si_drv0 directly, just like si_drv1 and si_drv2. Approved by: philip (mentor)
* Zero sc->vnode if mdsetcred() fails.philip2008-02-281-0/+1
| | | | | | | | This fixes the panic which happens when mdcreate_vnode() calls vn_close() and mddestroy() calls it again further down the error handling path. Reviewed by: kris, kib MFC after: 3 days
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inattilio2008-01-131-8/+8
| | | | | | | | | | | 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>
* vn_lock() is currently only used with the 'curthread' passed as argument.attilio2008-01-101-6/+6
| | | | | | | | | | | | | | | | 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>
* Put back devstat support that was lost during GEOM transition. Initially,sobomax2007-11-071-0/+12
| | | | | | | | | | | I've tried to move md(4) to use geom_disk class, like real disks do, but this requires major rework of some of the existing features such as configuration dumping for example. Therefore just putting devstat support directly into md(4) seems to be optimal solution. Now you can see md(4) stats in `systat -vm' again. MFC after: 2 weeks
* Rename the kthread_xxx (e.g. kthread_create()) callsjulian2007-10-201-2/+2
| | | | | | | | | | | 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.
* Commit 14/14 of sched_lock decomposition.jeff2007-06-051-2/+2
| | | | | | | | | | | - Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
* Revert UF_OPENING workaround for CURRENT.kib2007-05-311-1/+1
| | | | | | | | | 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)
* Resolve two deadlocks that could be caused by busy md device backedkib2006-12-141-0/+9
| | | | | | | | | | by vnode. Allow for md thread and the thread that owns lock on vnode backing the md device to do the write even when runningbufspace is exhausted. Tested by: Peter Holm Reviewed by: tegge MFC after: 2 weeks
* Style nits.pjd2006-11-011-2/+2
|
* Fix md(4) panic which occurs when I/O request different thanpjd2006-11-011-10/+53
| | | | | | | | | | BIO_READ/BIO_WRITE is sent to vnode-backed provider (BIO_DELETE or BIO_FLUSH). Reported by: ceri Add support for BIO_FLUSH to vnode-backed md(4) devices based on VOP_FSYNC().
* - Conditionally acquire Giant in mdstart_vnode(), mdcreate_vnode(), andjhb2006-03-281-29/+23
| | | | | | | | mddestroy() only if the file is from a non-MPSAFE VFS. - No longer unconditionally hold Giant in the md kthread for vnode-backed kthreads. - Improve the handling of the thread exit race when destroying an md device.
* Teach md(4) and mdconfig(8) how to understand XML. Right now there won't bewkoszek2006-03-261-0/+62
| | | | | | | | | | | | a problem with listing large number of md(4) devices. Either 'list' or 'query' mode uses XML. Additionally, new functionality was introduced. It's possible to pass multiple devices to -u: # ./mdconfig -l -u md0,md1 Approved by: cognet (mentor)
* make sure that the start and end preloaded MFS markers areluigi2006-01-311-4/+14
| | | | | in contiguous strings, and that the compiler does not optimize them away because it thinks they are unused.
* Call NDFREE() only when vn_open() succeeded.pjd2006-01-271-1/+1
| | | | MFC after: 3 days
* o Fix typos in the comments.maxim2005-12-281-2/+2
| | | | Submitted by: Wojciech A. Koszek
* Normalize a significant number of kernel malloc type names:rwatson2005-10-311-2/+2
| | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names.
* Make sure that the worker thread knows the type early enough tophk2005-10-061-6/+5
| | | | | | grab Giant for vnode backing. Found by: pho & tegge
* Fix configuration locking in MD.phk2005-09-191-116/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove md_mtx. Remove GIANT from the mdctl device driver and avoid DROP_GIANT, PICKUP_GIANT and geom events since we can call into GEOM directly now. Pick up Giant around vn_close(). Apply an exclusive sx around mdctls ioctl and preloading to protect lists etc.. Don't initialize our lock (md_mtx or md_sx) from a SYSINIT when there is a perfectly good pair of _fini/_init functions to do it from. Prune any final fractional sector from the mediasize to keep GEOM happy. Cleanups: Unify MDIOVERSION check in (x)mdctlioctl() Add pointer to start() routine to softc to eliminate a switch{} Inline guts of mddetach(). Always pass error pointer to mdnew(), simplify implementation.
* Do not destroy the queue mutex until the thread is done with it.phk2005-09-111-1/+1
|
* - Add md_mtx lock to protect ID number and list of devices.pjd2005-08-311-25/+37
| | | | | | | | | | - Always check mdnew() return value, as even in !autounit case kthread_create() can fail. Those two changes fix serval panics provked by simple stress test. Tested by: Kris The BugMagnet MFC after: 3 days
* Ensure that file flags such as schg, sappnd (and others) are honoredcsjp2005-08-171-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | by md(4). Before this change, it was possible to by-pass these flags by creating memory disks which used a file as a backing store and writing to the device. This was discussed by the security team, and although this is problematic, it was decided that it was not critical as we never guarantee that root will be restricted. This change implements the following behavior changes: -If the user specifies the readonly flag, unset write operations before opening the file. If the FWRITE mask is unset, the device will be created with the MD_READONLY mask set. (readonly) -Add a check in g_md_access which checks to see if the MD_READONLY mask is set, if so return EROFS -Do not gracefully downgrade access modes without telling the user. Instead make the user specify their intentions for the device (assuming the file is read only). This seems like the more correct way to handle things. This is a RELENG_6 candidate. PR: kern/84635 Reviewed by: phk
* Request a CPU private mapping from sf_buf_alloc(). If the swap-backedalc2005-02-131-1/+6
| | | | | | | | | memory disk is larger than the number of available sf_bufs, this improves performance on SMPs by eliminating interprocessor TLB shootdowns. For example, with 6656 sf_bufs, the default on my test machine, and a 256MB swap-backed memory disk, I see the command "dd if=/dev/md0 of=/dev/null bs=64k" achieve ~489MB/sec with the default, shared mappings, and ~587MB/sec with CPU private mappings.
* Use MAXMINORphk2005-01-291-1/+1
|
* - Don't destroy UMA zone on error in mdcreate_malloc(), because we need itpjd2005-01-221-4/+1
| | | | | | | | | in mddestroy() to properly free already allocated memory. This fixes a panic when we want to create too big memory backed device with preallocate memory (-o reserve). - Remove redundant { }. MFC after: 1 week
* Add a couple of mtx_asserts() to try to narrow down the window onphk2005-01-221-0/+2
| | | | a bug repeatedly reported.
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-2/+2
|
* Add needed synchronization to the error handling code that was introducedalc2005-01-051-0/+6
| | | | | | in revision 1.141. Lock assertion failures reported by: Kris Kennaway
* Stop explicitly touching td_base_pri outside of the scheduler and simplyjhb2004-12-301-1/+4
| | | | | set a thread's priority via sched_prio() when that is the desired action. The schedulers will start managing td_base_pri internally shortly.
* Rewrite piece of code which I committed some time ago that allows topjd2004-12-271-10/+8
| | | | | | | | | show file name for 'mdconfig -l -u <x>' command. This allows to preserve API/ABI compatibility with version 0 (that's why I changed version number back to 0) and will allow to merge this change to RELENG_5. MFC after: 5 days
* Fix the MDIOCDETACH ioctl() for md(4). Now that the md_file field inmarcel2004-11-131-1/+1
| | | | | the mdio structure is an array and not a pointer, we cannot test for it to be NULL. It never is. Instead, test for md_file[0] to be '\0'.
* Be consistent and use 'if (error != 0)' instead of 'if (error)' everywhere.pjd2004-11-061-5/+5
|
* For file backed md(4) devices output their source file viapjd2004-11-061-4/+13
| | | | | 'mdconfig -l -u <unit>'. Bump version number, as this change breaks ABI/API.
* Don't explicitly call g_waitidle(), it happens automagically now.phk2004-10-231-2/+0
|
* Account for failure in vm_pager_allocate() or vm_pager_get_pages() ingreen2004-10-121-1/+19
| | | | | | | | | md(8). The former is generally not going to fail, but the latter can fail when the underlying swap device returns an error. There are still plenty of other places where vm_pager_get_pages() failing will lead directly to crashes, so it's a good idea to put your swap on RAID if you care enough to put any of your disks on RAID....
* Actually this order (unlock, wakeup) in this case is race-safe and canpjd2004-09-181-1/+1
| | | | | | save us 2 context switches. Explained by: njl
* - Make md(4) 64-bit clean.pjd2004-09-161-161/+89
| | | | | | | | | After this change it should be possible to use very big md(4) devices. - Clean up and simplify the code a bit. - Use humanize_number(3) to print size of md(4) devices. - Add 't' suffix which stands for terabyte. - Make '-S' to really work with all types of devices. - Other minor changes.
* There is no need to keep 'npage' value inside our softc structure,pjd2004-09-161-8/+8
| | | | | | | it is only used in one function. While doing so, change its type to vm_ooffset_t. We are still limited for swap-backed devices to 16TB on 32-bit architectures where PAGE_SIZE is 4096 bytes.
* - Do not use bio_pblkno as it is going away anyway.pjd2004-09-161-13/+14
| | | | - Prefer bio_length than bio_bcount.
* First wakeup, then unlock.pjd2004-09-161-2/+1
|
* Type 'int' is too small for 'i' and 'lastp' variables. Use proper type,pjd2004-09-161-2/+2
| | | | which is vm_pindex_t (unsigned 64bit on i386).
* Deallocate VM object on failure.pjd2004-09-141-0/+2
|
* One more missing NDFREE(9).pjd2004-09-141-0/+1
|
* - Don't forget about NDFREE() in case of vn_open() failure.pjd2004-09-141-2/+4
| | | | - Don't forget about vn_close() in case of failure.
* Fix UMA zone leak.pjd2004-09-141-0/+1
|
* Use bioq_takefirst()phk2004-09-071-3/+1
|
* Don't g_waitidle() when initializing a preloaded md. This fixes acperciva2004-08-301-1/+2
| | | | | | | | deadlock which otherwise occurs during the boot process. Reported by: kensmith MFC after: 3 days (assuming that re@ approves)
* When creating a new md, wait for geom's event queue to become emptycperciva2004-08-221-0/+1
| | | | | | | | | | before returning. Device nodes are created via the "taste" mechanism, so this is necessary in order to make sure that devfs entries are created before mdconfig(8) returns. This may be a MFC candidate for 5.3. Suggested by: phk
* Tag all geom classes in the tree with a version number.phk2004-08-081-0/+1
|
OpenPOWER on IntegriCloud