[Devel] [PATCH RHEL8 COMMIT] ploop: Care about unaligned discards
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Jun 9 20:46:19 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.38
------>
commit 22d2c14e464d8cd3571d3b3a54b36b39f864b722
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Wed Jun 9 20:46:19 2021 +0300
ploop: Care about unaligned discards
Despite we have discard_granuality properly set,
we may receive shorter requests. This is possible,
in case of boundary requests, or just short bios,
which are submitted from fstrim. Fix that.
Note, we have this check before loop removal, and
whole_cluster even became unused after loop is killed.
Make it used again.
https://jira.sw.ru/browse/PSBM-130521
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index c7e6de166cb3..2d5aded8a939 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -544,6 +544,18 @@ static void handle_discard_pio(struct ploop *ploop, struct pio *pio,
loff_t pos;
int ret;
+ if (!whole_cluster(ploop, pio)) {
+ /*
+ * Despite discard_granularity is given, block level
+ * may submit shorter reqs. E.g., these are boundary
+ * bios around trimed continuous hunk. For discard
+ * it's OK to just ignore such reqs. Keep in mind
+ * this implementing REQ_OP_WRITE_ZEROES etc.
+ */
+ pio_endio(pio);
+ return;
+ }
+
if (!cluster_is_in_top_delta(ploop, cluster)) {
pio_endio(pio);
return;
More information about the Devel
mailing list