]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dm kcopyd: return void from dm_kcopyd_copy()
authorMike Snitzer <snitzer@redhat.com>
Tue, 31 Jul 2018 21:27:02 +0000 (17:27 -0400)
committerMike Snitzer <snitzer@redhat.com>
Tue, 31 Jul 2018 21:33:21 +0000 (17:33 -0400)
dm_kcopyd_copy() only ever returns 0 so there is no need for callers to
account for possible failure.  Same goes for dm_kcopyd_zero().

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-cache-target.c
drivers/md/dm-kcopyd.c
drivers/md/dm-raid1.c
drivers/md/dm-thin.c
drivers/md/dm-zoned-reclaim.c
include/linux/dm-kcopyd.h

index 44df244807e5a0ae0aa8db3d0962827623711780..a534133717254a88eb91e025c7731e408fbbdfad 100644 (file)
@@ -1188,9 +1188,8 @@ static void copy_complete(int read_err, unsigned long write_err, void *context)
        queue_continuation(mg->cache->wq, &mg->k);
 }
 
-static int copy(struct dm_cache_migration *mg, bool promote)
+static void copy(struct dm_cache_migration *mg, bool promote)
 {
-       int r;
        struct dm_io_region o_region, c_region;
        struct cache *cache = mg->cache;
 
@@ -1203,11 +1202,9 @@ static int copy(struct dm_cache_migration *mg, bool promote)
        c_region.count = cache->sectors_per_block;
 
        if (promote)
-               r = dm_kcopyd_copy(cache->copier, &o_region, 1, &c_region, 0, copy_complete, &mg->k);
+               dm_kcopyd_copy(cache->copier, &o_region, 1, &c_region, 0, copy_complete, &mg->k);
        else
-               r = dm_kcopyd_copy(cache->copier, &c_region, 1, &o_region, 0, copy_complete, &mg->k);
-
-       return r;
+               dm_kcopyd_copy(cache->copier, &c_region, 1, &o_region, 0, copy_complete, &mg->k);
 }
 
 static void bio_drop_shared_lock(struct cache *cache, struct bio *bio)
@@ -1449,12 +1446,7 @@ static void mg_full_copy(struct work_struct *ws)
        }
 
        init_continuation(&mg->k, mg_upgrade_lock);
-
-       if (copy(mg, is_policy_promote)) {
-               DMERR_LIMIT("%s: migration copy failed", cache_device_name(cache));
-               mg->k.input = BLK_STS_IOERR;
-               mg_complete(mg, false);
-       }
+       copy(mg, is_policy_promote);
 }
 
 static void mg_copy(struct work_struct *ws)
index 3c7547a3c3715f38ed7fa3e265ed5dea8f6183d0..cc101f3ec42c9119228abd9ec382b0290beb8715 100644 (file)
@@ -741,9 +741,9 @@ static void split_job(struct kcopyd_job *master_job)
        }
 }
 
-int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
-                  unsigned int num_dests, struct dm_io_region *dests,
-                  unsigned int flags, dm_kcopyd_notify_fn fn, void *context)
+void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
+                   unsigned int num_dests, struct dm_io_region *dests,
+                   unsigned int flags, dm_kcopyd_notify_fn fn, void *context)
 {
        struct kcopyd_job *job;
        int i;
@@ -818,16 +818,14 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
                job->progress = 0;
                split_job(job);
        }
-
-       return 0;
 }
 EXPORT_SYMBOL(dm_kcopyd_copy);
 
-int dm_kcopyd_zero(struct dm_kcopyd_client *kc,
-                  unsigned num_dests, struct dm_io_region *dests,
-                  unsigned flags, dm_kcopyd_notify_fn fn, void *context)
+void dm_kcopyd_zero(struct dm_kcopyd_client *kc,
+                   unsigned num_dests, struct dm_io_region *dests,
+                   unsigned flags, dm_kcopyd_notify_fn fn, void *context)
 {
-       return dm_kcopyd_copy(kc, NULL, num_dests, dests, flags, fn, context);
+       dm_kcopyd_copy(kc, NULL, num_dests, dests, flags, fn, context);
 }
 EXPORT_SYMBOL(dm_kcopyd_zero);
 
index 5903e492bb34a307deee617726d91464d7e3d462..79eab1071ec22ba73458cc99c5841de30f2105b0 100644 (file)
@@ -326,9 +326,8 @@ static void recovery_complete(int read_err, unsigned long write_err,
        dm_rh_recovery_end(reg, !(read_err || write_err));
 }
 
-static int recover(struct mirror_set *ms, struct dm_region *reg)
+static void recover(struct mirror_set *ms, struct dm_region *reg)
 {
-       int r;
        unsigned i;
        struct dm_io_region from, to[DM_KCOPYD_MAX_REGIONS], *dest;
        struct mirror *m;
@@ -367,10 +366,8 @@ static int recover(struct mirror_set *ms, struct dm_region *reg)
        if (!errors_handled(ms))
                set_bit(DM_KCOPYD_IGNORE_ERROR, &flags);
 
-       r = dm_kcopyd_copy(ms->kcopyd_client, &from, ms->nr_mirrors - 1, to,
-                          flags, recovery_complete, reg);
-
-       return r;
+       dm_kcopyd_copy(ms->kcopyd_client, &from, ms->nr_mirrors - 1, to,
+                      flags, recovery_complete, reg);
 }
 
 static void reset_ms_flags(struct mirror_set *ms)
