Commit Graph

104 Commits

Author SHA1 Message Date
pjd
5326cfc8d7 Allow to use ':' in d_ident, which is quite handy character. 2007-05-05 18:09:17 +00:00
pjd
9409284b5b Because there are many strange hardware out there, allow to use only
[a-zA-Z0-9-_@#%.] characters in d_ident field.
2007-05-05 17:47:20 +00:00
pjd
4e8b8cd34e - Extend disk structure to allow to store disk's serial number, which can be
retrieved via GEOM::ident attribute.
- Bump disk(9) ABI version.

OK'ed by:	phk
2007-05-05 17:12:15 +00:00
n_hibma
3d196e1a91 Reduce the noise when plugging in (USB) mass storage devices, like a 4 port
flash card reader.
Also remove an 'Opened da0 -> <random number>' which is not needed on a daily
basis (available through bootverbose).

Reviewed by:	phk, ken
MFC after:	1 week
2007-02-21 07:45:02 +00:00
pjd
67c00d09c1 Add a new disk flag - DISKFLAG_CANFLUSHCACHE, which indicates that the disk
can handle BIO_FLUSH requests.

Sponsored by:	home.pl
2006-10-31 21:12:43 +00:00
marcel
c168f9530e Add g_wither_provider() to abstract the details of destroying a
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.
2006-04-10 03:55:13 +00:00
jdp
536960dbba Fix a bug that caused some /dev entries to continue to exist after
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
2005-11-18 02:43:49 +00:00
tegge
dbcc5e2770 Move some devstat collection to below where large IO operations are chopped
up.  This make iostat report operations passed down to the device driver
instead of operations passed down to GEOM disk.  The transfer size limit
imposed by the device driver is no longer hidden, improving the correlation
between iostat output and device driver workload.
2005-09-30 17:32:08 +00:00
phk
05ad105753 After rejecting the bio request early, return instead of panicing.
Found by:	Coverity (ID#450)
2005-03-18 07:01:31 +00:00
phk
67e4aa7d33 Make various random things static 2005-02-10 12:10:35 +00:00
phk
1a5ece93a1 When dumping to a unpartitioned disk, make sure to chop the
length of the dump area accordingly.

Run into by:	scottl
2005-01-29 16:49:43 +00:00
phk
6d1e88efa3 CAM will sometimes remove a disk again even before it finished being
initialized.  We already cancel the pending events but we need to not
dereference the geom pointer which never got set different from NULL.
2005-01-14 21:05:35 +00:00
phk
35b3c9fdfb Pass the file->flags down to geom ioctl handlers.
Reject certain ioctls if write permission is not indicated.

Bump geom API version.

Reported by:	Ruben de Groot <mail25@bzerk.org>
2004-12-12 10:09:05 +00:00
phk
d8d2b01380 Tag all geom classes in the tree with a version number. 2004-08-08 07:57:53 +00:00
phk
8a11f1b4a6 Use default method initialization on geoms. 2004-08-08 06:49:07 +00:00
phk
474032642a Fix regression in last commit. 2004-06-29 08:33:58 +00:00
phk
949e8d87fe Make sure to kill the devstat entry for disappearing disks.
PR:	68074
Submitted by:	Hendrik Scholz <hscholz@raisdorf.net>
2004-06-27 20:53:20 +00:00
phk
623c8fe8d0 Zap a redundant NULL 2004-05-30 18:04:06 +00:00
sos
492da9f785 Dont try to finish devstat's if the disk pointer is NULL, this can happen
when a disk has been destroyed but still has outstanding bio's.

Reviewed by:	phk
2004-05-11 13:17:40 +00:00
phk
49c92e5706 Change the disk(9) API in order to make device removal more robust.
Previously the "struct disk" were owned by the device driver and this
gave us problems when the device disappared and the users of that device
were not immediately disappearing.

Now the struct disk is allocate with a new call, disk_alloc() and owned
by geom_disk and just abandonned by the device driver when disk_create()
is called.

Unfortunately, this results in a ton of "s/\./->/" changes to device
drivers.

Since I'm doing the sweep anyway, a couple of other API improvements
have been carried out at the same time:

The Giant awareness flag has been flipped from DISKFLAG_NOGIANT to
DISKFLAG_NEEDSGIANT

A version number have been added to disk_create() so that we can detect,
report and ignore binary drivers with old ABI in the future.

Manual page update to follow shortly.
2004-02-18 21:36:53 +00:00
phk
853b4bc47c don't call sbuf_clear() right after sbuf_new(), it is not necessary. 2004-02-10 10:54:19 +00:00
pjd
9ebcd20d35 Allow decreasing access count even if there is no disk anymore.
This will allow closing disks that were removed while opened.

Approved by:	phk, scottl (mentor)
2004-02-06 23:10:49 +00:00
phk
e65ee01a8f Remove no longer necessary debug printfs 2004-01-23 10:56:16 +00:00
truckman
87a37b565f Correct usage of mtx_init() API. This is not a functional change since
the code happened to work because MTX_DEF and NULL are both defined as 0.

Reviewed by:	phk
2003-12-07 23:20:53 +00:00
phk
b3eb57c5d4 Retire bio_blkno entirely.
bio_offset is the field drivers should use.
bio_pblkno remains as a convenient place to store the number of
the device drivers.
2003-10-18 17:53:34 +00:00
phk
9e3e052c16 Return ENODEV in case the driver has no dump routine. 2003-09-29 07:44:23 +00:00
phk
ac7d8771f0 Be more careful in dumpconf: softc may be NULL for departing devices.
Allow drivers to initialize the d_devstat if they want magic params.
2003-09-23 07:53:59 +00:00
phk
38290a3baa Simplify the ioctl handling in GEOM.
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.
2003-09-01 20:45:32 +00:00
phk
9958b55dce Try to close the race between disk_destroy() and a subsequent disk_create(). 2003-09-01 12:03:13 +00:00
obrien
40ee2bd5c8 Use __FBSDID().
Approved by:	phk
2003-06-11 06:49:16 +00:00
phk
3325608f8f Introduce a init and fini member functions on a class.
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
2003-05-31 18:13:07 +00:00
phk
e2298826ec Remove the G_CLASS_INITIALIZER, we do not need it anymore. 2003-05-31 16:59:27 +00:00
phk
f716dc5d96 Don't do silly thing if the disk_create() event gets canceled.
Approved by:	re/scottl
2003-05-25 16:57:10 +00:00
phk
8539560193 Return ENXIO if the softc pointer is NULL, in all likelyhood the
disk is in the process of disappearing.

Approved by:	re/rwats*
2003-05-21 18:52:29 +00:00
phk
489ad07179 When a disk disappears, destroy the class from the event thread
to avoid race condtion.

Approved by:	re/rwatson
2003-05-12 20:15:28 +00:00
phk
e39be99d04 Use g_wither_geom() for cleanup. 2003-05-02 06:22:32 +00:00
phk
ffd04bfbdd Introduce a g_waitfor_event() function which posts an event and waits for
it to be run (or cancelled) and use this instead of home-rolled versions.
2003-04-23 21:28:27 +00:00
phk
3bbfe9f43b Rename g_call_me() to g_post_event(), and give it a flag
argument to determine if we can M_WAITOK in malloc.
2003-04-23 20:46:12 +00:00
phk
cbe207a30e Remove all references to BIO_SETATTR. We will not be using it. 2003-04-03 19:19:36 +00:00
phk
39cbb43bab Add handling for cancelled events in the g_call_me() methods. 2003-04-02 21:10:04 +00:00
phk
cedf04c475 Change events to have an array of "void *" references, and give the
event posting functions varargs to fill these.

Attribute g_call_me() to appropriate g_geom's where necessary.

Add a flag argument to g_call_me() methods which will be used to signal
cancellation of events in the future.

This commit should be a no-op.
2003-04-02 20:41:18 +00:00
phk
af778aa48a Include <geom/geom_disk.h> not <sys/disk.h> 2003-04-01 18:57:14 +00:00
phk
5447a01760 Check return value of g_call_me() 2003-03-27 14:32:52 +00:00
phk
639a37daa0 Premptively change initializations of struct g_class to use C99
sparse struct initializations before we extend the struct with
new OAM related member functions.
2003-03-24 19:30:15 +00:00
phk
9dd05c47c0 Mitigate deadlock situation pending a more complete solution. 2003-03-21 22:05:33 +00:00
phk
e059b79437 Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.
2003-03-18 08:45:25 +00:00
phk
0e540e1b29 Use devstat_{start,end}_transaction_bio().
Remember to set bio_resid correctly first.
2003-03-15 10:49:26 +00:00
phk
b454fc547a Allocate devstat structure with devstat_new_entry(). 2003-03-08 20:00:11 +00:00
phk
e01fc931cf Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
phk
e8ab4a65e4 NO_GEOM cleanup:
Retire the "dev_t" centric version of the disk mini-layer.
Remove now unneeded linkage field in dev_t and struct disk.
2003-02-28 10:02:02 +00:00