|
@@ -230,7 +230,7 @@ CFQ_CFQQ_FNS(coop);
|
|
|
blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args)
|
|
|
|
|
|
static void cfq_dispatch_insert(struct request_queue *, struct request *);
|
|
|
-static struct cfq_queue *cfq_get_queue(struct cfq_data *, int,
|
|
|
+static struct cfq_queue *cfq_get_queue(struct cfq_data *, bool,
|
|
|
struct io_context *, gfp_t);
|
|
|
static struct cfq_io_context *cfq_cic_lookup(struct cfq_data *,
|
|
|
struct io_context *);
|
|
@@ -241,27 +241,24 @@ static inline int rq_in_driver(struct cfq_data *cfqd)
|
|
|
}
|
|
|
|
|
|
static inline struct cfq_queue *cic_to_cfqq(struct cfq_io_context *cic,
|
|
|
- int is_sync)
|
|
|
+ bool is_sync)
|
|
|
{
|
|
|
- return cic->cfqq[!!is_sync];
|
|
|
+ return cic->cfqq[is_sync];
|
|
|
}
|
|
|
|
|
|
static inline void cic_set_cfqq(struct cfq_io_context *cic,
|
|
|
- struct cfq_queue *cfqq, int is_sync)
|
|
|
+ struct cfq_queue *cfqq, bool is_sync)
|
|
|
{
|
|
|
- cic->cfqq[!!is_sync] = cfqq;
|
|
|
+ cic->cfqq[is_sync] = cfqq;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* We regard a request as SYNC, if it's either a read or has the SYNC bit
|
|
|
* set (in which case it could also be direct WRITE).
|
|
|
*/
|
|
|
-static inline int cfq_bio_sync(struct bio *bio)
|
|
|
+static inline bool cfq_bio_sync(struct bio *bio)
|
|
|
{
|
|
|
- if (bio_data_dir(bio) == READ || bio_rw_flagged(bio, BIO_RW_SYNCIO))
|
|
|
- return 1;
|
|
|
-
|
|
|
- return 0;
|
|
|
+ return bio_data_dir(bio) == READ || bio_rw_flagged(bio, BIO_RW_SYNCIO);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -288,7 +285,7 @@ static int cfq_queue_empty(struct request_queue *q)
|
|
|
* if a queue is marked sync and has sync io queued. A sync queue with async
|
|
|
* io only, should not get full sync slice length.
|
|
|
*/
|
|
|
-static inline int cfq_prio_slice(struct cfq_data *cfqd, int sync,
|
|
|
+static inline int cfq_prio_slice(struct cfq_data *cfqd, bool sync,
|
|
|
unsigned short prio)
|
|
|
{
|
|
|
const int base_slice = cfqd->cfq_slice[sync];
|
|
@@ -316,7 +313,7 @@ cfq_set_prio_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq)
|
|
|
* isn't valid until the first request from the dispatch is activated
|
|
|
* and the slice time set.
|
|
|
*/
|
|
|
-static inline int cfq_slice_used(struct cfq_queue *cfqq)
|
|
|
+static inline bool cfq_slice_used(struct cfq_queue *cfqq)
|
|
|
{
|
|
|
if (cfq_cfqq_slice_new(cfqq))
|
|
|
return 0;
|
|
@@ -491,7 +488,7 @@ static unsigned long cfq_slice_offset(struct cfq_data *cfqd,
|
|
|
* we will service the queues.
|
|
|
*/
|
|
|
static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
|
|
|
- int add_front)
|
|
|
+ bool add_front)
|
|
|
{
|
|
|
struct rb_node **p, *parent;
|
|
|
struct cfq_queue *__cfqq;
|
|
@@ -853,7 +850,7 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq,
|
|
|
* Disallow merge of a sync bio into an async request.
|
|
|
*/
|
|
|
if (cfq_bio_sync(bio) && !rq_is_sync(rq))
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
/*
|
|
|
* Lookup the cfqq that this bio will be queued with. Allow
|
|
@@ -861,13 +858,10 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq,
|
|
|
*/
|
|
|
cic = cfq_cic_lookup(cfqd, current->io_context);
|
|
|
if (!cic)
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio));
|
|
|
- if (cfqq == RQ_CFQQ(rq))
|
|
|
- return 1;
|
|
|
-
|
|
|
- return 0;
|
|
|
+ return cfqq == RQ_CFQQ(rq);
|
|
|
}
|
|
|
|
|
|
static void __cfq_set_active_queue(struct cfq_data *cfqd,
|
|
@@ -895,7 +889,7 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd,
|
|
|
*/
|
|
|
static void
|
|
|
__cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
|
|
|
- int timed_out)
|
|
|
+ bool timed_out)
|
|
|
{
|
|
|
cfq_log_cfqq(cfqd, cfqq, "slice expired t=%d", timed_out);
|
|
|
|
|
@@ -923,7 +917,7 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static inline void cfq_slice_expired(struct cfq_data *cfqd, int timed_out)
|
|
|
+static inline void cfq_slice_expired(struct cfq_data *cfqd, bool timed_out)
|
|
|
{
|
|
|
struct cfq_queue *cfqq = cfqd->active_queue;
|
|
|
|
|
@@ -1035,7 +1029,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
|
|
|
*/
|
|
|
static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd,
|
|
|
struct cfq_queue *cur_cfqq,
|
|
|
- int probe)
|
|
|
+ bool probe)
|
|
|
{
|
|
|
struct cfq_queue *cfqq;
|
|
|
|
|
@@ -1676,7 +1670,7 @@ static void cfq_ioc_set_ioprio(struct io_context *ioc)
|
|
|
}
|
|
|
|
|
|
static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
|
|
|
- pid_t pid, int is_sync)
|
|
|
+ pid_t pid, bool is_sync)
|
|
|
{
|
|
|
RB_CLEAR_NODE(&cfqq->rb_node);
|
|
|
RB_CLEAR_NODE(&cfqq->p_node);
|
|
@@ -1696,7 +1690,7 @@ static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
|
|
|
}
|
|
|
|
|
|
static struct cfq_queue *
|
|
|
-cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync,
|
|
|
+cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync,
|
|
|
struct io_context *ioc, gfp_t gfp_mask)
|
|
|
{
|
|
|
struct cfq_queue *cfqq, *new_cfqq = NULL;
|
|
@@ -1760,7 +1754,7 @@ cfq_async_queue_prio(struct cfq_data *cfqd, int ioprio_class, int ioprio)
|
|
|
}
|
|
|
|
|
|
static struct cfq_queue *
|
|
|
-cfq_get_queue(struct cfq_data *cfqd, int is_sync, struct io_context *ioc,
|
|
|
+cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct io_context *ioc,
|
|
|
gfp_t gfp_mask)
|
|
|
{
|
|
|
const int ioprio = task_ioprio(ioc);
|
|
@@ -2017,7 +2011,7 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
|
|
|
* Check if new_cfqq should preempt the currently active queue. Return 0 for
|
|
|
* no or if we aren't sure, a 1 will cause a preempt.
|
|
|
*/
|
|
|
-static int
|
|
|
+static bool
|
|
|
cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
|
|
|
struct request *rq)
|
|
|
{
|
|
@@ -2025,48 +2019,48 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
|
|
|
|
|
|
cfqq = cfqd->active_queue;
|
|
|
if (!cfqq)
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
if (cfq_slice_used(cfqq))
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
|
|
|
if (cfq_class_idle(new_cfqq))
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
if (cfq_class_idle(cfqq))
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
|
|
|
/*
|
|
|
* if the new request is sync, but the currently running queue is
|
|
|
* not, let the sync request have priority.
|
|
|
*/
|
|
|
if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq))
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
|
|
|
/*
|
|
|
* So both queues are sync. Let the new request get disk time if
|
|
|
* it's a metadata request and the current queue is doing regular IO.
|
|
|
*/
|
|
|
if (rq_is_meta(rq) && !cfqq->meta_pending)
|
|
|
- return 1;
|
|
|
+ return false;
|
|
|
|
|
|
/*
|
|
|
* Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
|
|
|
*/
|
|
|
if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
|
|
|
if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq))
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
/*
|
|
|
* if this request is as-good as one we would expect from the
|
|
|
* current cfqq, let it preempt
|
|
|
*/
|
|
|
if (cfq_rq_close(cfqd, rq))
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -2331,7 +2325,7 @@ cfq_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
|
|
|
struct cfq_data *cfqd = q->elevator->elevator_data;
|
|
|
struct cfq_io_context *cic;
|
|
|
const int rw = rq_data_dir(rq);
|
|
|
- const int is_sync = rq_is_sync(rq);
|
|
|
+ const bool is_sync = rq_is_sync(rq);
|
|
|
struct cfq_queue *cfqq;
|
|
|
unsigned long flags;
|
|
|
|