Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147005
b: refs/heads/master
c: 83096eb
h: refs/heads/master
i:
  147003: 0802dac
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed May 11, 2009
1 parent db23ed7 commit 6ae5314
Show file tree
Hide file tree
Showing 55 changed files with 293 additions and 280 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: 5b93629b4509c03ffa87a9316412fedf6f58cb37
refs/heads/master: 83096ebf1263b2c1ee5e653ba37d993d02e3eb7b
2 changes: 1 addition & 1 deletion trunk/arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ static void do_ubd_request(struct request_queue *q)
}

req = dev->request;
sector = req->sector;
sector = blk_rq_pos(req);
while(dev->start_sg < dev->end_sg){
struct scatterlist *sg = &dev->sg[dev->start_sg];

Expand Down
18 changes: 10 additions & 8 deletions trunk/block/as-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ as_choose_req(struct as_data *ad, struct request *rq1, struct request *rq2)
data_dir = rq_is_sync(rq1);

last = ad->last_sector[data_dir];
s1 = rq1->sector;
s2 = rq2->sector;
s1 = blk_rq_pos(rq1);
s2 = blk_rq_pos(rq2);

BUG_ON(data_dir != rq_is_sync(rq2));

Expand Down Expand Up @@ -566,13 +566,15 @@ static void as_update_iohist(struct as_data *ad, struct as_io_context *aic,
as_update_thinktime(ad, aic, thinktime);

/* Calculate read -> read seek distance */
if (aic->last_request_pos < rq->sector)
seek_dist = rq->sector - aic->last_request_pos;
if (aic->last_request_pos < blk_rq_pos(rq))
seek_dist = blk_rq_pos(rq) -
aic->last_request_pos;
else
seek_dist = aic->last_request_pos - rq->sector;
seek_dist = aic->last_request_pos -
blk_rq_pos(rq);
as_update_seekdist(ad, aic, seek_dist);
}
aic->last_request_pos = rq->sector + rq->nr_sectors;
aic->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq);
set_bit(AS_TASK_IOSTARTED, &aic->state);
spin_unlock(&aic->lock);
}
Expand All @@ -587,7 +589,7 @@ static int as_close_req(struct as_data *ad, struct as_io_context *aic,
{
unsigned long delay; /* jiffies */
sector_t last = ad->last_sector[ad->batch_data_dir];
sector_t next = rq->sector;
sector_t next = blk_rq_pos(rq);
sector_t delta; /* acceptable close offset (in sectors) */
sector_t s;

Expand Down Expand Up @@ -981,7 +983,7 @@ static void as_move_to_dispatch(struct as_data *ad, struct request *rq)
* This has to be set in order to be correctly updated by
* as_find_next_rq
*/
ad->last_sector[data_dir] = rq->sector + rq->nr_sectors;
ad->last_sector[data_dir] = blk_rq_pos(rq) + blk_rq_sectors(rq);

if (data_dir == BLK_RW_SYNC) {
struct io_context *ioc = RQ_IOC(rq);
Expand Down
2 changes: 1 addition & 1 deletion trunk/block/blk-barrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
/*
* The driver must store the error location in ->bi_sector, if
* it supports it. For non-stacked drivers, this should be copied
* from rq->sector.
* from blk_rq_pos(rq).
*/
if (error_sector)
*error_sector = bio->bi_sector;
Expand Down
17 changes: 8 additions & 9 deletions trunk/block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
return;

cpu = part_stat_lock();
part = disk_map_sector_rcu(rq->rq_disk, rq->sector);
part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));

if (!new_io)
part_stat_inc(cpu, part, merges[rw]);
Expand Down Expand Up @@ -185,10 +185,9 @@ void blk_dump_rq_flags(struct request *rq, char *msg)
rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->cmd_type,
rq->cmd_flags);

