]> Git Repo - linux.git/commitdiff
dm: shortcut the calls to linear_map and stripe_map
authorMikulas Patocka <[email protected]>
Mon, 18 Sep 2023 15:33:29 +0000 (17:33 +0200)
committerMike Snitzer <[email protected]>
Fri, 6 Oct 2023 23:09:25 +0000 (19:09 -0400)
Shortcut the calls to linear_map and stripe_map, so that they don't suffer
the overhead of retpolines used for indirect calls.

Signed-off-by: Mikulas Patocka <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
drivers/md/dm-linear.c
drivers/md/dm-stripe.c
drivers/md/dm.c
drivers/md/dm.h

index f4448d520ee923982440bd26bfe49ed51f9dcb05..2d3e186ca87e3c78404005dc08484fae90a9a2e2 100644 (file)
@@ -85,7 +85,7 @@ static sector_t linear_map_sector(struct dm_target *ti, sector_t bi_sector)
        return lc->start + dm_target_offset(ti, bi_sector);
 }
 
-static int linear_map(struct dm_target *ti, struct bio *bio)
+int linear_map(struct dm_target *ti, struct bio *bio)
 {
        struct linear_c *lc = ti->private;
 
index e2854a3cbd2826c7e8bed03f473f94ab19bf1e57..c11619d82a7e1bd367fd0d74a9c16f388d1f5030 100644 (file)
@@ -268,7 +268,7 @@ static int stripe_map_range(struct stripe_c *sc, struct bio *bio,
        return DM_MAPIO_SUBMITTED;
 }
 
-static int stripe_map(struct dm_target *ti, struct bio *bio)
+int stripe_map(struct dm_target *ti, struct bio *bio)
 {
        struct stripe_c *sc = ti->private;
        uint32_t stripe;
index 64a1f306c96c11eea2ac754334646dcb7c4e8586..ab7dd8ab51d1f87eb8cee4d4b92620c51ad4d83b 100644 (file)
@@ -1423,10 +1423,17 @@ static void __map_bio(struct bio *clone)
                 */
                if (unlikely(dm_emulate_zone_append(md)))
                        r = dm_zone_map_bio(tio);
+               else
+                       goto do_map;
+       } else {
+do_map:
+               if (likely(ti->type->map == linear_map))
+                       r = linear_map(ti, clone);
+               else if (ti->type->map == stripe_map)
+                       r = stripe_map(ti, clone);
                else
                        r = ti->type->map(ti, clone);
-       } else
-               r = ti->type->map(ti, clone);
+       }
 
        switch (r) {
        case DM_MAPIO_SUBMITTED:
index f682295af91f7877174d4c60aeac13d69c4ee675..7f1acbf6bd9ec41df332c94a789826b4e496c2e1 100644 (file)
@@ -188,9 +188,11 @@ void dm_kobject_release(struct kobject *kobj);
 /*
  * Targets for linear and striped mappings
  */
+int linear_map(struct dm_target *ti, struct bio *bio);
 int dm_linear_init(void);
 void dm_linear_exit(void);
 
+int stripe_map(struct dm_target *ti, struct bio *bio);
 int dm_stripe_init(void);
 void dm_stripe_exit(void);
 
This page took 0.068515 seconds and 4 git commands to generate.