dm: rename request variables to bios
authorAlasdair G Kergon <agk@redhat.com>
Fri, 1 Mar 2013 22:45:47 +0000 (22:45 +0000)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 1 Mar 2013 22:45:47 +0000 (22:45 +0000)
Use 'bio' in the name of variables and functions that deal with
bios rather than 'request' to avoid confusion with the normal
block layer use of 'request'.

No functional changes.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
15 files changed:
drivers/md/dm-crypt.c
drivers/md/dm-delay.c
drivers/md/dm-flakey.c
drivers/md/dm-linear.c
drivers/md/dm-mpath.c
drivers/md/dm-raid.c
drivers/md/dm-raid1.c
drivers/md/dm-snap.c
drivers/md/dm-stripe.c
drivers/md/dm-table.c
drivers/md/dm-target.c
drivers/md/dm-thin.c
drivers/md/dm-zero.c
drivers/md/dm.c
include/linux/device-mapper.h

index 2ae151e59c0ce9425de217d32fed9e2e8e528ca3..13c15480d9401a79ea41fb44c603a007d97e2ea1 100644 (file)
@@ -1637,7 +1637,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 
                if (opt_params == 1 && opt_string &&
                    !strcasecmp(opt_string, "allow_discards"))
-                       ti->num_discard_requests = 1;
+                       ti->num_discard_bios = 1;
                else if (opt_params) {
                        ret = -EINVAL;
                        ti->error = "Invalid feature arguments";
@@ -1665,7 +1665,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
                goto bad;
        }
 
-       ti->num_flush_requests = 1;
+       ti->num_flush_bios = 1;
        ti->discard_zeroes_data_unsupported = true;
 
        return 0;
@@ -1726,7 +1726,7 @@ static void crypt_status(struct dm_target *ti, status_type_t type,
                DMEMIT(" %llu %s %llu", (unsigned long long)cc->iv_offset,
                                cc->dev->name, (unsigned long long)cc->start);
 
-               if (ti->num_discard_requests)
+               if (ti->num_discard_bios)
                        DMEMIT(" 1 allow_discards");
 
                break;
index c0d03b006e40fdeb11bf6cef0fa159f09399d89a..496d5f3646a5df623e6c0a9b22d35ad003c610bc 100644 (file)
@@ -198,8 +198,8 @@ out:
        mutex_init(&dc->timer_lock);
        atomic_set(&dc->may_delay, 1);
 
-       ti->num_flush_requests = 1;
-       ti->num_discard_requests = 1;
+       ti->num_flush_bios = 1;
+       ti->num_discard_bios = 1;
        ti->private = dc;
        return 0;
 
index 5d6c04cceee0e5b56f89b949a9e8e267b2640389..7fcf21cb4ff869dd636c91ffe2f8248f0a1d17c7 100644 (file)
@@ -216,8 +216,8 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
                goto bad;
        }
 
-       ti->num_flush_requests = 1;
-       ti->num_discard_requests = 1;
+       ti->num_flush_bios = 1;
+       ti->num_discard_bios = 1;
        ti->per_bio_data_size = sizeof(struct per_bio_data);
        ti->private = fc;
        return 0;
index 5be301c1e8092b7a2fd181752ee810cc3b3f6bae..4f99d267340cdb48c3a7b64edcdd4ed9a7fd48ea 100644 (file)
@@ -53,9 +53,9 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv)
                goto bad;
        }
 
-       ti->num_flush_requests = 1;
-       ti->num_discard_requests = 1;
-       ti->num_write_same_requests = 1;
+       ti->num_flush_bios = 1;
+       ti->num_discard_bios = 1;
+       ti->num_write_same_bios = 1;
        ti->private = lc;
        return 0;
 
index d267bb5705e9348b5af30cb8e0699690098738cd..51bb81676be37d2ff4520557c70f83bda488845a 100644 (file)
@@ -905,8 +905,8 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
                goto bad;
        }
 
-       ti->num_flush_requests = 1;
-       ti->num_discard_requests = 1;
+       ti->num_flush_bios = 1;
+       ti->num_discard_bios = 1;
 
        return 0;
 
index 5a578d89da2d8f0cd292b80d65e2f9d8f5671a8c..9a01d1e4c78302a0fef677e2c516f2bf3daeca70 100644 (file)
@@ -1151,7 +1151,7 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
 
        INIT_WORK(&rs->md.event_work, do_table_event);
        ti->private = rs;
