FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
/*
 * Remove a vdev from the L2ARC.
 */
Remove a vdev from the L2ARC.
Remove a vdev from the L2ARC .
void
l2arc_remove_vdev(vdev_t *vd)
{
	l2arc_dev_t *dev, *nextdev, *remdev = NULL;
	mutex_enter(&l2arc_dev_mtx);
	for (dev = list_head(l2arc_dev_list); dev; dev = nextdev) {
		nextdev = list_next(l2arc_dev_list, dev);
		if (vd == dev->l2ad_vdev) {
			remdev = dev;
			break;
		}
	}
	ASSERT(remdev != NULL);
	list_remove(l2arc_dev_list, remdev);
	l2arc_dev_last = NULL;		
	atomic_dec_64(&l2arc_ndev);
	mutex_exit(&l2arc_dev_mtx);
	l2arc_evict(remdev, 0, B_TRUE);
	list_destroy(&remdev->l2ad_buflist);
	mutex_destroy(&remdev->l2ad_mtx);
	refcount_destroy(&remdev->l2ad_alloc);
	kmem_free(remdev, sizeof (l2arc_dev_t));
}
void l2arc_remove_vdev ( vdev_t * vd ) { l2arc_dev_t * dev , * nextdev , * remdev = NULL ; mutex_enter ( & l2arc_dev_mtx ) ; for ( dev = list_head ( l2arc_dev_list ) ; dev ; dev = nextdev ) { nextdev = list_next ( l2arc_dev_list , dev ) ; if ( vd == dev -> l2ad_vdev ) { remdev = dev ; break ; } } ASSERT ( remdev != NULL ) ; list_remove ( l2arc_dev_list , remdev ) ; l2arc_dev_last = NULL ; atomic_dec_64 ( & l2arc_ndev ) ; mutex_exit ( & l2arc_dev_mtx ) ; l2arc_evict ( remdev , 0 , B_TRUE ) ; list_destroy ( & remdev -> l2ad_buflist ) ; mutex_destroy ( & remdev -> l2ad_mtx ) ; refcount_destroy ( & remdev -> l2ad_alloc ) ; kmem_free ( remdev , sizeof ( l2arc_dev_t ) ) ; }
Remove a vdev from the L2ARC.
Remove a vdev from the L2ARC .
/*
	 * Find the device by vdev
	 */ /*
	 * Remove device from global list
	 */ /* may have been invalidated */ /*
	 * Clear all buflists and ARC references.  L2ARC device flush.
	 */