Skip to content

Commit

Permalink
block: Convert fifo_time from ulong to u64
Browse files Browse the repository at this point in the history
Currently rq->fifo_time is unsigned long but CFQ stores nanosecond
timestamp in it which would overflow on 32-bit archs. Convert it to u64
to avoid the overflow. Since the rq->fifo_time is unioned with struct
call_single_data(), this does not change the size of struct request in
any way.

We have to slightly fixup block/deadline-iosched.c so that comparison
happens in the right types.

Fixes: 9a7f38c
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
jankara authored and axboe committed Jun 28, 2016
1 parent 59a37f8 commit 9828c2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions block/deadline-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ deadline_merged_requests(struct request_queue *q, struct request *req,
* and move into next position (next will be deleted) in fifo
*/
if (!list_empty(&req->queuelist) && !list_empty(&next->queuelist)) {
if (time_before(next->fifo_time, req->fifo_time)) {
if (time_before((unsigned long)next->fifo_time,
(unsigned long)req->fifo_time)) {
list_move(&req->queuelist, &next->queuelist);
req->fifo_time = next->fifo_time;
}
Expand Down Expand Up @@ -227,7 +228,7 @@ static inline int deadline_check_fifo(struct deadline_data *dd, int ddir)
/*
* rq is expired!
*/
if (time_after_eq(jiffies, rq->fifo_time))
if (time_after_eq(jiffies, (unsigned long)rq->fifo_time))
return 1;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct request {
struct list_head queuelist;
union {
struct call_single_data csd;
unsigned long fifo_time;
u64 fifo_time;
};

struct request_queue *q;
Expand Down

0 comments on commit 9828c2c

Please sign in to comment.