Merge tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / block / cfq-iosched.c
index 3f31cf9508e6204c144c2b665fb90aa67df3c9a2..5da8e6e9ab4bfd72c76d5afa94a823ee0032f45b 100644 (file)
@@ -299,7 +299,7 @@ struct cfq_io_cq {
        struct cfq_ttime        ttime;
        int                     ioprio;         /* the current ioprio */
 #ifdef CONFIG_CFQ_GROUP_IOSCHED
-       uint64_t                blkcg_id;       /* the current blkcg ID */
+       uint64_t                blkcg_serial_nr; /* the current blkcg serial */
 #endif
 };
 
@@ -3547,17 +3547,17 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
 {
        struct cfq_data *cfqd = cic_to_cfqd(cic);
        struct cfq_queue *sync_cfqq;
-       uint64_t id;
+       uint64_t serial_nr;
 
        rcu_read_lock();
-       id = bio_blkcg(bio)->id;
+       serial_nr = bio_blkcg(bio)->css.serial_nr;
        rcu_read_unlock();
 
        /*
         * Check whether blkcg has changed.  The condition may trigger
         * spuriously on a newly created cic but there's no harm.
         */
-       if (unlikely(!cfqd) || likely(cic->blkcg_id == id))
+       if (unlikely(!cfqd) || likely(cic->blkcg_serial_nr == serial_nr))
                return;
 
        sync_cfqq = cic_to_cfqq(cic, 1);
@@ -3571,7 +3571,7 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
                cfq_put_queue(sync_cfqq);
        }
 
-       cic->blkcg_id = id;
+       cic->blkcg_serial_nr = serial_nr;
 }
 #else
 static inline void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) { }
@@ -3590,6 +3590,11 @@ retry:
 
        blkcg = bio_blkcg(bio);
        cfqg = cfq_lookup_create_cfqg(cfqd, blkcg);
+       if (!cfqg) {
+               cfqq = &cfqd->oom_cfqq;
+               goto out;
+       }
+
        cfqq = cic_to_cfqq(cic, is_sync);
 
        /*
@@ -3626,7 +3631,7 @@ retry:
                } else
                        cfqq = &cfqd->oom_cfqq;
        }
-
+out:
        if (new_cfqq)
                kmem_cache_free(cfq_pool, new_cfqq);
 
@@ -3656,12 +3661,17 @@ static struct cfq_queue *
 cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
              struct bio *bio, gfp_t gfp_mask)
 {
-       const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
-       const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);
+       int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
+       int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);
        struct cfq_queue **async_cfqq = NULL;
        struct cfq_queue *cfqq = NULL;
 
        if (!is_sync) {
+               if (!ioprio_valid(cic->ioprio)) {
+                       struct task_struct *tsk = current;
+                       ioprio = task_nice_ioprio(tsk);
+                       ioprio_class = task_nice_ioclass(tsk);
+               }
                async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class, ioprio);
                cfqq = *async_cfqq;
        }
This page took 0.025912 seconds and 5 git commands to generate.