/* Remove all inodes in the system for a device, delete the partitions and make device unusable by setting its size to zero.  */
void dasd_destroy_partitions(struct dasd_block *block)
/* Remove all inodes in the system for a device, delete the partitions and make device unusable by setting its size to zero.  */
void dasd_destroy_partitions(struct dasd_block *block)
{
	struct blkpg_partition bpart;
	struct blkpg_ioctl_arg barg;
	struct block_device *bdev;
	bdev = block->bdev;
	block->bdev = NULL;
	memset(&bpart, 0, sizeof(struct blkpg_partition));
	memset(&barg, 0, sizeof(struct blkpg_ioctl_arg));
	barg.data = (void __force __user *) &bpart;
	barg.op = BLKPG_DEL_PARTITION;
	for (bpart.pno = block->gdp->minors - 1; bpart.pno > 0; bpart.pno--)
		ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg);
	invalidate_partition(block->gdp, 0);
	blkdev_put(bdev, FMODE_READ);
	set_capacity(block->gdp, 0);
}