Release 4.11 drivers/s390/block/dasd_genhd.c
/*
* Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
* Horst Hummel <Horst.Hummel@de.ibm.com>
* Carsten Otte <Cotte@de.ibm.com>
* Martin Schwidefsky <schwidefsky@de.ibm.com>
* Bugreports.to..: <Linux390@de.ibm.com>
* Copyright IBM Corp. 1999, 2001
*
* gendisk related functions for the dasd driver.
*
*/
#define KMSG_COMPONENT "dasd"
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/blkpg.h>
#include <linux/uaccess.h>
/* This is ugly... */
#define PRINTK_HEADER "dasd_gendisk:"
#include "dasd_int.h"
/*
* Allocate and register gendisk structure for device.
*/
int dasd_gendisk_alloc(struct dasd_block *block)
{
struct gendisk *gdp;
struct dasd_device *base;
int len;
/* Make sure the minor for this device exists. */
base = block->base;
if (base->devindex >= DASD_PER_MAJOR)
return -EBUSY;
gdp = alloc_disk(1 << DASD_PARTN_BITS);
if (!gdp)
return -ENOMEM;
/* Initialize gendisk structure. */
gdp->major = DASD_MAJOR;
gdp->first_minor = base->devindex << DASD_PARTN_BITS;
gdp->fops = &dasd_device_operations;
/*
* Set device name.
* dasda - dasdz : 26 devices
* dasdaa - dasdzz : 676 devices, added up = 702
* dasdaaa - dasdzzz : 17576 devices, added up = 18278
* dasdaaaa - dasdzzzz : 456976 devices, added up = 475252
*/
len = sprintf(gdp->disk_name, "dasd");
if (base->devindex > 25) {
if (base->devindex > 701) {
if (base->devindex > 18277)
len += sprintf(gdp->disk_name + len, "%c",
'a'+(((base->devindex-18278)
/17576)%26));
len += sprintf(gdp->disk_name + len, "%c",
'a'+(((base->devindex-702)/676)%26));
}
len += sprintf(gdp->disk_name + len, "%c",
'a'+(((base->devindex-26)/26)%26));
}
len += sprintf(gdp->disk_name + len, "%c", 'a'+(base->devindex%26));
if (base->features & DASD_FEATURE_READONLY ||
test_bit(DASD_FLAG_DEVICE_RO, &base->flags))
set_disk_ro(gdp, 1);
dasd_add_link_to_gendisk(gdp, base);
gdp->queue = block->request_queue;
block->gdp = gdp;
set_capacity(block->gdp, 0);
device_add_disk(&base->cdev->dev, block->gdp);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 141 | 45.19% | 1 | 7.69% |
Martin Schwidefsky | 109 | 34.94% | 5 | 38.46% |
Stefan Weinhuber | 43 | 13.78% | 3 | 23.08% |
Dan J Williams | 8 | 2.56% | 1 | 7.69% |
Al Viro | 7 | 2.24% | 2 | 15.38% |
Horst Hummel | 4 | 1.28% | 1 | 7.69% |
Total | 312 | 100.00% | 13 | 100.00% |
/*
* Unregister and free gendisk structure for device.
*/
void dasd_gendisk_free(struct dasd_block *block)
{
if (block->gdp) {
del_gendisk(block->gdp);
block->gdp->private_data = NULL;
put_disk(block->gdp);
block->gdp = NULL;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 26 | 56.52% | 4 | 50.00% |
Stefan Weinhuber | 8 | 17.39% | 1 | 12.50% |
Horst Hummel | 7 | 15.22% | 1 | 12.50% |
Stefan Haberland | 4 | 8.70% | 1 | 12.50% |
Heiko Carstens | 1 | 2.17% | 1 | 12.50% |
Total | 46 | 100.00% | 8 | 100.00% |
/*
* Trigger a partition detection.
*/
int dasd_scan_partitions(struct dasd_block *block)
{
struct block_device *bdev;
int rc;
bdev = bdget_disk(block->gdp, 0);
if (!bdev) {
DBF_DEV_EVENT(DBF_ERR, block->base, "%s",
"scan partitions error, bdget returned NULL");
return -ENODEV;
}
rc = blkdev_get(bdev, FMODE_READ, NULL);
if (rc < 0) {
DBF_DEV_EVENT(DBF_ERR, block->base,
"scan partitions error, blkdev_get returned %d",
rc);
return -ENODEV;
}
rc = blkdev_reread_part(bdev);
if (rc)
DBF_DEV_EVENT(DBF_ERR, block->base,
"scan partitions error, rc %d", rc);
/*
* Since the matching blkdev_put call to the blkdev_get in
* this function is not called before dasd_destroy_partitions
* the offline open_count limit needs to be increased from
* 0 to 1. This is done by setting device->bdev (see
* dasd_generic_set_offline). As long as the partition
* detection is running no offline should be allowed. That
* is why the assignment to device->bdev is done AFTER
* the BLKRRPART ioctl.
*/
block->bdev = bdev;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stefan Haberland | 61 | 49.59% | 1 | 8.33% |
Martin Schwidefsky | 30 | 24.39% | 3 | 25.00% |
Andrew Morton | 13 | 10.57% | 1 | 8.33% |
Al Viro | 9 | 7.32% | 3 | 25.00% |
Stefan Weinhuber | 5 | 4.07% | 1 | 8.33% |
Tejun Heo | 2 | 1.63% | 1 | 8.33% |
Jarod Wilson | 2 | 1.63% | 1 | 8.33% |
Ming Lei | 1 | 0.81% | 1 | 8.33% |
Total | 123 | 100.00% | 12 | 100.00% |
/*
* 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)
{
/* The two structs have 168/176 byte on 31/64 bit. */
struct blkpg_partition bpart;
struct blkpg_ioctl_arg barg;
struct block_device *bdev;
/*
* Get the bdev pointer from the device structure and clear
* device->bdev to lower the offline open_count limit again.
*/
bdev = block->bdev;
block->bdev = NULL;
/*
* See fs/partition/check.c:delete_partition
* Can't call delete_partitions directly. Use ioctl.
* The ioctl also does locking and invalidation.
*/
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);
/* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */
blkdev_put(bdev, FMODE_READ);
set_capacity(block->gdp, 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 78 | 52.00% | 1 | 9.09% |
Martin Schwidefsky | 48 | 32.00% | 4 | 36.36% |
Stefan Weinhuber | 8 | 5.33% | 1 | 9.09% |
Heiko Carstens | 7 | 4.67% | 2 | 18.18% |
Al Viro | 5 | 3.33% | 2 | 18.18% |
Joe Korty | 4 | 2.67% | 1 | 9.09% |
Total | 150 | 100.00% | 11 | 100.00% |
int dasd_gendisk_init(void)
{
int rc;
/* Register to static dasd major 94 */
rc = register_blkdev(DASD_MAJOR, "dasd");
if (rc != 0) {
pr_warn("Registering the device driver with major number %d failed\n",
DASD_MAJOR);
return rc;
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 38 | 92.68% | 3 | 60.00% |
Joe Perches | 2 | 4.88% | 1 | 20.00% |
Stefan Weinhuber | 1 | 2.44% | 1 | 20.00% |
Total | 41 | 100.00% | 5 | 100.00% |
void dasd_gendisk_exit(void)
{
unregister_blkdev(DASD_MAJOR, "dasd");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 13 | 92.86% | 2 | 66.67% |
Stefan Weinhuber | 1 | 7.14% | 1 | 33.33% |
Total | 14 | 100.00% | 3 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 287 | 40.14% | 7 | 20.59% |
Andrew Morton | 232 | 32.45% | 2 | 5.88% |
Stefan Haberland | 69 | 9.65% | 3 | 8.82% |
Stefan Weinhuber | 66 | 9.23% | 3 | 8.82% |
Al Viro | 21 | 2.94% | 7 | 20.59% |
Horst Hummel | 11 | 1.54% | 2 | 5.88% |
Heiko Carstens | 9 | 1.26% | 3 | 8.82% |
Dan J Williams | 8 | 1.12% | 1 | 2.94% |
Joe Korty | 4 | 0.56% | 1 | 2.94% |
Joe Perches | 2 | 0.28% | 1 | 2.94% |
Jarod Wilson | 2 | 0.28% | 1 | 2.94% |
Tejun Heo | 2 | 0.28% | 1 | 2.94% |
Ming Lei | 1 | 0.14% | 1 | 2.94% |
Linus Torvalds | 1 | 0.14% | 1 | 2.94% |
Total | 715 | 100.00% | 34 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.