Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: don't delay blk_run_queue_async
scsi: remove performance regression due to async queue run
blk-throttle: Use task_subsys_state() to determine a task's blkio_cgroup
block: rescan partitions on invalidated devices on -ENOMEDIA too
cdrom: always check_disk_change() on open
block: unexport DISK_EVENT_MEDIA_CHANGE for legacy/fringe drivers

+62 -43
+7
block/blk-cgroup.c
··· 114 114 } 115 115 EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup); 116 116 117 + struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk) 118 + { 119 + return container_of(task_subsys_state(tsk, blkio_subsys_id), 120 + struct blkio_cgroup, css); 121 + } 122 + EXPORT_SYMBOL_GPL(task_blkio_cgroup); 123 + 117 124 static inline void 118 125 blkio_update_group_weight(struct blkio_group *blkg, unsigned int weight) 119 126 {
+3
block/blk-cgroup.h
··· 291 291 #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) 292 292 extern struct blkio_cgroup blkio_root_cgroup; 293 293 extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); 294 + extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk); 294 295 extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, 295 296 struct blkio_group *blkg, void *key, dev_t dev, 296 297 enum blkio_policy_id plid); ··· 315 314 struct cgroup; 316 315 static inline struct blkio_cgroup * 317 316 cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } 317 + static inline struct blkio_cgroup * 318 + task_blkio_cgroup(struct task_struct *tsk) { return NULL; } 318 319 319 320 static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, 320 321 struct blkio_group *blkg, void *key, dev_t dev,
+3 -1
block/blk-core.c
··· 316 316 */ 317 317 void blk_run_queue_async(struct request_queue *q) 318 318 { 319 - if (likely(!blk_queue_stopped(q))) 319 + if (likely(!blk_queue_stopped(q))) { 320 + __cancel_delayed_work(&q->delay_work); 320 321 queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); 322 + } 321 323 } 322 324 EXPORT_SYMBOL(blk_run_queue_async); 323 325
+4 -5
block/blk-throttle.c
··· 160 160 } 161 161 162 162 static struct throtl_grp * throtl_find_alloc_tg(struct throtl_data *td, 163 - struct cgroup *cgroup) 163 + struct blkio_cgroup *blkcg) 164 164 { 165 - struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); 166 165 struct throtl_grp *tg = NULL; 167 166 void *key = td; 168 167 struct backing_dev_info *bdi = &td->queue->backing_dev_info; ··· 228 229 229 230 static struct throtl_grp * throtl_get_tg(struct throtl_data *td) 230 231 { 231 - struct cgroup *cgroup; 232 232 struct throtl_grp *tg = NULL; 233 + struct blkio_cgroup *blkcg; 233 234 234 235 rcu_read_lock(); 235 - cgroup = task_cgroup(current, blkio_subsys_id); 236 - tg = throtl_find_alloc_tg(td, cgroup); 236 + blkcg = task_blkio_cgroup(current); 237 + tg = throtl_find_alloc_tg(td, blkcg); 237 238 if (!tg) 238 239 tg = &td->root_tg; 239 240 rcu_read_unlock();
+5 -6
block/cfq-iosched.c
··· 1014 1014 cfqg->needs_update = true; 1015 1015 } 1016 1016 1017 - static struct cfq_group * 1018 - cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create) 1017 + static struct cfq_group * cfq_find_alloc_cfqg(struct cfq_data *cfqd, 1018 + struct blkio_cgroup *blkcg, int create) 1019 1019 { 1020 - struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); 1021 1020 struct cfq_group *cfqg = NULL; 1022 1021 void *key = cfqd; 1023 1022 int i, j; ··· 1078 1079 */ 1079 1080 static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd, int create) 1080 1081 { 1081 - struct cgroup *cgroup; 1082 + struct blkio_cgroup *blkcg; 1082 1083 struct cfq_group *cfqg = NULL; 1083 1084 1084 1085 rcu_read_lock(); 1085 - cgroup = task_cgroup(current, blkio_subsys_id); 1086 - cfqg = cfq_find_alloc_cfqg(cfqd, cgroup, create); 1086 + blkcg = task_blkio_cgroup(current); 1087 + cfqg = cfq_find_alloc_cfqg(cfqd, blkcg, create); 1087 1088 if (!cfqg && create) 1088 1089 cfqg = &cfqd->root_group; 1089 1090 rcu_read_unlock();
-1
drivers/block/DAC960.c
··· 2547 2547 disk->major = MajorNumber; 2548 2548 disk->first_minor = n << DAC960_MaxPartitionsBits; 2549 2549 disk->fops = &DAC960_BlockDeviceOperations; 2550 - disk->events = DISK_EVENT_MEDIA_CHANGE; 2551 2550 } 2552 2551 /* 2553 2552 Indicate the Block Device Registration completed successfully,
-1
drivers/block/amiflop.c
··· 1736 1736 disk->major = FLOPPY_MAJOR; 1737 1737 disk->first_minor = drive; 1738 1738 disk->fops = &floppy_fops; 1739 - disk->events = DISK_EVENT_MEDIA_CHANGE; 1740 1739 sprintf(disk->disk_name, "fd%d", drive); 1741 1740 disk->private_data = &unit[drive]; 1742 1741 set_capacity(disk, 880*2);
-1
drivers/block/ataflop.c
··· 1964 1964 unit[i].disk->first_minor = i; 1965 1965 sprintf(unit[i].disk->disk_name, "fd%d", i); 1966 1966 unit[i].disk->fops = &floppy_fops; 1967 - unit[i].disk->events = DISK_EVENT_MEDIA_CHANGE; 1968 1967 unit[i].disk->private_data = &unit[i]; 1969 1968 unit[i].disk->queue = blk_init_queue(do_fd_request, 1970 1969 &ataflop_lock);
-1
drivers/block/floppy.c
··· 4205 4205 disks[dr]->major = FLOPPY_MAJOR; 4206 4206 disks[dr]->first_minor = TOMINOR(dr); 4207 4207 disks[dr]->fops = &floppy_fops; 4208 - disks[dr]->events = DISK_EVENT_MEDIA_CHANGE; 4209 4208 sprintf(disks[dr]->disk_name, "fd%d", dr); 4210 4209 4211 4210 init_timer(&motor_off_timer[dr]);
-1
drivers/block/paride/pcd.c
··· 320 320 disk->first_minor = unit; 321 321 strcpy(disk->disk_name, cd->name); /* umm... */ 322 322 disk->fops = &pcd_bdops; 323 - disk->events = DISK_EVENT_MEDIA_CHANGE; 324 323 } 325 324 } 326 325
-1
drivers/block/paride/pd.c
··· 837 837 p->fops = &pd_fops; 838 838 p->major = major; 839 839 p->first_minor = (disk - pd) << PD_BITS; 840 - p->events = DISK_EVENT_MEDIA_CHANGE; 841 840 disk->gd = p; 842 841 p->private_data = disk; 843 842 p->queue = pd_queue;
-1
drivers/block/paride/pf.c
··· 294 294 disk->first_minor = unit; 295 295 strcpy(disk->disk_name, pf->name); 296 296 disk->fops = &pf_fops; 297 - disk->events = DISK_EVENT_MEDIA_CHANGE; 298 297 if (!(*drives[unit])[D_PRT]) 299 298 pf_drive_count++; 300 299 }
-1
drivers/block/swim.c
··· 858 858 swd->unit[drive].disk->first_minor = drive; 859 859 sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); 860 860 swd->unit[drive].disk->fops = &floppy_fops; 861 - swd->unit[drive].disk->events = DISK_EVENT_MEDIA_CHANGE; 862 861 swd->unit[drive].disk->private_data = &swd->unit[drive]; 863 862 swd->unit[drive].disk->queue = swd->queue; 864 863 set_capacity(swd->unit[drive].disk, 2880);
-1
drivers/block/swim3.c
··· 1163 1163 disk->major = FLOPPY_MAJOR; 1164 1164 disk->first_minor = i; 1165 1165 disk->fops = &floppy_fops; 1166 - disk->events = DISK_EVENT_MEDIA_CHANGE; 1167 1166 disk->private_data = &floppy_states[i]; 1168 1167 disk->queue = swim3_queue; 1169 1168 disk->flags |= GENHD_FL_REMOVABLE;
-1
drivers/block/ub.c
··· 2334 2334 disk->major = UB_MAJOR; 2335 2335 disk->first_minor = lun->id * UB_PARTS_PER_LUN; 2336 2336 disk->fops = &ub_bd_fops; 2337 - disk->events = DISK_EVENT_MEDIA_CHANGE; 2338 2337 disk->private_data = lun; 2339 2338 disk->driverfs_dev = &sc->intf->dev; 2340 2339
-1
drivers/block/xsysace.c
··· 1005 1005 ace->gd->major = ace_major; 1006 1006 ace->gd->first_minor = ace->id * ACE_NUM_MINORS; 1007 1007 ace->gd->fops = &ace_fops; 1008 - ace->gd->events = DISK_EVENT_MEDIA_CHANGE; 1009 1008 ace->gd->queue = ace->queue; 1010 1009 ace->gd->private_data = ace; 1011 1010 snprintf(ace->gd->disk_name, 32, "xs%c", ace->id + 'a');
+3 -3
drivers/cdrom/cdrom.c
··· 986 986 987 987 cdinfo(CD_OPEN, "entering cdrom_open\n"); 988 988 989 + /* open is event synchronization point, check events first */ 990 + check_disk_change(bdev); 991 + 989 992 /* if this was a O_NONBLOCK open and we should honor the flags, 990 993 * do a quick open without drive/disc integrity checks. */ 991 994 cdi->use_count++; ··· 1015 1012 1016 1013 cdinfo(CD_OPEN, "Use count for \"/dev/%s\" now %d\n", 1017 1014 cdi->name, cdi->use_count); 1018 - /* Do this on open. Don't wait for mount, because they might 1019 - not be mounting, but opening with O_NONBLOCK */ 1020 - check_disk_change(bdev); 1021 1015 return 0; 1022 1016 err_release: 1023 1017 if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {
-1
drivers/cdrom/gdrom.c
··· 803 803 goto probe_fail_cdrom_register; 804 804 } 805 805 gd.disk->fops = &gdrom_bdops; 806 - gd.disk->events = DISK_EVENT_MEDIA_CHANGE; 807 806 /* latch on to the interrupt */ 808 807 err = gdrom_set_interrupt_handlers(); 809 808 if (err)
-1
drivers/cdrom/viocd.c
··· 626 626 gendisk->queue = q; 627 627 gendisk->fops = &viocd_fops; 628 628 gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; 629 - gendisk->events = DISK_EVENT_MEDIA_CHANGE; 630 629 set_capacity(gendisk, 0); 631 630 gendisk->private_data = d; 632 631 d->viocd_disk = gendisk;
-1
drivers/message/i2o/i2o_block.c
··· 1000 1000 gd->major = I2O_MAJOR; 1001 1001 gd->queue = queue; 1002 1002 gd->fops = &i2o_block_fops; 1003 - gd->events = DISK_EVENT_MEDIA_CHANGE; 1004 1003 gd->private_data = dev; 1005 1004 1006 1005 dev->gd = gd;
-1
drivers/s390/char/tape_block.c
··· 236 236 disk->major = tapeblock_major; 237 237 disk->first_minor = device->first_minor; 238 238 disk->fops = &tapeblock_fops; 239 - disk->events = DISK_EVENT_MEDIA_CHANGE; 240 239 disk->private_data = tape_get_device(device); 241 240 disk->queue = blkdat->request_queue; 242 241 set_capacity(disk, 0);
+16 -4
drivers/scsi/scsi_lib.c
··· 74 74 */ 75 75 #define SCSI_QUEUE_DELAY 3 76 76 77 - static void scsi_run_queue(struct request_queue *q); 78 - 79 77 /* 80 78 * Function: scsi_unprep_request() 81 79 * ··· 159 161 blk_requeue_request(q, cmd->request); 160 162 spin_unlock_irqrestore(q->queue_lock, flags); 161 163 162 - scsi_run_queue(q); 164 + kblockd_schedule_work(q, &device->requeue_work); 163 165 164 166 return 0; 165 167 } ··· 436 438 continue; 437 439 } 438 440 439 - blk_run_queue_async(sdev->request_queue); 441 + spin_unlock(shost->host_lock); 442 + spin_lock(sdev->request_queue->queue_lock); 443 + __blk_run_queue(sdev->request_queue); 444 + spin_unlock(sdev->request_queue->queue_lock); 445 + spin_lock(shost->host_lock); 440 446 } 441 447 /* put any unprocessed entries back */ 442 448 list_splice(&starved_list, &shost->starved_list); 443 449 spin_unlock_irqrestore(shost->host_lock, flags); 444 450 445 451 blk_run_queue(q); 452 + } 453 + 454 + void scsi_requeue_run_queue(struct work_struct *work) 455 + { 456 + struct scsi_device *sdev; 457 + struct request_queue *q; 458 + 459 + sdev = container_of(work, struct scsi_device, requeue_work); 460 + q = sdev->request_queue; 461 + scsi_run_queue(q); 446 462 } 447 463 448 464 /*
+2
drivers/scsi/scsi_scan.c
··· 242 242 int display_failure_msg = 1, ret; 243 243 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 244 244 extern void scsi_evt_thread(struct work_struct *work); 245 + extern void scsi_requeue_run_queue(struct work_struct *work); 245 246 246 247 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, 247 248 GFP_ATOMIC); ··· 265 264 INIT_LIST_HEAD(&sdev->event_list); 266 265 spin_lock_init(&sdev->list_lock); 267 266 INIT_WORK(&sdev->event_work, scsi_evt_thread); 267 + INIT_WORK(&sdev->requeue_work, scsi_requeue_run_queue); 268 268 269 269 sdev->sdev_gendev.parent = get_device(&starget->dev); 270 270 sdev->sdev_target = starget;
+18 -9
fs/block_dev.c
··· 1102 1102 if (!bdev->bd_part) 1103 1103 goto out_clear; 1104 1104 1105 + ret = 0; 1105 1106 if (disk->fops->open) { 1106 1107 ret = disk->fops->open(bdev, mode); 1107 1108 if (ret == -ERESTARTSYS) { ··· 1119 1118 put_disk(disk); 1120 1119 goto restart; 1121 1120 } 1122 - if (ret) 1123 - goto out_clear; 1124 1121 } 1122 + /* 1123 + * If the device is invalidated, rescan partition 1124 + * if open succeeded or failed with -ENOMEDIUM. 1125 + * The latter is necessary to prevent ghost 1126 + * partitions on a removed medium. 1127 + */ 1128 + if (bdev->bd_invalidated && (!ret || ret == -ENOMEDIUM)) 1129 + rescan_partitions(disk, bdev); 1130 + if (ret) 1131 + goto out_clear; 1132 + 1125 1133 if (!bdev->bd_openers) { 1126 1134 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); 1127 1135 bdi = blk_get_backing_dev_info(bdev); ··· 1138 1128 bdi = &default_backing_dev_info; 1139 1129 bdev_inode_switch_bdi(bdev->bd_inode, bdi); 1140 1130 } 1141 - if (bdev->bd_invalidated) 1142 - rescan_partitions(disk, bdev); 1143 1131 } else { 1144 1132 struct block_device *whole; 1145 1133 whole = bdget_disk(disk, 0); ··· 1161 1153 } 1162 1154 } else { 1163 1155 if (bdev->bd_contains == bdev) { 1164 - if (bdev->bd_disk->fops->open) { 1156 + ret = 0; 1157 + if (bdev->bd_disk->fops->open) 1165 1158 ret = bdev->bd_disk->fops->open(bdev, mode); 1166 - if (ret) 1167 - goto out_unlock_bdev; 1168 - } 1169 - if (bdev->bd_invalidated) 1159 + /* the same as first opener case, read comment there */ 1160 + if (bdev->bd_invalidated && (!ret || ret == -ENOMEDIUM)) 1170 1161 rescan_partitions(bdev->bd_disk, bdev); 1162 + if (ret) 1163 + goto out_unlock_bdev; 1171 1164 } 1172 1165 /* only one opener holds refs to the module and disk */ 1173 1166 module_put(disk->fops->owner);
+1
include/scsi/scsi_device.h
··· 169 169 sdev_dev; 170 170 171 171 struct execute_work ew; /* used to get process context on put */ 172 + struct work_struct requeue_work; 172 173 173 174 struct scsi_dh_data *scsi_dh_data; 174 175 enum scsi_device_state sdev_state;