Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 110476
b: refs/heads/master
c: e71bf0d
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Oct 9, 2008
1 parent 0db2025 commit 9fabbe0
Show file tree
Hide file tree
Showing 9 changed files with 324 additions and 95 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f331c0296f2a9fee0d396a70598b954062603015
refs/heads/master: e71bf0d0ee89e51b92776391c5634938236977d5
20 changes: 16 additions & 4 deletions trunk/block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ static void drive_stat_acct(struct request *rq, int new_io)
if (!blk_fs_request(rq) || !rq->rq_disk)
return;

part = disk_map_sector(rq->rq_disk, rq->sector);
rcu_read_lock();

part = disk_map_sector_rcu(rq->rq_disk, rq->sector);
if (!new_io)
__all_stat_inc(rq->rq_disk, part, merges[rw], rq->sector);
else {
Expand All @@ -71,6 +73,8 @@ static void drive_stat_acct(struct request *rq, int new_io)
part->in_flight++;
}
}

rcu_read_unlock();
}

void blk_queue_congestion_threshold(struct request_queue *q)
Expand Down Expand Up @@ -1557,12 +1561,14 @@ static int __end_that_request_first(struct request *req, int error,
}

if (blk_fs_request(req) && req->rq_disk) {
struct hd_struct *part =
disk_map_sector(req->rq_disk, req->sector);
const int rw = rq_data_dir(req);
struct hd_struct *part;

rcu_read_lock();
part = disk_map_sector_rcu(req->rq_disk, req->sector);
all_stat_add(req->rq_disk, part, sectors[rw],
nr_bytes >> 9, req->sector);
rcu_read_unlock();
}

total_bytes = bio_nbytes = 0;
Expand Down Expand Up @@ -1746,7 +1752,11 @@ static void end_that_request_last(struct request *req, int error)
if (disk && blk_fs_request(req) && req != &req->q->bar_rq) {
unsigned long duration = jiffies - req->start_time;
const int rw = rq_data_dir(req);
struct hd_struct *part = disk_map_sector(disk, req->sector);
struct hd_struct *part;

rcu_read_lock();

part = disk_map_sector_rcu(disk, req->sector);

__all_stat_inc(disk, part, ios[rw], req->sector);
__all_stat_add(disk, part, ticks[rw], duration, req->sector);
Expand All @@ -1756,6 +1766,8 @@ static void end_that_request_last(struct request *req, int error)
part_round_stats(part);
part->in_flight--;
}

rcu_read_unlock();
}

if (req->end_io)
Expand Down
9 changes: 7 additions & 2 deletions trunk/block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,19 @@ static int attempt_merge(struct request_queue *q, struct request *req,
elv_merge_requests(q, req, next);

if (req->rq_disk) {
struct hd_struct *part =
disk_map_sector(req->rq_disk, req->sector);
struct hd_struct *part;

rcu_read_lock();

part = disk_map_sector_rcu(req->rq_disk, req->sector);
disk_round_stats(req->rq_disk);
req->rq_disk->in_flight--;
if (part) {
part_round_stats(part);
part->in_flight--;
}

rcu_read_unlock();
}

req->ioprio = ioprio_best(req->ioprio, next->ioprio);
Expand Down
Loading

0 comments on commit 9fabbe0

Please sign in to comment.