summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement the concept of the unmapped VMIO buffers, i.e. buffers whichkib2013-03-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | do not map the b_pages pages into buffer_map KVA. The use of the unmapped buffers eliminate the need to perform TLB shootdown for mapping on the buffer creation and reuse, greatly reducing the amount of IPIs for shootdown on big-SMP machines and eliminating up to 25-30% of the system time on i/o intensive workloads. The unmapped buffer should be explicitely requested by the GB_UNMAPPED flag by the consumer. For unmapped buffer, no KVA reservation is performed at all. The consumer might request unmapped buffer which does have a KVA reserve, to manually map it without recursing into buffer cache and blocking, with the GB_KVAALLOC flag. When the mapped buffer is requested and unmapped buffer already exists, the cache performs an upgrade, possibly reusing the KVA reservation. Unmapped buffer is translated into unmapped bio in g_vfs_strategy(). Unmapped bio carry a pointer to the vm_page_t array, offset and length instead of the data pointer. The provider which processes the bio should explicitely specify a readiness to accept unmapped bio, otherwise g_down geom thread performs the transient upgrade of the bio request by mapping the pages into the new bio_transient_map KVA submap. The bio_transient_map submap claims up to 10% of the buffer map, and the total buffer_map + bio_transient_map KVA usage stays the same. Still, it could be manually tuned by kern.bio_transient_maxcnt tunable, in the units of the transient mappings. Eventually, the bio_transient_map could be removed after all geom classes and drivers can accept unmapped i/o requests. Unmapped support can be turned off by the vfs.unmapped_buf_allowed tunable, disabling which makes the buffer (or cluster) creation requests to ignore GB_UNMAPPED and GB_KVAALLOC flags. Unmapped buffers are only enabled by default on the architectures where pmap_copy_page() was implemented and tested. In the rework, filesystem metadata is not the subject to maxbufspace limit anymore. Since the metadata buffers are always mapped, the buffers still have to fit into the buffer map, which provides a reasonable (but practically unreachable) upper bound on it. The non-metadata buffer allocations, both mapped and unmapped, is accounted against maxbufspace, as before. Effectively, this means that the maxbufspace is forced on mapped and unmapped buffers separately. The pre-patch bufspace limiting code did not worked, because buffer_map fragmentation does not allow the limit to be reached. By Jeff Roberson request, the getnewbuf() function was split into smaller single-purpose functions. Sponsored by: The FreeBSD Foundation Discussed with: jeff (previous version) Tested by: pho, scottl (previous version), jhb, bf MFC after: 2 weeks
* - Don't pass geom and provider names as format strings.jh2012-11-201-2/+4
| | | | | | | - Add __printflike() attributes. - Remove an extra argument for the g_new_geomf() call in swapongeom_ev(). Reviewed by: pjd
* Remove unneeded G_PF_CANDELETE flag.ed2012-08-281-1/+0
| | | | | This flag is only used by GEOM so it can be propagated to the character device's SI_CANDELETE. Unfortunately, SI_CANDELETE seems to do nothing.
* Implement media change notification for DA and CD removable media devices.mav2012-07-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It includes three parts: 1) Modifications to CAM to detect media media changes and report them to disk(9) layer. For modern SATA (and potentially UAS) devices it utilizes Asynchronous Notification mechanism to receive events from hardware. Active polling with TEST UNIT READY commands with 3 seconds period is used for incapable hardware. After that both CD and DA drivers work the same way, detecting two conditions: "NOT READY: Medium not present" after medium was detected previously, and "UNIT ATTENTION: Not ready to ready change, medium may have changed". First one reported to disk(9) as media removal, second as media insert/change. To reliably receive second event new AC_UNIT_ATTENTION async added to make UAs broadcasted to all periphs by generic error handling code in cam_periph_error(). 2) Modifications to GEOM core to handle media remove and change events. Media removal handled by spoiling all consumers attached to the provider. Media change event also schedules provider retaste after spoiling to probe new media. New flag G_CF_ORPHAN was added to consumers to reflect that consumer is in process of destruction. It allows retaste to create new geom instance of the same class, while previous one is still dying. 3) Modifications to some GEOM classes: DEV -- to report media change events to devd; VFS -- to handle spoiling same as orphan to prevent accessing replaced media. PART class already handles spoiling alike to orphan. Reviewed by: silence on geom@ and scsi@ Tested by: avg Sponsored by: iXsystems, Inc. / PC-BSD MFC after: 2 months
* Add back spare fields consumed in r237545. It seems that these should onlyken2012-07-171-0/+2
| | | | | | | be consumed to maintain backward compatibility in stable, but should not be consumed in head. Submitted by: trasz, attilio (indirectly)
* Add back spare fields reused in r238213. According to Attilio, the ruletrasz2012-07-161-0/+2
| | | | is to use reuse spares only when MFC-ing, not in CURRENT.
* Add a new GEOM method, resize(), which is called after provider size changes.trasz2012-07-071-2/+4
| | | | | | | | Add a new routine, g_resize_provider(), to use to notify GEOM about provider change. Reviewed by: mav Sponsored by: FreeBSD Foundation
* Consume spare fields for the providergone pointers added to the g_class andken2012-06-251-4/+2
| | | | | | | | g_geom structures in change 237518. The original change would have broken the ABI. Suggested by: ae MFC after: 4 days
* Fix a bug which causes a panic in daopen(). The panic is caused byken2012-06-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a da(4) instance going away while GEOM is still probing it. In this case, the GEOM disk class instance has been created by disk_create(), and the taste of the disk is queued in the GEOM event queue. While that event is queued, the da(4) instance goes away. When the open call comes into the da(4) driver, it dereferences the freed (but non-NULL) peripheral pointer provided by GEOM, which results in a panic. The solution is to add a callback to the GEOM disk code that is called when all of its resources are cleaned up. This is implemented inside GEOM by adding an optional callback that is called when all consumers have detached from a provider, and the provider is about to be deleted. scsi_cd.c, scsi_da.c: In the register routine for the cd(4) and da(4) routines, acquire a reference to the CAM peripheral instance just before we call disk_create(). Use the new GEOM disk d_gone() callback to register a callback (dadiskgonecb()/cddiskgonecb()) that decrements the peripheral reference count once GEOM has finished cleaning up its resources. In the cd(4) driver, clean up open and close behavior slightly. GEOM makes sure we only get one open() and one close call, so there is no need to set an open flag and decrement the reference count if we are not the first open. In the cd(4) driver, use cam_periph_release_locked() in a couple of error scenarios to avoid extra mutex calls. geom.h: Add a new, optional, providergone callback that is called when a provider is about to be deleted. geom_disk.h: Add a new d_gone() callback to the GEOM disk interface. Bump the DISK_VERSION to version 2. This probably should have been done after a couple of previous changes, especially the addition of the d_getattr() callback. geom_disk.c: Add a providergone callback for the disk class, g_disk_providergone(), that calls the user's d_gone() callback if it exists. Bump the DISK_VERSION to 2. geom_subr.c: In g_destroy_provider(), call the providergone callback if it has been provided. In g_new_geomf(), propagate the class's providergone callback to the new geom instance. blkfront.c: Callers of disk_create() are supposed to pass in DISK_VERSION, not an explicit disk API version number. Update the blkfront driver to do that. disk.9: Update the disk(9) man page to include information on the new d_gone() callback, as well as the previously added d_getattr() callback, d_descr field, and HBA PCI ID fields. MFC after: 5 days
* Add some spare fields to the g_class and g_geom structures needed to implementpjd2011-07-171-0/+5
| | | | direct I/O handling and provider's property changes handling.
* Remove include of sys/sbuf.h from geom/geom.h.ae2011-07-111-1/+0
| | | | | | | sbuf support is not always required for geom/geom.h users, and no need to depend from it. PR: kern/158398
* Plumb device physical path reporting from CAM devices, through GEOM andgibbs2011-06-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DEVFS, and make it accessible via the diskinfo utility. Extend GEOM's generic attribute query mechanism into generic disk consumers. sys/geom/geom_disk.c: sys/geom/geom_disk.h: sys/cam/scsi/scsi_da.c: sys/cam/ata/ata_da.c: - Allow disk providers to implement a new method which can override the default BIO_GETATTR response, d_getattr(struct bio *). This function returns -1 if not handled, otherwise it returns 0 or an errno to be passed to g_io_deliver(). sys/cam/scsi/scsi_da.c: sys/cam/ata/ata_da.c: - Don't copy the serial number to dp->d_ident anymore, as the CAM XPT is now responsible for returning this information via d_getattr()->(a)dagetattr()->xpt_getatr(). sys/geom/geom_dev.c: - Implement a new ioctl, DIOCGPHYSPATH, which returns the GEOM attribute "GEOM::physpath", if possible. If the attribute request returns a zero-length string, ENOENT is returned. usr.sbin/diskinfo/diskinfo.c: - If the DIOCGPHYSPATH ioctl is successful, report physical path data when diskinfo is executed with the '-v' option. Submitted by: will Reviewed by: gibbs Sponsored by: Spectra Logic Corporation Add generic attribute change notification support to GEOM. sys/sys/geom/geom.h: Add a new attrchanged method field to both g_class and g_geom. sys/sys/geom/geom.h: sys/geom/geom_event.c: - Provide the g_attr_changed() function that providers can use to advertise attribute changes. - Perform delivery of attribute change notifications from a thread context via the standard GEOM event mechanism. sys/geom/geom_subr.c: Inherit the attrchanged method from class to geom (class instance). sys/geom/geom_disk.c: Provide disk_attr_changed() to provide g_attr_changed() access to consumers of the disk API. sys/cam/scsi/scsi_pass.c: sys/cam/scsi/scsi_da.c: sys/geom/geom_dev.c: sys/geom/geom_disk.c: Use attribute changed events to track updates to physical path information. sys/cam/scsi/scsi_da.c: Add AC_ADVINFO_CHANGED to the registered asynchronous CAM events for this driver. When this event occurs, and the updated buffer type references our physical path attribute, emit a GEOM attribute changed event via the disk_attr_changed() API. sys/cam/scsi/scsi_pass.c: Add AC_ADVINFO_CHANGED to the registered asynchronous CAM events for this driver. When this event occurs, update the physical patch devfs alias for this pass instance. Submitted by: gibbs Sponsored by: Spectra Logic Corporation
* Implement relaxed comparision for hardcoded provider names to make itmav2011-04-271-0/+1
| | | | | ignore adX/adaY difference in both directions to simplify migration to the CAM-based ATA or back.
* MFgraid/head r218212, r218257:mav2011-03-241-0/+6
| | | | | | | | | | | Introduce new type of BIO_GETATTR -- GEOM::setstate, used to inform lower GEOM about state of it's providers from the point of upper layers. Make geom_disk use led(4) subsystem to illuminate states in such fashion: FAILED - "1" (on), REBUILD - "f5" (slow blink), RESYNC - "f1" (fast blink), ACTIVE - "0" (off). LED name should be set for each disk via kern.geom.disk.%s.led sysctl. Later disk API could be extended to allow disk driver to report this info in custom way via it's own facilities.
* MFgraid/head r217827:mav2011-03-241-0/+2
| | | | | | | Change BIO_GETATTR("GEOM::kerneldump") API to make set_dumper() called by consumer (geom_dev) instead of provider (geom_disk). This allows any geom insert it's code into the dump call chain, implementing more sophisticated functionality then just disk partitioning.
* Fix deadlock between GEOM class unloading and withering. Withering can'tjh2010-05-051-0/+3
| | | | | | | | | proceed while g_unload_class() blocks the event thread. Fix this by not running g_unload_class() as a GEOM event and dropping the topology lock when withering needs to proceed. PR: kern/139847 Silence on: freebsd-geom
* Make gjournal work with kernel compiled with "options DIAGNOSTIC".trasz2009-06-301-0/+1
| | | | | | | Previously, it would panic immediately. Reviewed by: pjd Approved by: re (kib)
* As discussed in the devsummit, introduce two fields in theluigi2009-06-111-0/+13
| | | | | | | struct bio to store classification information, and a hook for classifier functions that can be called by g_io_request(). This code is from Fabio Checconi as part of his GSOC work.
* Revert r190676,190677thompsa2009-04-101-2/+0
| | | | | | | The geom and CAM changes for root_hold are the wrong solution for USB design quirks. Requested by: scottl
* Add interleaving root hold tokens from the CAM probe to disk_create and geomthompsa2009-04-031-0/+2
| | | | | | | provider tasting. This is needed for disk attachments that happen after threads are running in the boot process. Tested by: rnoland
* Constify val in g_handleattr() and str in g_handleattr_str().marcel2009-02-011-2/+3
| | | | This allows passing string constants to g_handleattr_str().
* Add g_retaste(), which given a class will present all non-open providersmarcel2008-03-231-0/+1
| | | | | | | | | | 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 g_delete_data() similar to g_read_data() and g_write_data().pjd2007-05-051-0/+1
| | | | OK'ed by: phk
* - Implement helper g_handleattr_str() function for string attributespjd2007-05-051-0/+1
| | | | | | | handling. - Extend g_handleattr() to treat attribute as string when len=0. OK'ed by: phk
* Add a new I/O request - BIO_FLUSH, which basically tells providers below topjd2006-10-311-0/+1
| | | | | | | flush their caches. For now will mostly be used by disks to flush their write cache. Sponsored by: home.pl
* Add __printflike() to gctl_error().pjd2006-09-161-1/+1
| | | | | Approved by: phk MFC after: 1 week
* Add 'show geom [addr]' ddb(4) command, which prints entire GEOM topology ifpjd2006-09-151-1/+3
| | | | | | | no additional argument is given or details about the given GEOM object (class, geom, provider or consumer). Approved by: phk
* Only check if we're freeing a valid object if we hold the topology lock.pjd2006-07-121-4/+7
| | | | This prevents panic under heavy load with DIAGNOSTIC compiled in.
* Add g_duplicate_bio() function which does the same thing what g_clone_bio()pjd2006-06-051-0/+1
| | | | is doing, but g_duplicate_bio() allocates new bio with M_WAITOK flag.
* Add g_wither_provider() to abstract the details of destroying amarcel2006-04-101-0/+1
| | | | | | 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.
* Change gctl_set_param() to return an error instead of setting anmarcel2006-04-071-1/+2
| | | | | | | | | | | error on the request. Add a wrapper, gctl_set_param_err(), that sets the error on the request from the error returned by gctl_set_param() and update current callers of gctl_set_param() to call gctl_set_param_err() instead. This makes gctl_set_param() much more usable in situations where the caller knows better what to do with certain (apparent) error conditions and setting an error on the request is not one of the things that need to be done.
* Typo.phk2005-09-031-1/+1
|
* Implement g_topology_try_lock().pjd2004-12-211-0/+2
| | | | No objection from: phk
* Pass the file->flags down to geom ioctl handlers.phk2004-12-121-2/+3
| | | | | | | | Reject certain ioctls if write permission is not indicated. Bump geom API version. Reported by: Ruben de Groot <mail25@bzerk.org>
* Introduce g_waitidlelock() function which is simlar to g_waitidle(),pjd2004-11-091-0/+1
| | | | | | | but should be called with the topology lock held and returns with the topology lock held and empty event queue. Approved by: phk (sometime ago)
* Add g_wither_geom_close() function.phk2004-10-291-0/+1
|
* Move the prototype for g_waitidle() to a more visible place.phk2004-10-231-1/+0
|
* Introduce g_alloc_bio() as a waiting variant of g_new_bio().phk2004-08-271-0/+1
| | | | | | | Use in places where we can sleep and where we previously failed to check for a NULL pointer. MT5 candidate.
* Give classes a version number and refuse to touch classes which are notphk2004-08-081-0/+13
| | | | | | | | 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.
* Kill g_access_rel() already now before we send it down 5-stablephk2004-06-211-3/+0
|
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-1/+2
| | | | Bump __FreeBSD_version accordingly.
* Rearrange some of the GEOM debugging tools to be more structured.phk2004-03-101-8/+22
| | | | | | | | | | | | | | | | | | 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.
* Remove the absolute count g_access_abs() function since experience hasphk2004-02-121-2/+4
| | | | | | | | | | | | 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.
* Give both consumers and providers a {void *private, u_int index} whichphk2004-02-121-1/+8
| | | | the implementing class can use to hang internal info from.
* Added g_print_bio() function to print informations about given bio.pjd2004-02-111-0/+1
| | | | Approved by: phk, scottl (mentor)
* Added macro which will be used to assert, that the topology lock is not held.pjd2004-02-101-0/+6
| | | | Approved by: phk, scottl (mentor)
* KASSERT against multiple orphanings of providers.phk2003-12-071-0/+1
|
* Re-arrange and consolidate some random debugging stuffscottl2003-12-071-1/+0
|
* Introduce a per provider wither flagphk2003-10-061-0/+1
|
* Simplify the ioctl handling in GEOM.phk2003-09-011-16/+3
| | | | | | | | | | | | | | | This replaces the current ioctl processing with a direct call path from geom_dev() where the ioctl arrives (from SPECFS) to any directly connected GEOM class. The inverse of the above is no longer supported. This is the situation were you have one or more intervening GEOM classes, for instance a BSDlabel on top of a MBR or PC98. If you want to issue MBR or PC98 specific ioctls, you will need to issue them on a MBR or PC98 providers. This paves the way for inviting CD's, FD's and other special cases inside GEOM.
OpenPOWER on IntegriCloud