struct io_context *io_context; /* The submitting task */
- unsigned int is_sync;
enum arq_state state;
};
aic = arq->io_context->aic;
- if (arq->is_sync == REQ_SYNC && aic) {
+ if (rq_is_sync(arq->request) && aic) {
spin_lock(&aic->lock);
set_bit(AS_TASK_IORUNNING, &aic->state);
aic->last_end_request = jiffies;
/*
* rb tree support functions
*/
-#define ARQ_RB_ROOT(ad, arq) (&(ad)->sort_list[(arq)->is_sync])
+#define RQ_RB_ROOT(ad, rq) (&(ad)->sort_list[rq_is_sync((rq))])
static void as_add_arq_rb(struct as_data *ad, struct request *rq)
{
- struct as_rq *arq = RQ_DATA(rq);
struct request *alias;
- while ((unlikely(alias = elv_rb_add(ARQ_RB_ROOT(ad, arq), rq)))) {
+ while ((unlikely(alias = elv_rb_add(RQ_RB_ROOT(ad, rq), rq)))) {
as_move_to_dispatch(ad, RQ_DATA(alias));
as_antic_stop(ad);
}
static inline void as_del_arq_rb(struct as_data *ad, struct request *rq)
{
- elv_rb_del(ARQ_RB_ROOT(ad, RQ_DATA(rq)), rq);
+ elv_rb_del(RQ_RB_ROOT(ad, rq), rq);
}
/*
if (arq2 == NULL)
return arq1;
- data_dir = arq1->is_sync;
+ data_dir = rq_is_sync(arq1->request);
last = ad->last_sector[data_dir];
s1 = arq1->request->sector;
s2 = arq2->request->sector;
- BUG_ON(data_dir != arq2->is_sync);
+ BUG_ON(data_dir != rq_is_sync(arq2->request));
/*
* Strict one way elevator _except_ in the case where we allow
if (rbnext)
next = RQ_DATA(rb_entry_rq(rbnext));
else {
- const int data_dir = arq->is_sync;
+ const int data_dir = rq_is_sync(last);
rbnext = rb_first(&ad->sort_list[data_dir]);
if (rbnext && rbnext != &last->rb_node)
static void as_update_iohist(struct as_data *ad, struct as_io_context *aic,
struct request *rq)
{
- struct as_rq *arq = RQ_DATA(rq);
- int data_dir = arq->is_sync;
+ int data_dir = rq_is_sync(rq);
unsigned long thinktime = 0;
sector_t seek_dist;
return 1;
}
- if (arq && arq->is_sync == REQ_SYNC && as_close_req(ad, aic, arq)) {
+ if (arq && rq_is_sync(arq->request) && as_close_req(ad, aic, arq)) {
/*
* Found a close request that is not one of ours.
*
*/
static void as_update_arq(struct as_data *ad, struct as_rq *arq)
{
- const int data_dir = arq->is_sync;
+ const int data_dir = rq_is_sync(arq->request);
/* keep the next_arq cache up to date */
ad->next_arq[data_dir] = as_choose_req(ad, arq, ad->next_arq[data_dir]);
* actually serviced. This should help devices with big TCQ windows
* and writeback caches
*/
- if (ad->new_batch && ad->batch_data_dir == arq->is_sync) {
+ if (ad->new_batch && ad->batch_data_dir == rq_is_sync(rq)) {
update_write_batch(ad);
ad->current_batch_expires = jiffies +
ad->batch_expire[REQ_SYNC];
static void as_remove_queued_request(request_queue_t *q, struct request *rq)
{
struct as_rq *arq = RQ_DATA(rq);
- const int data_dir = arq->is_sync;
+ const int data_dir = rq_is_sync(rq);
struct as_data *ad = q->elevator->elevator_data;
WARN_ON(arq->state != AS_RQ_QUEUED);
static void as_move_to_dispatch(struct as_data *ad, struct as_rq *arq)
{
struct request *rq = arq->request;
- const int data_dir = arq->is_sync;
+ const int data_dir = rq_is_sync(rq);
BUG_ON(RB_EMPTY_NODE(&rq->rb_node));
arq->state = AS_RQ_NEW;
- if (rq_data_dir(arq->request) == READ
- || (arq->request->cmd_flags & REQ_RW_SYNC))
- arq->is_sync = 1;
- else
- arq->is_sync = 0;
- data_dir = arq->is_sync;
+ data_dir = rq_is_sync(rq);
arq->io_context = as_get_io_context();