-       ti->num_flush_requests = 1;
+       ti->num_flush_bios = 1;
 
        mutex_lock(&rs->md.reconfig_mutex);
        ret = md_run(&rs->md);
index 7f2419099b50a8b8260f98ef7bc17ac22b1ab9e4..e2ea97723e109c7e7ec6122b5dd04ad02b3c8b38 100644 (file)
@@ -1072,8 +1072,8 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        if (r)
                goto err_free_context;
 
-       ti->num_flush_requests = 1;
-       ti->num_discard_requests = 1;
+       ti->num_flush_bios = 1;
+       ti->num_discard_bios = 1;
        ti->per_bio_data_size = sizeof(struct dm_raid1_bio_record);
        ti->discard_zeroes_data_unsupported = true;
 
index 6e45e3774eaba67435c4b26e428845a008c83627..5d78027e07ac2a842d901187c6ed2375ac8a6a25 100644 (file)
@@ -1037,7 +1037,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        int i;
        int r = -EINVAL;
        char *origin_path, *cow_path;
-       unsigned args_used, num_flush_requests = 1;
+       unsigned args_used, num_flush_bios = 1;
        fmode_t origin_mode = FMODE_READ;
 
        if (argc != 4) {
@@ -1047,7 +1047,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        }
 
        if (dm_target_is_snapshot_merge(ti)) {
-               num_flush_requests = 2;
+               num_flush_bios = 2;
                origin_mode = FMODE_WRITE;
        }
 
@@ -1127,7 +1127,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        spin_lock_init(&s->tracked_chunk_lock);
 
        ti->private = s;
-       ti->num_flush_requests = num_flush_requests;
+       ti->num_flush_bios = num_flush_bios;
        ti->per_bio_data_size = sizeof(struct dm_snap_tracked_chunk);
 
        /* Add snapshot to the list of snapshots for this origin */
@@ -1691,7 +1691,7 @@ static int snapshot_merge_map(struct dm_target *ti, struct bio *bio)
        init_tracked_chunk(bio);
 
        if (bio->bi_rw & REQ_FLUSH) {
-               if (!dm_bio_get_target_request_nr(bio))
+               if (!dm_bio_get_target_bio_nr(bio))
                        bio->bi_bdev = s->origin->bdev;
                else
                        bio->bi_bdev = s->cow->bdev;
@@ -2102,7 +2102,7 @@ static int origin_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        }
 
        ti->private = dev;
-       ti->num_flush_requests = 1;
+       ti->num_flush_bios = 1;
 
        return 0;
 }
index aaecefa63935c2d1a081e75efdd9c762df61ba36..d8837d313f5434183439f057f463c99be100e0ea 100644 (file)
@@ -160,9 +160,9 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        if (r)
                return r;
 
-       ti->num_flush_requests = stripes;
-       ti->num_discard_requests = stripes;
-       ti->num_write_same_requests = stripes;
+       ti->num_flush_bios = stripes;
+       ti->num_discard_bios = stripes;
+       ti->num_write_same_bios = stripes;
 
        sc->chunk_size = chunk_size;
        if (chunk_size & (chunk_size - 1))