printk(KERN_INFO " sector %llu, nr/cnr %lu/%u\n",
(unsigned long long)rq->sector,
rq->nr_sectors,
rq->current_nr_sectors);
printk(KERN_INFO " sector %llu, nr/cnr %u/%u\n",
(unsigned long long)blk_rq_pos(rq),
blk_rq_sectors(rq), blk_rq_cur_sectors(rq));
printk(KERN_INFO " bio %p, biotail %p, buffer %p, len %u\n",
rq->bio, rq->biotail,
rq->buffer, rq->data_len);
Expand Down Expand Up @@ -1557,7 +1556,7 @@ EXPORT_SYMBOL(submit_bio);
*/
int blk_rq_check_limits(struct request_queue *q, struct request *rq)
{
if (rq->nr_sectors > q->max_sectors ||
if (blk_rq_sectors(rq) > q->max_sectors ||
rq->data_len > q->max_hw_sectors << 9) {
printk(KERN_ERR "%s: over max size limit.\n", __func__);
return -EIO;
Expand Down Expand Up @@ -1645,7 +1644,7 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes)
int cpu;

cpu = part_stat_lock();
part = disk_map_sector_rcu(req->rq_disk, req->sector);
part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req));
part_stat_add(cpu, part, sectors[rw], bytes >> 9);
part_stat_unlock();
}
Expand All @@ -1665,7 +1664,7 @@ static void blk_account_io_done(struct request *req)
int cpu;

cpu = part_stat_lock();
part = disk_map_sector_rcu(req->rq_disk, req->sector);
part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req));

part_stat_inc(cpu, part, ios[rw]);
part_stat_add(cpu, part, ticks[rw], duration);
Expand Down Expand Up @@ -1846,7 +1845,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
if (error && (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))) {
printk(KERN_ERR "end_request: I/O error, dev %s, sector %llu\n",
req->rq_disk ? req->rq_disk->disk_name : "?",
(unsigned long long)req->sector);
(unsigned long long)blk_rq_pos(req));
}

blk_account_io_completion(req, nr_bytes);
Expand Down
10 changes: 5 additions & 5 deletions trunk/block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req,
else
max_sectors = q->max_sectors;

