Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  block: restore original behavior of /proc/partition when there's no partition
  remove blk_register_filter and blk_unregister_filter in gendisk
This commit is contained in:
Linus Torvalds 2008-09-02 10:45:01 -07:00
commit 1586553bc8
5 changed files with 20 additions and 4 deletions

View File

@ -223,6 +223,7 @@ int blk_register_filter(struct gendisk *disk)
return 0;
}
EXPORT_SYMBOL(blk_register_filter);
void blk_unregister_filter(struct gendisk *disk)
{
@ -231,4 +232,4 @@ void blk_unregister_filter(struct gendisk *disk)
kobject_put(&filter->kobj);
kobject_put(disk->holder_dir->parent);
}
EXPORT_SYMBOL(blk_unregister_filter);

View File

@ -190,7 +190,6 @@ void add_disk(struct gendisk *disk)
disk->minors, NULL, exact_match, exact_lock, disk);
register_disk(disk);
blk_register_queue(disk);
blk_register_filter(disk);
bdi = &disk->queue->backing_dev_info;
bdi_register_dev(bdi, MKDEV(disk->major, disk->first_minor));
@ -203,7 +202,6 @@ EXPORT_SYMBOL(del_gendisk); /* in partitions/check.c */
void unlink_gendisk(struct gendisk *disk)
{
blk_unregister_filter(disk);
sysfs_remove_link(&disk->dev.kobj, "bdi");
bdi_unregister(&disk->queue->backing_dev_info);
blk_unregister_queue(disk);
@ -309,7 +307,7 @@ static void *part_start(struct seq_file *part, loff_t *pos)
loff_t k = *pos;
if (!k)
seq_puts(part, "major minor #blocks name\n\n");
part->private = (void *)1LU; /* tell show to print header */
mutex_lock(&block_class_lock);
dev = class_find_device(&block_class, NULL, &k, find_start);
@ -351,6 +349,17 @@ static int show_partition(struct seq_file *part, void *v)
int n;
char buf[BDEVNAME_SIZE];
/*
* Print header if start told us to do. This is to preserve
* the original behavior of not printing header if no
* partition exists. This hackery will be removed later with
* class iteration clean up.
*/
if (part->private) {
seq_puts(part, "major minor #blocks name\n\n");
part->private = NULL;
}
/* Don't show non-partitionable removeable devices or empty devices */
if (!get_capacity(sgp) ||
(sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)))

View File

@ -1933,6 +1933,7 @@ static void ide_cd_remove(ide_drive_t *drive)
ide_proc_unregister_driver(drive, info->driver);
blk_unregister_filter(info->disk);
del_gendisk(info->disk);
ide_cd_put(info);
@ -2158,6 +2159,7 @@ static int ide_cd_probe(ide_drive_t *drive)
g->fops = &idecd_ops;
g->flags |= GENHD_FL_REMOVABLE;
add_disk(g);
blk_register_filter(g);
return 0;
out_free_cd:

View File

@ -1875,6 +1875,7 @@ static int sd_probe(struct device *dev)
dev_set_drvdata(dev, sdkp);
add_disk(gd);
blk_register_filter(gd);
sd_dif_config_host(sdkp);
sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
@ -1908,6 +1909,7 @@ static int sd_remove(struct device *dev)
struct scsi_disk *sdkp = dev_get_drvdata(dev);
device_del(&sdkp->dev);
blk_unregister_filter(sdkp->disk);
del_gendisk(sdkp->disk);
sd_shutdown(dev);

View File

@ -656,6 +656,7 @@ static int sr_probe(struct device *dev)
dev_set_drvdata(dev, cd);
disk->flags |= GENHD_FL_REMOVABLE;
add_disk(disk);
blk_register_filter(disk);
sdev_printk(KERN_DEBUG, sdev,
"Attached scsi CD-ROM %s\n", cd->cdi.name);
@ -894,6 +895,7 @@ static int sr_remove(struct device *dev)
{
struct scsi_cd *cd = dev_get_drvdata(dev);
blk_unregister_filter(cd->disk);
del_gendisk(cd->disk);
mutex_lock(&sr_ref_mutex);