[Devel] [PATCH RHEL8 COMMIT] ploop: Convert remap_to_cluster()
Konstantin Khorenko
khorenko at virtuozzo.com
Mon May 17 19:04:47 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.30
------>
commit 5ea2a11765acd1888ca72f4c8369f4e931f2a94b
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Mon May 17 19:04:47 2021 +0300
ploop: Convert remap_to_cluster()
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
=====================
Patchset description:
dm-ploop: Kill loop
Intermediate patches can't be base for bisect.
In scope of https://jira.sw.ru/browse/PSBM-123654
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 10 +++++-----
drivers/md/dm-ploop.h | 9 ++++++++-
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 75bed1721aa0..914e298305a8 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -494,9 +494,9 @@ static void handle_discard_bio(struct ploop *ploop, struct bio *bio,
atomic_inc(&ploop->nr_discard_bios);
remap_to_origin(ploop, bio);
- remap_to_cluster(ploop, bio, dst_cluster);
+ remap_to_cluster(ploop, h, dst_cluster);
- pos = to_bytes(bio->bi_iter.bi_sector);
+ pos = to_bytes(h->bi_iter.bi_sector);
ret = punch_hole(top_delta(ploop)->file, pos, h->bi_iter.bi_size);
if (ret)
h->bi_status = errno_to_blk_status(ret);
@@ -940,7 +940,7 @@ static void submit_delta_read(struct ploop *ploop, unsigned int level,
atomic_set(&piocb->count, 2);
piocb->bio = bio;
- remap_to_cluster(ploop, bio, dst_cluster);
+ remap_to_cluster_bio(ploop, bio, dst_cluster);
bvec = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter);
offset = bio->bi_iter.bi_bvec_done;
@@ -1320,8 +1320,8 @@ static void submit_rw_mapped(struct ploop *ploop, loff_t clu_pos, struct pio *pi
iter.iov_offset = pio->bi_iter.bi_bvec_done;
remap_to_origin(ploop, bio);
- remap_to_cluster(ploop, bio, clu_pos);
- pos = to_bytes(bio->bi_iter.bi_sector);
+ remap_to_cluster(ploop, pio, clu_pos);
+ pos = to_bytes(pio->bi_iter.bi_sector);
call_rw_iter(top_delta(ploop)->file, pos, rw, &iter, bio);
}
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index 61332b83eea8..6abe21d0ad0f 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -308,8 +308,15 @@ static inline void remap_to_origin(struct ploop *ploop, struct bio *bio)
bio_set_dev(bio, ploop->origin_dev->bdev);
}
-static inline void remap_to_cluster(struct ploop *ploop, struct bio *bio,
+static inline void remap_to_cluster(struct ploop *ploop, struct pio *pio,
unsigned int cluster)
+{
+ pio->bi_iter.bi_sector &= ((1 << ploop->cluster_log) - 1);
+ pio->bi_iter.bi_sector |= (cluster << ploop->cluster_log);
+}
+
+static inline void remap_to_cluster_bio(struct ploop *ploop, struct bio *bio,
+ unsigned int cluster)
{
bio->bi_iter.bi_sector &= ((1 << ploop->cluster_log) - 1);
bio->bi_iter.bi_sector |= (cluster << ploop->cluster_log);
More information about the Devel
mailing list