]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/md/dm-cache-target.c
Merge tag 'powerpc-4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[karo-tx-linux.git] / drivers / md / dm-cache-target.c
index d682a0511381aad0cadb7ab1f4eae9f815639aa1..c5ea03fc7ee1537914f222753b5018bf34e4a169 100644 (file)
@@ -119,7 +119,7 @@ static void iot_io_end(struct io_tracker *iot, sector_t len)
  */
 struct continuation {
        struct work_struct ws;
-       int input;
+       blk_status_t input;
 };
 
 static inline void init_continuation(struct continuation *k,
@@ -145,7 +145,7 @@ struct batcher {
        /*
         * The operation that everyone is waiting for.
         */
-       int (*commit_op)(void *context);
+       blk_status_t (*commit_op)(void *context);
        void *commit_context;
 
        /*
@@ -171,8 +171,7 @@ struct batcher {
 static void __commit(struct work_struct *_ws)
 {
        struct batcher *b = container_of(_ws, struct batcher, commit_work);
-
-       int r;
+       blk_status_t r;
        unsigned long flags;
        struct list_head work_items;
        struct work_struct *ws, *tmp;
@@ -205,7 +204,7 @@ static void __commit(struct work_struct *_ws)
 
        while ((bio = bio_list_pop(&bios))) {
                if (r) {
-                       bio->bi_error = r;
+                       bio->bi_status = r;
                        bio_endio(bio);
                } else
                        b->issue_op(bio, b->issue_context);
@@ -213,7 +212,7 @@ static void __commit(struct work_struct *_ws)
 }
 
 static void batcher_init(struct batcher *b,
-                        int (*commit_op)(void *),
+                        blk_status_t (*commit_op)(void *),
                         void *commit_context,
                         void (*issue_op)(struct bio *bio, void *),
                         void *issue_context,
@@ -955,7 +954,7 @@ static void writethrough_endio(struct bio *bio)
 
        dm_unhook_bio(&pb->hook_info, bio);
 
-       if (bio->bi_error) {
+       if (bio->bi_status) {
                bio_endio(bio);
                return;
        }
@@ -1220,7 +1219,7 @@ static void copy_complete(int read_err, unsigned long write_err, void *context)
        struct dm_cache_migration *mg = container_of(context, struct dm_cache_migration, k);
 
        if (read_err || write_err)
-               mg->k.input = -EIO;
+               mg->k.input = BLK_STS_IOERR;
 
        queue_continuation(mg->cache->wq, &mg->k);
 }
@@ -1266,8 +1265,8 @@ static void overwrite_endio(struct bio *bio)
 
        dm_unhook_bio(&pb->hook_info, bio);
 
-       if (bio->bi_error)
-               mg->k.input = bio->bi_error;
+       if (bio->bi_status)
+               mg->k.input = bio->bi_status;
 
        queue_continuation(mg->cache->wq, &mg->k);
 }
@@ -1323,8 +1322,10 @@ static void mg_complete(struct dm_cache_migration *mg, bool success)
                if (mg->overwrite_bio) {
                        if (success)
                                force_set_dirty(cache, cblock);
+                       else if (mg->k.input)
+                               mg->overwrite_bio->bi_status = mg->k.input;
                        else
-                               mg->overwrite_bio->bi_error = (mg->k.input ? : -EIO);
+                               mg->overwrite_bio->bi_status = BLK_STS_IOERR;
                        bio_endio(mg->overwrite_bio);
                } else {
                        if (success)
@@ -1504,7 +1505,7 @@ static void mg_copy(struct work_struct *ws)
                r = copy(mg, is_policy_promote);
                if (r) {
                        DMERR_LIMIT("%s: migration copy failed", cache_device_name(cache));
-                       mg->k.input = -EIO;
+                       mg->k.input = BLK_STS_IOERR;
                        mg_complete(mg, false);
                }
        }
@@ -1907,12 +1908,12 @@ static int commit(struct cache *cache, bool clean_shutdown)
 /*
  * Used by the batcher.
  */
-static int commit_op(void *context)
+static blk_status_t commit_op(void *context)
 {
        struct cache *cache = context;
 
        if (dm_cache_changed_this_transaction(cache->cmd))
-               return commit(cache, false);
+               return errno_to_blk_status(commit(cache, false));
 
        return 0;
 }
@@ -2018,7 +2019,7 @@ static void requeue_deferred_bios(struct cache *cache)
        bio_list_init(&cache->deferred_bios);
 
        while ((bio = bio_list_pop(&bios))) {
-               bio->bi_error = DM_ENDIO_REQUEUE;
+               bio->bi_status = BLK_STS_DM_REQUEUE;
                bio_endio(bio);
        }
 }
@@ -2820,7 +2821,8 @@ static int cache_map(struct dm_target *ti, struct bio *bio)
        return r;
 }
 
-static int cache_end_io(struct dm_target *ti, struct bio *bio, int error)
+static int cache_end_io(struct dm_target *ti, struct bio *bio,
+               blk_status_t *error)
 {
        struct cache *cache = ti->private;
        unsigned long flags;
@@ -2838,7 +2840,7 @@ static int cache_end_io(struct dm_target *ti, struct bio *bio, int error)
        bio_drop_shared_lock(cache, bio);
        accounted_complete(cache, bio);
 
-       return 0;
+       return DM_ENDIO_DONE;
 }
 
 static int write_dirty_bitset(struct cache *cache)