@@ -276,19 +276,19 @@ static int stripe_map(struct dm_target *ti, struct bio *bio)
 {
        struct stripe_c *sc = ti->private;
        uint32_t stripe;
-       unsigned target_request_nr;
+       unsigned target_bio_nr;
 
        if (bio->bi_rw & REQ_FLUSH) {
-               target_request_nr = dm_bio_get_target_request_nr(bio);
-               BUG_ON(target_request_nr >= sc->stripes);
-               bio->bi_bdev = sc->stripe[target_request_nr].dev->bdev;
+               target_bio_nr = dm_bio_get_target_bio_nr(bio);
+               BUG_ON(target_bio_nr >= sc->stripes);
+               bio->bi_bdev = sc->stripe[target_bio_nr].dev->bdev;
                return DM_MAPIO_REMAPPED;
        }
        if (unlikely(bio->bi_rw & REQ_DISCARD) ||
            unlikely(bio->bi_rw & REQ_WRITE_SAME)) {
-               target_request_nr = dm_bio_get_target_request_nr(bio);
-               BUG_ON(target_request_nr >= sc->stripes);
-               return stripe_map_range(sc, bio, target_request_nr);
+               target_bio_nr = dm_bio_get_target_bio_nr(bio);
+               BUG_ON(target_bio_nr >= sc->stripes);
+               return stripe_map_range(sc, bio, target_bio_nr);
        }
 
        stripe_map_sector(sc, bio->bi_sector, &stripe, &bio->bi_sector);
index c95405d04726630ddfcd227781333c5dbbe8a956..e50dad0c65f4759d535b5cf81b0258a3b27066b5 100644 (file)
@@ -822,8 +822,8 @@ int dm_table_add_target(struct dm_table *t, const char *type,
 
        t->highs[t->num_targets++] = tgt->begin + tgt->len - 1;
 
-       if (!tgt->num_discard_requests && tgt->discards_supported)
-               DMWARN("%s: %s: ignoring discards_supported because num_discard_requests is zero.",
+       if (!tgt->num_discard_bios && tgt->discards_supported)
+               DMWARN("%s: %s: ignoring discards_supported because num_discard_bios is zero.",
                       dm_device_name(t->md), type);
 
        return 0;
@@ -1359,7 +1359,7 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned flush)
        while (i < dm_table_get_num_targets(t)) {
                ti = dm_table_get_target(t, i++);
 
-               if (!ti->num_flush_requests)
+               if (!ti->num_flush_bios)
                        continue;
 
                if (ti->flush_supported)
@@ -1438,7 +1438,7 @@ static bool dm_table_supports_write_same(struct dm_table *t)
        while (i < dm_table_get_num_targets(t)) {
                ti = dm_table_get_target(t, i++);
 
-               if (!ti->num_write_same_requests)
+               if (!ti->num_write_same_bios)
                        return false;
 
                if (!ti->type->iterate_devices ||
@@ -1656,7 +1656,7 @@ bool dm_table_supports_discards(struct dm_table *t)
        while (i < dm_table_get_num_targets(t)) {
                ti = dm_table_get_target(t, i++);
 
-               if (!ti->num_discard_requests)
+               if (!ti->num_discard_bios)
                        continue;
 
                if (ti->discards_supported)
index 617d21a772568dad424aa1b49cb0a53de980b775..37ba5db71cd9b2f3c16c0e64e67b109401c5903d 100644 (file)
@@ -116,7 +116,7 @@ static int io_err_ctr(struct dm_target *tt, unsigned int argc, char **args)
        /*
         * Return error for discards instead of -EOPNOTSUPP
         */
-       tt->num_discard_requests = 1;
+       tt->num_discard_bios = 1;
 
        return 0;
 }
index 088f6b34f599fbef57db7cfa9b4cc35f51058eab..303e11da7c2a5e5af1f3761efd99bdb1deea4569 100644 (file)
@@ -1944,7 +1944,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
        pt->data_dev = data_dev;
        pt->low_water_blocks = low_water_blocks;
        pt->adjusted_pf = pt->requested_pf = pf;
-       ti->num_flush_requests = 1;
+       ti->num_flush_bios = 1;
 
        /*
         * Only need to enable discards if the pool should pass
@@ -1952,7 +1952,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
         * processing will cause mappings to be removed from the btree.
         */
        if (pf.discard_enabled && pf.discard_passdown) {
-               ti->num_discard_requests = 1;
+               ti->num_discard_bios = 1;
 
                /*
                 * Setting 'discards_supported' circumvents the normal
@@ -2593,17 +2593,17 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv)
        if (r)
                goto bad_thin_open;
 
-       ti->num_flush_requests = 1;
+       ti->num_flush_bios = 1;
        ti->flush_supported = true;
        ti->per_bio_data_size = sizeof(struct dm_thin_endio_hook);
 
        /* In case the pool supports discards, pass them on. */
        if (tc->pool->pf.discard_enabled) {
                ti->discards_supported = true;
-               ti->num_discard_requests = 1;
+               ti->num_discard_bios = 1;
                ti->discard_zeroes_data_unsupported = true;
-               /* Discard requests must be split on a block boundary */
-               ti->split_discard_requests = true;
+               /* Discard bios must be split on a block boundary */
+               ti->split_discard_bios = true;
        }
 
        dm_put(pool_md);
index 69a5c3b3b340cad4e58997955c13c8b56c7135de..c99003e0d47a7f2e58d6d3bf0aefe5bc0785f2e8 100644 (file)
@@ -25,7 +25,7 @@ static int zero_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        /*
         * Silently drop discards, avoiding -EOPNOTSUPP.
         */
-       ti->num_discard_requests = 1;
+       ti->num_discard_bios = 1;
 
        return 0;
 }
index 4521d72637c213e1441bf23aac47071508415efa..caef71befc43e4cefc6439e38ecd9f778bf5852f 100644 (file)
@@ -1103,7 +1103,7 @@ static void clone_bio(struct dm_target_io *tio, struct bio *bio,
 
 static struct dm_target_io *alloc_tio(struct clone_info *ci,
                                      struct dm_target *ti, int nr_iovecs,
-                                     unsigned target_request_nr)
+                                     unsigned target_bio_nr)
 {
        struct dm_target_io *tio;
        struct bio *clone;
@@ -1114,15 +1114,15 @@ static struct dm_target_io *alloc_tio(struct clone_info *ci,
        tio->io = ci->io;
        tio->ti = ti;
        memset(&tio->info, 0, sizeof(tio->info));
-       tio->target_request_nr = target_request_nr;
+       tio->target_bio_nr = target_bio_nr;
 
        return tio;
 }
 
 static void __issue_target_request(struct clone_info *ci, struct dm_target *ti,
-                                  unsigned request_nr, sector_t len)
+                                  unsigned target_bio_nr, sector_t len)
 {
-       struct dm_target_io *tio = alloc_tio(ci, ti, ci->bio->bi_max_vecs, request_nr);
+       struct dm_target_io *tio = alloc_tio(ci, ti, ci->bio->bi_max_vecs, target_bio_nr);
        struct bio *clone = &tio->clone;
 
        /*
@@ -1137,13 +1137,13 @@ static void __issue_target_request(struct clone_info *ci, struct dm_target *ti,
        __map_bio(tio);
 }
 
-static void __issue_target_requests(struct clone_info *ci, struct dm_target *ti,
-                                   unsigned num_requests, sector_t len)
+static void __issue_target_bios(struct clone_info *ci, struct dm_target *ti,
+                               unsigned num_bios, sector_t len)
 {
-       unsigned request_nr;
+       unsigned target_bio_nr;
 
-       for (request_nr = 0; request_nr < num_requests; request_nr++)
-               __issue_target_request(ci, ti, request_nr, len);
+       for (target_bio_nr = 0; target_bio_nr < num_bios; target_bio_nr++)
+               __issue_target_request(ci, ti, target_bio_nr, len);
 }
 
 static int __clone_and_map_empty_flush(struct clone_info *ci)
@@ -1153,7 +1153,7 @@ static int __clone_and_map_empty_flush(struct clone_info *ci)
 
        BUG_ON(bio_has_data(ci->bio));
        while ((ti = dm_table_get_target(ci->map, target_nr++)))
-               __issue_target_requests(ci, ti, ti->num_flush_requests, 0);
+               __issue_target_bios(ci, ti, ti->num_flush_bios, 0);
 
        return 0;
 }
@@ -1173,32 +1173,32 @@ static void __clone_and_map_simple(struct clone_info *ci, struct dm_target *ti)
        ci->sector_count = 0;
 }
 
-typedef unsigned (*get_num_requests_fn)(struct dm_target *ti);
+typedef unsigned (*get_num_bios_fn)(struct dm_target *ti);
 
-static unsigned get_num_discard_requests(struct dm_target *ti)
+static unsigned get_num_discard_bios(struct dm_target *ti)
 {
-       return ti->num_discard_requests;
+       return ti->num_discard_bios;
 }
 
-static unsigned get_num_write_same_requests(struct dm_target *ti)
+static unsigned get_num_write_same_bios(struct dm_target *ti)
 {
-       return ti->num_write_same_requests;
+       return ti->num_write_same_bios;
 }
 
 typedef bool (*is_split_required_fn)(struct dm_target *ti);
 
 static bool is_split_required_for_discard(struct dm_target *ti)
 {
-       return ti->split_discard_requests;
+       return ti->split_discard_bios;
 }
 
 static int __clone_and_map_changing_extent_only(struct clone_info *ci,
-                                               get_num_requests_fn get_num_requests,
+                                               get_num_bios_fn get_num_bios,
                                                is_split_required_fn is_split_required)
 {
        struct dm_target *ti;
        sector_t len;
-       unsigned num_requests;
+       unsigned num_bios;
 
        do {
                ti = dm_table_find_target(ci->map, ci->sector);
@@ -1211,8 +1211,8 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci,
                 * reconfiguration might also have changed that since the
                 * check was performed.
                 */
-               num_requests = get_num_requests ? get_num_requests(ti) : 0;
-               if (!num_requests)
+               num_bios = get_num_bios ? get_num_bios(ti) : 0;
+               if (!num_bios)
                        return -EOPNOTSUPP;
 
                if (is_split_required && !is_split_required(ti))
@@ -1220,7 +1220,7 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci,
                else
                        len = min(ci->sector_count, max_io_len(ci->sector, ti));
 
-               __issue_target_requests(ci, ti, num_requests, len);
+               __issue_target_bios(ci, ti, num_bios, len);
 
                ci->sector += len;
        } while (ci->sector_count -= len);
@@ -1230,13 +1230,13 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci,
 
 static int __clone_and_map_discard(struct clone_info *ci)
 {
-       return __clone_and_map_changing_extent_only(ci, get_num_discard_requests,
+       return __clone_and_map_changing_extent_only(ci, get_num_discard_bios,
                                                    is_split_required_for_discard);
 }
 
 static int __clone_and_map_write_same(struct clone_info *ci)
 {
-       return __clone_and_map_changing_extent_only(ci, get_num_write_same_requests, NULL);
+       return __clone_and_map_changing_extent_only(ci, get_num_write_same_bios, NULL);
 }
 
 static int __clone_and_map(struct clone_info *ci)
index a5cda3ea6b88fa015ec173b6ebc9c1d5b32b2bc6..d5f984b0746611c80ba49dd3dfc9a67d5e5a1dd8 100644 (file)
@@ -187,26 +187,26 @@ struct dm_target {
        uint32_t max_io_len;
 
        /*
-        * A number of zero-length barrier requests that will be submitted
+        * A number of zero-length barrier bios that will be submitted
         * to the target for the purpose of flushing cache.
         *
-        * The request number can be accessed with dm_bio_get_target_request_nr.
-        * It is a responsibility of the target driver to remap these requests
+        * The bio number can be accessed with dm_bio_get_target_bio_nr.
+        * It is a responsibility of the target driver to remap these bios
         * to the real underlying devices.
         */
-       unsigned num_flush_requests;
+       unsigned num_flush_bios;
 
        /*
-        * The number of discard requests that will be submitted to the target.
-        * The request number can be accessed with dm_bio_get_target_request_nr.
+        * The number of discard bios that will be submitted to the target.
+        * The bio number can be accessed with dm_bio_get_target_bio_nr.
         */
-       unsigned num_discard_requests;
+       unsigned num_discard_bios;
 
        /*
-        * The number of WRITE SAME requests that will be submitted to the target.
-        * The request number can be accessed with dm_bio_get_target_request_nr.
+        * The number of WRITE SAME bios that will be submitted to the target.
+        * The bio number can be accessed with dm_bio_get_target_bio_nr.
         */
-       unsigned num_write_same_requests;
+       unsigned num_write_same_bios;
 
        /*
         * The minimum number of extra bytes allocated in each bio for the
@@ -233,10 +233,10 @@ struct dm_target {
        bool discards_supported:1;
 
        /*
-        * Set if the target required discard request to be split
+        * Set if the target required discard bios to be split
         * on max_io_len boundary.
         */
-       bool split_discard_requests:1;
+       bool split_discard_bios:1;
 
        /*
         * Set if this target does not return zeroes on discarded blocks.
@@ -261,7 +261,7 @@ struct dm_target_io {
        struct dm_io *io;
        struct dm_target *ti;
        union map_info info;
-       unsigned target_request_nr;
+       unsigned target_bio_nr;
        struct bio clone;
 };
 
@@ -275,9 +275,9 @@ static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size)
        return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone));
 }
 
-static inline unsigned dm_bio_get_target_request_nr(const struct bio *bio)
+static inline unsigned dm_bio_get_target_bio_nr(const struct bio *bio)
 {
-       return container_of(bio, struct dm_target_io, clone)->target_request_nr;
+       return container_of(bio, struct dm_target_io, clone)->target_bio_nr;
 }
 
 int dm_register_target(struct target_type *t);