if (req->nr_sectors + bio_sectors(bio) > max_sectors) {
if (blk_rq_sectors(req) + bio_sectors(bio) > max_sectors) {
req->cmd_flags |= REQ_NOMERGE;
if (req == q->last_merge)
q->last_merge = NULL;
Expand All @@ -284,7 +284,7 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req,
max_sectors = q->max_sectors;


if (req->nr_sectors + bio_sectors(bio) > max_sectors) {
if (blk_rq_sectors(req) + bio_sectors(bio) > max_sectors) {
req->cmd_flags |= REQ_NOMERGE;
if (req == q->last_merge)
q->last_merge = NULL;
Expand Down Expand Up @@ -315,7 +315,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
/*
* Will it become too large?
*/
if ((req->nr_sectors + next->nr_sectors) > q->max_sectors)
if ((blk_rq_sectors(req) + blk_rq_sectors(next)) > q->max_sectors)
return 0;

total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
Expand Down Expand Up @@ -345,7 +345,7 @@ static void blk_account_io_merge(struct request *req)
int cpu;

cpu = part_stat_lock();
part = disk_map_sector_rcu(req->rq_disk, req->sector);
part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req));

part_round_stats(cpu, part);
part_dec_in_flight(part);
Expand All @@ -366,7 +366,7 @@ static int attempt_merge(struct request_queue *q, struct request *req,
/*
* not contiguous
*/
if (req->sector + req->nr_sectors != next->sector)
if (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next))
return 0;

if (rq_data_dir(req) != rq_data_dir(next)
Expand Down
18 changes: 9 additions & 9 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2)
else if (rq_is_meta(rq2) && !rq_is_meta(rq1))
return rq2;

s1 = rq1->sector;
s2 = rq2->sector;
s1 = blk_rq_pos(rq1);
s2 = blk_rq_pos(rq2);

last = cfqd->last_position;

Expand Down Expand Up @@ -949,10 +949,10 @@ static struct cfq_queue *cfq_set_active_queue(struct cfq_data *cfqd,
static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
struct request *rq)
{
if (rq->sector >= cfqd->last_position)
return rq->sector - cfqd->last_position;
if (blk_rq_pos(rq) >= cfqd->last_position)
return blk_rq_pos(rq) - cfqd->last_position;
else
return cfqd->last_position - rq->sector;
return cfqd->last_position - blk_rq_pos(rq);
}

#define CIC_SEEK_THR 8 * 1024
Expand Down Expand Up @@ -1918,10 +1918,10 @@ cfq_update_io_seektime(struct cfq_data *cfqd, struct cfq_io_context *cic,

if (!cic->last_request_pos)
sdist = 0;
else if (cic->last_request_pos < rq->sector)
sdist = rq->sector - cic->last_request_pos;
else if (cic->last_request_pos < blk_rq_pos(rq))
sdist = blk_rq_pos(rq) - cic->last_request_pos;
else
sdist = cic->last_request_pos - rq->sector;
sdist = cic->last_request_pos - blk_rq_pos(rq);

/*
* Don't allow the seek distance to get too large from the
Expand Down Expand Up @@ -2071,7 +2071,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
cfq_update_io_seektime(cfqd, cic, rq);
cfq_update_idle_window(cfqd, cfqq, cic);

cic->last_request_pos = rq->sector + rq->nr_sectors;
cic->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq);

if (cfqq == cfqd->active_queue) {
/*
Expand Down
2 changes: 1 addition & 1 deletion trunk/block/deadline-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ deadline_merge(struct request_queue *q, struct request **req, struct bio *bio)

__rq = elv_rb_find(&dd->sort_list[bio_data_dir(bio)], sector);
if (__rq) {
BUG_ON(sector != __rq->sector);
BUG_ON(sector != blk_rq_pos(__rq));

if (elv_rq_merge_ok(__rq, bio)) {
ret = ELEVATOR_FRONT_MERGE;
Expand Down
22 changes: 11 additions & 11 deletions trunk/block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static const int elv_hash_shift = 6;
#define ELV_HASH_FN(sec) \
(hash_long(ELV_HASH_BLOCK((sec)), elv_hash_shift))
#define ELV_HASH_ENTRIES (1 << elv_hash_shift)
#define rq_hash_key(rq) ((rq)->sector + (rq)->nr_sectors)
#define rq_hash_key(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq))

DEFINE_TRACE(block_rq_insert);
DEFINE_TRACE(block_rq_issue);
Expand Down Expand Up @@ -119,9 +119,9 @@ static inline int elv_try_merge(struct request *__rq, struct bio *bio)
* we can merge and sequence is ok, check if it's possible
*/
if (elv_rq_merge_ok(__rq, bio)) {
if (__rq->sector + __rq->nr_sectors == bio->bi_sector)
if (blk_rq_pos(__rq) + blk_rq_sectors(__rq) == bio->bi_sector)
ret = ELEVATOR_BACK_MERGE;
else if (__rq->sector - bio_sectors(bio) == bio->bi_sector)
else if (blk_rq_pos(__rq) - bio_sectors(bio) == bio->bi_sector)
ret = ELEVATOR_FRONT_MERGE;
}

Expand Down Expand Up @@ -370,9 +370,9 @@ struct request *elv_rb_add(struct rb_root *root, struct request *rq)
parent = *p;
__rq = rb_entry(parent, struct request, rb_node);

if (rq->sector < __rq->sector)
if (blk_rq_pos(rq) < blk_rq_pos(__rq))
p = &(*p)->rb_left;
else if (rq->sector > __rq->sector)
else if (blk_rq_pos(rq) > blk_rq_pos(__rq))
p = &(*p)->rb_right;
else
return __rq;
Expand Down Expand Up @@ -400,9 +400,9 @@ struct request *elv_rb_find(struct rb_root *root, sector_t sector)
while (n) {
rq = rb_entry(n, struct request, rb_node);

if (sector < rq->sector)
if (sector < blk_rq_pos(rq))
n = n->rb_left;
else if (sector > rq->sector)
else if (sector > blk_rq_pos(rq))
n = n->rb_right;
else
return rq;
Expand Down Expand Up @@ -441,14 +441,14 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
break;
if (pos->cmd_flags & stop_flags)
break;
if (rq->sector >= boundary) {
if (pos->sector < boundary)
if (blk_rq_pos(rq) >= boundary) {
if (blk_rq_pos(pos) < boundary)
continue;
} else {
if (pos->sector >= boundary)
if (blk_rq_pos(pos) >= boundary)
break;
}
if (rq->sector >= pos->sector)
if (blk_rq_pos(rq) >= blk_rq_pos(pos))
break;
}

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/DAC960.c
Original file line number Diff line number Diff line change
Expand Up @@ -3338,8 +3338,8 @@ static int DAC960_process_queue(DAC960_Controller_T *Controller, struct request_
}
Command->Completion = Request->end_io_data;
Command->LogicalDriveNumber = (long)Request->rq_disk->private_data;
Command->BlockNumber = Request->sector;
Command->BlockCount = Request->nr_sectors;
Command->BlockNumber = blk_rq_pos(Request);
Command->BlockCount = blk_rq_sectors(Request);
Command->Request = Request;
blkdev_dequeue_request(Request);
Command->SegmentCount = blk_rq_map_sg(req_q,
Expand Down Expand Up @@ -3431,7 +3431,7 @@ static void DAC960_queue_partial_rw(DAC960_Command_T *Command)
* successfully as possible.
*/
Command->SegmentCount = 1;
Command->BlockNumber = Request->sector;
Command->BlockNumber = blk_rq_pos(Request);
Command->BlockCount = 1;
DAC960_QueueReadWriteCommand(Command);
return;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/amiflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,13 +1351,13 @@ static void redo_fd_request(void)
drive = floppy - unit;

/* Here someone could investigate to be more efficient */
for (cnt = 0; cnt < CURRENT->current_nr_sectors; cnt++) {
for (cnt = 0; cnt < blk_rq_cur_sectors(CURRENT); cnt++) {
#ifdef DEBUG
printk("fd: sector %ld + %d requested for %s\n",
CURRENT->sector,cnt,
blk_rq_pos(CURRENT), cnt,
(rq_data_dir(CURRENT) == READ) ? "read" : "write");
#endif
block = CURRENT->sector + cnt;
block = blk_rq_pos(CURRENT) + cnt;
if ((int)block > floppy->blocks) {
__blk_end_request_cur(CURRENT, -EIO);
goto repeat;
Expand Down
10 changes: 5 additions & 5 deletions trunk/drivers/block/ataflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ static void do_fd_action( int drive )
if (IS_BUFFERED( drive, ReqSide, ReqTrack )) {
if (ReqCmd == READ) {
copy_buffer( SECTOR_BUFFER(ReqSector), ReqData );
if (++ReqCnt < CURRENT->current_nr_sectors) {
if (++ReqCnt < blk_rq_cur_sectors(CURRENT)) {
/* read next sector */
setup_req_params( drive );
goto repeat;
Expand Down Expand Up @@ -1130,7 +1130,7 @@ static void fd_rwsec_done1(int status)
}
}

if (++ReqCnt < CURRENT->current_nr_sectors) {
if (++ReqCnt < blk_rq_cur_sectors(CURRENT)) {
/* read next sector */
setup_req_params( SelectedDrive );
do_fd_action( SelectedDrive );
Expand Down Expand Up @@ -1394,7 +1394,7 @@ static void redo_fd_request(void)

DPRINT(("redo_fd_request: CURRENT=%p dev=%s CURRENT->sector=%ld\n",
CURRENT, CURRENT ? CURRENT->rq_disk->disk_name : "",
CURRENT ? CURRENT->sector : 0 ));
CURRENT ? blk_rq_pos(CURRENT) : 0 ));

IsFormatting = 0;

Expand Down Expand Up @@ -1440,7 +1440,7 @@ static void redo_fd_request(void)
UD.autoprobe = 0;
}

if (CURRENT->sector + 1 > UDT->blocks) {
if (blk_rq_pos(CURRENT) + 1 > UDT->blocks) {
__blk_end_request_cur(CURRENT, -EIO);
goto repeat;
}
Expand All @@ -1450,7 +1450,7 @@ static void redo_fd_request(void)

ReqCnt = 0;
ReqCmd = rq_data_dir(CURRENT);
ReqBlock = CURRENT->sector;
ReqBlock = blk_rq_pos(CURRENT);
ReqBuffer = CURRENT->buffer;
setup_req_params( drive );
do_fd_action( drive );
Expand Down
Loading

0 comments on commit 6ae5314

Please sign in to comment.