diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2010-06-01 06:23:18 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-06-01 06:23:18 -0400 |
commit | 28f4197e5d4707311febeec8a0eb97cb5fd93c97 (patch) | |
tree | 9f7c5808e0c069b449b67856207c5ee4f740bd34 /include/linux/blkdev.h | |
parent | 713b686494a577b3c4f4f9f585a4705fc30d51c2 (diff) |
block: disable preemption before using sched_clock()
Commit 9195291e5f05e01d67f9a09c756b8aca8f009089 added calls to
sched_clock() from preemptible code. sched_clock() is both the
wrong interface AND cannot be called without preempt disabled.
Apply a temporary fix to get rid of the warnings, a real patch
is in the works.
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8b7f5e0914ad..09a840264d6f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1211,14 +1211,23 @@ struct work_struct; | |||
1211 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); | 1211 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
1212 | 1212 | ||
1213 | #ifdef CONFIG_BLK_CGROUP | 1213 | #ifdef CONFIG_BLK_CGROUP |
1214 | /* | ||
1215 | * This should not be using sched_clock(). A real patch is in progress | ||
1216 | * to fix this up, until that is in place we need to disable preemption | ||
1217 | * around sched_clock() in this function and set_io_start_time_ns(). | ||
1218 | */ | ||
1214 | static inline void set_start_time_ns(struct request *req) | 1219 | static inline void set_start_time_ns(struct request *req) |
1215 | { | 1220 | { |
1221 | preempt_disable(); | ||
1216 | req->start_time_ns = sched_clock(); | 1222 | req->start_time_ns = sched_clock(); |
1223 | preempt_enable(); | ||
1217 | } | 1224 | } |
1218 | 1225 | ||
1219 | static inline void set_io_start_time_ns(struct request *req) | 1226 | static inline void set_io_start_time_ns(struct request *req) |
1220 | { | 1227 | { |
1228 | preempt_disable(); | ||
1221 | req->io_start_time_ns = sched_clock(); | 1229 | req->io_start_time_ns = sched_clock(); |
1230 | preempt_enable(); | ||
1222 | } | 1231 | } |
1223 | 1232 | ||
1224 | static inline uint64_t rq_start_time_ns(struct request *req) | 1233 | static inline uint64_t rq_start_time_ns(struct request *req) |