After the stack plugging introduction, these are called lockless.
Ensure that the counters are updated atomically.
Signed-off-by: Shaohua Li<shaohua.li@intel.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
        cpu = part_stat_lock();
        part_round_stats(cpu, &dm_disk(md)->part0);
        part_stat_unlock();
-       dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]);
+       atomic_set(&dm_disk(md)->part0.in_flight[rw],
+               atomic_inc_return(&md->pending[rw]));
 }
 
 static void end_io_acct(struct dm_io *io)
         * After this is decremented the bio must not be touched if it is
         * a flush.
         */
-       dm_disk(md)->part0.in_flight[rw] = pending =
-               atomic_dec_return(&md->pending[rw]);
+       pending = atomic_dec_return(&md->pending[rw]);
+       atomic_set(&dm_disk(md)->part0.in_flight[rw], pending);
        pending += atomic_read(&md->pending[rw^0x1]);
 
        /* nudge anyone waiting on suspend queue */
 
 {
        struct hd_struct *p = dev_to_part(dev);
 
-       return sprintf(buf, "%8u %8u\n", p->in_flight[0], p->in_flight[1]);
+       return sprintf(buf, "%8u %8u\n", atomic_read(&p->in_flight[0]),
+               atomic_read(&p->in_flight[1]));
 }
 
 #ifdef CONFIG_FAIL_MAKE_REQUEST
 
        int make_it_fail;
 #endif
        unsigned long stamp;
-       int in_flight[2];
+       atomic_t in_flight[2];
 #ifdef CONFIG_SMP
        struct disk_stats __percpu *dkstats;
 #else
 
 static inline void part_inc_in_flight(struct hd_struct *part, int rw)
 {
-       part->in_flight[rw]++;
+       atomic_inc(&part->in_flight[rw]);
        if (part->partno)
-               part_to_disk(part)->part0.in_flight[rw]++;
+               atomic_inc(&part_to_disk(part)->part0.in_flight[rw]);
 }
 
 static inline void part_dec_in_flight(struct hd_struct *part, int rw)
 {
-       part->in_flight[rw]--;
+       atomic_dec(&part->in_flight[rw]);
        if (part->partno)
-               part_to_disk(part)->part0.in_flight[rw]--;
+               atomic_dec(&part_to_disk(part)->part0.in_flight[rw]);
 }
 
 static inline int part_in_flight(struct hd_struct *part)
 {
-       return part->in_flight[0] + part->in_flight[1];
+       return atomic_read(&part->in_flight[0]) + atomic_read(&part->in_flight[1]);
 }
 
 static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)