freebsd-skq/sys/geom/part
Alexander Motin 3631c6382f Implement media change notification for DA and CD removable media devices.
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
2012-07-29 11:51:48 +00:00
..
g_part_apm.c Add a partition type for nandfs to the apm, bsd, gpt and vtoc8 schemes. 2012-05-25 20:33:34 +00:00
g_part_bsd.c Add a partition type for nandfs to the apm, bsd, gpt and vtoc8 schemes. 2012-05-25 20:33:34 +00:00
g_part_ebr.c Add additional check to EBR probe and create methods: 2012-02-15 10:33:29 +00:00
g_part_gpt.c Always reconstruct partition entries in the PMBR when Boot Camp is 2012-06-14 11:17:54 +00:00
g_part_if.m Reimplemented "gpart destroy -F". Now it does all work in kernel. 2010-10-25 16:23:35 +00:00
g_part_ldm.c VMDB offset should be greater than logical volume size only for MBR. 2012-03-29 07:29:27 +00:00
g_part_mbr.c VMware environments are not unusual now. Add VMware partitions recognition 2012-04-18 11:59:03 +00:00
g_part_pc98.c Do not truncate available disk space to the closest track boundary. 2011-05-25 09:45:13 +00:00
g_part_vtoc8.c Add a partition type for nandfs to the apm, bsd, gpt and vtoc8 schemes. 2012-05-25 20:33:34 +00:00
g_part.c Implement media change notification for DA and CD removable media devices. 2012-07-29 11:51:48 +00:00
g_part.h Add a partition type for nandfs to the apm, bsd, gpt and vtoc8 schemes. 2012-05-25 20:33:34 +00:00