summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_subr.c
Commit message (Collapse)AuthorAgeFilesLines
* In g_handleattr(), set bp->bio_completed also for the casemarcel2009-02-031-1/+2
| | | | | where len is 0. Otherwise g_getattr() will never succeed when it is handled by g_handleattr_str().
* Constify val in g_handleattr() and str in g_handleattr_str().marcel2009-02-011-2/+2
| | | | This allows passing string constants to g_handleattr_str().
* - Add missing word in comment.lulf2008-12-081-1/+1
|
* Add sbuf_new_auto as a shortcut for the very common case of creating ades2008-08-091-2/+2
| | | | | | | completely dynamic sbuf. Obtained from: Varnish MFC after: 2 weeks
* - Assert that we don't send new provider event for a provider which haspjd2008-05-181-1/+3
| | | | | G_PF_WITHER flag set. - Fix typo in assertion condition (sorry, but I forgot who report that).
* Play nice with DDB pager.pjd2008-05-181-4/+18
| | | | Educated by: jhb's BSDCan presentation
* When retasting, wither any existing GEOMs of the same class. Thismarcel2008-03-281-1/+7
| | | | | | | | | | | allows the class to create a different GEOM for the same provider as well as avoid that we end up with multiple GEOMs of the same class with the same name. For example, when a disk contains a PC98 partition table but only MBR is supported, then the partition table can be treated as a MBR. If support for PC98 is later loaded as a module, the MBR scheme is pre-empted for the PC98 scheme as expected.
* Add g_retaste(), which given a class will present all non-open providersmarcel2008-03-231-0/+60
| | | | | | | | | | to it for tasting. This is useful when the class, through means outside the scope of GEOM, can claim providers previously unclaimed. The g_retaste() function posts an event which is handled by the g_retaste_event(). Event suggested by: phk
* - Implement helper g_handleattr_str() function for string attributespjd2007-05-051-7/+22
| | | | | | | handling. - Extend g_handleattr() to treat attribute as string when len=0. OK'ed by: phk
* Add 'show geom [addr]' ddb(4) command, which prints entire GEOM topology ifpjd2006-09-151-1/+212
| | | | | | | no additional argument is given or details about the given GEOM object (class, geom, provider or consumer). Approved by: phk
* Add g_wither_provider() to abstract the details of destroying amarcel2006-04-101-0/+12
| | | | | | particular provider. Use this function where g_orphan_provider() is being called so that the flags are updated correctly and g_orphan_provider() is called only when allowed.
* Fix a bug that caused some /dev entries to continue to exist afterjdp2005-11-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | | the underlying drive had been hot-unplugged from the system. Here is a specific example. Filesystem code had opened /dev/da1s1e. Subsequently, the drive was hot-unplugged. This (correctly) caused all of the associated /dev/da1* entries to be deleted. When the filesystem later realized that the drive was gone it closed the device, reducing the write-access counts to 0 on the geom providers for da1s1e, da1s1, and da1. This caused geom to re-taste the providers, resulting in the devices being created again. When the drive was hot-plugged back in, it resulted in duplicate /dev entries for da1s1e, da1s1, and da1. This fix adds a new disk_gone() function which is called by CAM when a drive goes away. It orphans all of the providers associated with the drive, setting an error condition of ENXIO in each one. In addition, we prevent a re-taste on last close for writing if an error condition has been set in the provider. Sponsored by: Isilon Systems Reviewed by: phk MFC after: 1 week
* fix a "modify after free" bug which is practically impossible tophk2005-03-261-5/+8
| | | | | | experience. Found by: Coverity (id #540 #541)
* Add g_wither_geom_close() function.phk2004-10-291-0/+17
|
* Don't call g_waitidle(), it happens automagically now.phk2004-10-231-1/+0
|
* - Turn KASSERT()s into warning printf()'s in the g_class_load() routine.arr2004-10-221-10/+26
| | | | | | | This removes a panic that will occur if you build with GENERIC and attempt to kldload a GEOM module that is already in the kernel. Reviewed by: phk
* When loading GEOM modules, we expect the actual load process to be donegreen2004-10-121-1/+9
| | | | | | | | | | | | | | | | by the time that kldload(8) returns. Satisfy that by making the GEOM module load event -- only when the kernel is !cold -- wait until the GEOM module init function has finished instead of returning immediately. This is the other half of fixing md(8) (actually, "mfs" in fstab(5)) that is similar to r1.128 of src/sys/dev/md/md.c. This bug would be why RAM disks would often fail on boot and the first call to mdconfig(8) would probably fail. pjd has ideas for not requiring kldload(8) to work synchronously for control devices that could make this obsolete. Silence on: -arch
* For removable devices without media we set a zero mediasize but a non-zerophk2004-09-051-0/+3
| | | | | | | | sectorsize in order to avoid a lot of checks around various divisions etc. Enforce the sectorsize being > 0 with a KASSERT on successful open. Fix scsi_cd.c to return 2k sectors when no media inserted.
* OK, now check geom class version numbers.phk2004-08-081-1/+1
|
* OOps, that check was a bit premature. Allow zero versions as well.phk2004-08-081-1/+1
|
* Give classes a version number and refuse to touch classes which are notphk2004-08-081-0/+14
| | | | | | | | understood. This makes room for additional binary compatibility in the future. Put fields in the class for the geom's methods and initialize the methods of a new geom from these fields. This saves some code in all classes.
* Only detach consumers which are attached when we wither stuff away.phk2004-07-091-1/+2
| | | | Pointed out by: pjd
* Make withering water tight.phk2004-07-081-25/+59
| | | | | | | | | When we orphan/wither a provider, an attached geom+consumer could end up being withered as a result and it may be in front of us in the normal object scanning order so we need to do multi-pass. On the other hand, there may be withering stuff we can't get rid off (yet), so we need to keep track of both the existence of withering stuff and if there is more we can do at this time.
* Fail normally rather than KASSERT if attempt to open a spoiled consumer.phk2004-07-081-5/+3
|
* Move "is consumer attached?" check before G_VALID_PROVIDER() check,pjd2004-03-181-1/+1
| | | | | | | because if consumer is not attached, its provider never will be valid, so we never reach this check. Approved by: phk
* Be more insistent on destroying geoms at unload time. Still not perfect,phk2004-03-111-2/+8
| | | | | | | | but it will do (better) for now. KASSERT that to have providers a class must have an access method. Tag the new_provider event with the geom as well.
* Rearrange some of the GEOM debugging tools to be more structured.phk2004-03-101-57/+42
| | | | | | | | | | | | | | | | | | Retire g_sanity() and corresponding debugflag (0x8) Retire g_{stall,release}_events(). Under #ifdef DIAGNOSTIC: Make g_valid_obj() an official function and have it return an an non-zero integer which indicates the kind of object when found. Implement G_VALID_{CLASS,GEOM,CONSUMER,PROVIDER}() macros based on g_valid_obj(). Sprinkle calls to these macros liberally over the infrastructure. Always check that we do not free a live object.
* Don't panic on providers already withered when we wither a geom.phk2004-03-071-1/+2
|
* Add a KASSERT which checks that a class never fails a closing ->access()phk2004-02-141-0/+3
| | | | call.
* Remove the absolute count g_access_abs() function since experience hasphk2004-02-121-21/+3
| | | | | | | | | | | | shown that it is not useful. Rename the relative count g_access_rel() function to g_access(), only the name has changed. Change all g_access_rel() calls in our CVS tree to call g_access() instead. Add an #ifndef BURN_BRIDGES #define of g_access_rel() for source code compatibility.
* Allow a GEOM class to unload if it has no geoms or a method function tophk2004-02-021-1/+6
| | | | | | get rid of them. Prodded by: pjd
* - Use proper names in KASSERTs.pjd2004-02-021-6/+6
| | | | | | - Typos. Approved by: phk, scottl (mentor)
* Add KASSERTS.phk2004-01-231-0/+11
| | | | Submitted by: Pawel Jakub Dawidek <nick@garage.freebsd.pl>
* Plug an insignificant memoryleak.phk2004-01-231-0/+3
| | | | Submitted by: Pawel Jakub Dawidek <nick@garage.freebsd.pl>
* Print the correct pointer in a KASSERT.phk2004-01-111-1/+1
| | | | Submitted by: Pawel Jakub Dawidek <nick@garage.freebsd.pl>
* KASSERT against no-op access requests.phk2004-01-091-0/+1
| | | | Submitted by: Pawel Jakub Dawidek <nick@garage.freebsd.pl>
* Call class->init() an class->fini() while the class is hooked up,phk2003-11-181-3/+5
| | | | | | | | | | | rather than right before and right after. This allows these routines to manipulate the mesh. KASSERT that nobody creates a geom on an alien class. Assert topology in g_valid_obj(). Approved by: re@
* This is a crude bandaid for 5.2 to protect against providers which disappearphk2003-11-151-0/+38
| | | | | while being tasted. I can moderately easy trigger this with atapi-cd, but I do not fully understand the circumstances.
* Introduce a per provider wither flagphk2003-10-061-0/+2
|
* Don't panic over the fact that unloading failed if we already knew that.phk2003-08-221-3/+5
|
* Use __FBSDID().obrien2003-06-111-2/+2
| | | | Approved by: phk
* Drop a memory-corruption debugging test-tool.phk2003-06-071-13/+0
|
* Add missing va_end() calls.phk2003-06-071-2/+4
| | | | Noticed by: tmm
* Introduce g_provider_by_name() function, and use it.phk2003-06-041-0/+17
|
* Add a KASSERT to prevent the same GEOM class from being processed loadedphk2003-06-041-0/+6
| | | | | | twice. Enforce that classes should have different names while we are here.
* constify g_sanity()phk2003-06-011-1/+1
|
* Introduce a init and fini member functions on a class.phk2003-05-311-22/+100
| | | | | | | | | Use ->init() and ->fini() to handle the mutex in geom_disk.c Remove the g_add_class() function and replace it with a standardized g_modevent() function. This adds the basic infrastructure for loading/unloading GEOM classes
* Back out all the stuff that didn't belong in the last commit.phk2003-05-021-9/+12
|
* Use g_slice_spoiled() rather than g_std_spoiled().phk2003-05-021-12/+9
| | | | Remember to free the buffer we got from g_read_data().
* Rework the "withering" mechanism:phk2003-05-021-17/+46
| | | | Introduce g_wither_geom() to do the work in one single place.
OpenPOWER on IntegriCloud