@@ -388,7 +385,6 @@ static void do_recovery(struct mirror_set *ms)
 {
        struct dm_region *reg;
        struct dm_dirty_log *log = dm_rh_dirty_log(ms->rh);
-       int r;
 
        /*
         * Start quiescing some regions.
@@ -398,11 +394,8 @@ static void do_recovery(struct mirror_set *ms)
        /*
         * Copy any already quiesced regions.
         */
-       while ((reg = dm_rh_recovery_start(ms->rh))) {
-               r = recover(ms, reg);
-               if (r)
-                       dm_rh_recovery_end(reg, 0);
-       }
+       while ((reg = dm_rh_recovery_start(ms->rh)))
+               recover(ms, reg);
 
        /*
         * Update the in sync flag.
index c44477d7a9ea769200c4ab7a3df04eab9cef37a5..5997d6808b57adfa1e71368ef658adc23c7bb3c9 100644 (file)
@@ -1220,18 +1220,13 @@ static struct dm_thin_new_mapping *get_next_mapping(struct pool *pool)
 static void ll_zero(struct thin_c *tc, struct dm_thin_new_mapping *m,
                    sector_t begin, sector_t end)
 {
-       int r;
        struct dm_io_region to;
 
        to.bdev = tc->pool_dev->bdev;
        to.sector = begin;
        to.count = end - begin;
 
-       r = dm_kcopyd_zero(tc->pool->copier, 1, &to, 0, copy_complete, m);
-       if (r < 0) {
-               DMERR_LIMIT("dm_kcopyd_zero() failed");
-               copy_complete(1, 1, m);
-       }
+       dm_kcopyd_zero(tc->pool->copier, 1, &to, 0, copy_complete, m);
 }
 
 static void remap_and_issue_overwrite(struct thin_c *tc, struct bio *bio,
@@ -1257,7 +1252,6 @@ static void schedule_copy(struct thin_c *tc, dm_block_t virt_block,
                          struct dm_bio_prison_cell *cell, struct bio *bio,
                          sector_t len)
 {
-       int r;
        struct pool *pool = tc->pool;
        struct dm_thin_new_mapping *m = get_next_mapping(pool);
 
@@ -1296,19 +1290,8 @@ static void schedule_copy(struct thin_c *tc, dm_block_t virt_block,
                to.sector = data_dest * pool->sectors_per_block;
                to.count = len;
 
-               r = dm_kcopyd_copy(pool->copier, &from, 1, &to,
-                                  0, copy_complete, m);
-               if (r < 0) {
-                       DMERR_LIMIT("dm_kcopyd_copy() failed");
-                       copy_complete(1, 1, m);
-
-                       /*
-                        * We allow the zero to be issued, to simplify the
-                        * error path.  Otherwise we'd need to start
-                        * worrying about decrementing the prepare_actions
-                        * counter.
-                        */
-               }
+               dm_kcopyd_copy(pool->copier, &from, 1, &to,
+                              0, copy_complete, m);
 
                /*
                 * Do we need to zero a tail region?
index 44a119e12f1abd8eb5b4e4ae15689c83a9502536..edf4b95eb0750dc6485513d49c240b2982017114 100644 (file)
@@ -161,10 +161,8 @@ static int dmz_reclaim_copy(struct dmz_reclaim *zrc,
 
                /* Copy the valid region */
                set_bit(DMZ_RECLAIM_KCOPY, &zrc->flags);
-               ret = dm_kcopyd_copy(zrc->kc, &src, 1, &dst, flags,
-                                    dmz_reclaim_kcopy_end, zrc);
-               if (ret)
-                       return ret;
+               dm_kcopyd_copy(zrc->kc, &src, 1, &dst, flags,
+                              dmz_reclaim_kcopy_end, zrc);
 
                /* Wait for copy to complete */
                wait_on_bit_io(&zrc->flags, DMZ_RECLAIM_KCOPY,
index cfac8588ed56d84f2bf1047bfdaa6837873fc930..e42de7750c884ec6f7c56e250db963bbc154d9f9 100644 (file)
@@ -62,9 +62,9 @@ void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
 typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err,
                                    void *context);
 
-int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
-                  unsigned num_dests, struct dm_io_region *dests,
-                  unsigned flags, dm_kcopyd_notify_fn fn, void *context);
+void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
+                   unsigned num_dests, struct dm_io_region *dests,
+                   unsigned flags, dm_kcopyd_notify_fn fn, void *context);
 
 /*
  * Prepare a callback and submit it via the kcopyd thread.
@@ -81,9 +81,9 @@ void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc,
                                 dm_kcopyd_notify_fn fn, void *context);
 void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err);
 
-int dm_kcopyd_zero(struct dm_kcopyd_client *kc,
-                  unsigned num_dests, struct dm_io_region *dests,
-                  unsigned flags, dm_kcopyd_notify_fn fn, void *context);
+void dm_kcopyd_zero(struct dm_kcopyd_client *kc,
+                   unsigned num_dests, struct dm_io_region *dests,
+                   unsigned flags, dm_kcopyd_notify_fn fn, void *context);
 
 #endif /* __KERNEL__ */
 #endif /* _LINUX_DM_KCOPYD_H */