aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-10-28 11:53:00 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-28 11:53:00 -0400
commit0ee40c6628434f0535da31deeacc28b61e80d810 (patch)
tree2873b9c932a63943fad22617b8385866e45347f5
parent236fa08168dd82af29a76c31c40b4148403774c0 (diff)
parent2824bc9328467127083c1325f54b67d298c333b2 (diff)
Merge branch 'for-linus' of git://brick.kernel.dk/data/git/linux-2.6-block
-rw-r--r--drivers/block/elevator.c24
-rw-r--r--drivers/block/ll_rw_blk.c14
-rw-r--r--fs/partitions/check.c2
-rw-r--r--include/linux/genhd.h2
4 files changed, 24 insertions, 18 deletions
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c
index c744d2a13062..4f69d222b183 100644
--- a/drivers/block/elevator.c
+++ b/drivers/block/elevator.c
@@ -97,7 +97,6 @@ static struct elevator_type *elevator_find(const char *name)
97 struct elevator_type *e = NULL; 97 struct elevator_type *e = NULL;
98 struct list_head *entry; 98 struct list_head *entry;
99 99
100 spin_lock_irq(&elv_list_lock);
101 list_for_each(entry, &elv_list) { 100 list_for_each(entry, &elv_list) {
102 struct elevator_type *__e; 101 struct elevator_type *__e;
103 102
@@ -108,7 +107,6 @@ static struct elevator_type *elevator_find(const char *name)
108 break; 107 break;
109 } 108 }
110 } 109 }
111 spin_unlock_irq(&elv_list_lock);
112 110
113 return e; 111 return e;
114} 112}
@@ -120,12 +118,15 @@ static void elevator_put(struct elevator_type *e)
120 118
121static struct elevator_type *elevator_get(const char *name) 119static struct elevator_type *elevator_get(const char *name)
122{ 120{
123 struct elevator_type *e = elevator_find(name); 121 struct elevator_type *e;
124 122
125 if (!e) 123 spin_lock_irq(&elv_list_lock);
126 return NULL; 124
127 if (!try_module_get(e->elevator_owner)) 125 e = elevator_find(name);
128 return NULL; 126 if (e && !try_module_get(e->elevator_owner))
127 e = NULL;
128
129 spin_unlock_irq(&elv_list_lock);
129 130
130 return e; 131 return e;
131} 132}
@@ -153,11 +154,15 @@ static char chosen_elevator[16];
153 154
154static void elevator_setup_default(void) 155static void elevator_setup_default(void)
155{ 156{
157 struct elevator_type *e;
158
156 /* 159 /*
157 * check if default is set and exists 160 * check if default is set and exists
158 */ 161 */
159 if (chosen_elevator[0] && elevator_find(chosen_elevator)) 162 if (chosen_elevator[0] && (e = elevator_get(chosen_elevator))) {
163 elevator_put(e);
160 return; 164 return;
165 }
161 166
162#if defined(CONFIG_IOSCHED_AS) 167#if defined(CONFIG_IOSCHED_AS)
163 strcpy(chosen_elevator, "anticipatory"); 168 strcpy(chosen_elevator, "anticipatory");
@@ -555,10 +560,9 @@ void elv_unregister_queue(struct request_queue *q)
555 560
556int elv_register(struct elevator_type *e) 561int elv_register(struct elevator_type *e)
557{ 562{
563 spin_lock_irq(&elv_list_lock);
558 if (elevator_find(e->elevator_name)) 564 if (elevator_find(e->elevator_name))
559 BUG(); 565 BUG();
560
561 spin_lock_irq(&elv_list_lock);
562 list_add_tail(&e->list, &elv_list); 566 list_add_tail(&e->list, &elv_list);
563 spin_unlock_irq(&elv_list_lock); 567 spin_unlock_irq(&elv_list_lock);
564 568
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index 0f64ee7d8d27..ac31ea170058 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -2433,13 +2433,15 @@ void disk_round_stats(struct gendisk *disk)
2433{ 2433{
2434 unsigned long now = jiffies; 2434 unsigned long now = jiffies;
2435 2435
2436 __disk_stat_add(disk, time_in_queue, 2436 if (now == disk->stamp)
2437 disk->in_flight * (now - disk->stamp)); 2437 return;
2438 disk->stamp = now;
2439 2438
2440 if (disk->in_flight) 2439 if (disk->in_flight) {
2441 __disk_stat_add(disk, io_ticks, (now - disk->stamp_idle)); 2440 __disk_stat_add(disk, time_in_queue,
2442 disk->stamp_idle = now; 2441 disk->in_flight * (now - disk->stamp));
2442 __disk_stat_add(disk, io_ticks, (now - disk->stamp));
2443 }
2444 disk->stamp = now;
2443} 2445}
2444 2446
2445/* 2447/*
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 77e178f13162..1e848648a322 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -430,7 +430,7 @@ void del_gendisk(struct gendisk *disk)
430 disk->flags &= ~GENHD_FL_UP; 430 disk->flags &= ~GENHD_FL_UP;
431 unlink_gendisk(disk); 431 unlink_gendisk(disk);
432 disk_stat_set_all(disk, 0); 432 disk_stat_set_all(disk, 0);
433 disk->stamp = disk->stamp_idle = 0; 433 disk->stamp = 0;
434 434
435 devfs_remove_disk(disk); 435 devfs_remove_disk(disk);
436 436
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 01796c41c951..142e1c1e0689 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -119,7 +119,7 @@ struct gendisk {
119 int policy; 119 int policy;
120 120
121 atomic_t sync_io; /* RAID */ 121 atomic_t sync_io; /* RAID */
122 unsigned long stamp, stamp_idle; 122 unsigned long stamp;
123 int in_flight; 123 int in_flight;
124#ifdef CONFIG_SMP 124#ifdef CONFIG_SMP
125 struct disk_stats *dkstats; 125 struct disk_stats *dkstats;