[Devel] [RFC PATCH vz9 v4 31/33] dm-ploop: make md writeback timeout to be per page
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Mon Nov 4 13:59:26 MSK 2024
Do not bulk write all dirtied bat pages in a common timeout.
Instead mark dirty time for each page and delay for each page
by the timeout. If page is tried to be redirtied - update the
dirty time so for hot page try to accumulate more changes before
writeout.
https://virtuozzo.atlassian.net/browse/VSTOR-91817
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 5 ++---
drivers/md/dm-ploop.h | 1 +
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index b174a94358e0..e031ce5f5f27 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -560,6 +560,7 @@ static bool ploop_md_make_dirty(struct ploop *ploop, struct md_page *md)
write_lock_irqsave(&ploop->bat_rwlock, flags);
WARN_ON_ONCE(test_bit(MD_WRITEBACK, &md->status));
+ md->dirty_time = ktime_get();
if (!test_and_set_bit(MD_DIRTY, &md->status)) {
list_add(&md->wb_link, &ploop->wb_batch_list);
new = true;
@@ -1820,11 +1821,9 @@ static void ploop_submit_metadata_writeback(struct ploop *ploop)
ktime_t ktime, ktimeout;
LIST_HEAD(ll_skipped);
struct md_page *md, *mtmp;
- int send_all;
ktime = ktime_get();
ktimeout = ktime_add_ms(ktime, ploop->md_submit_delay_ms);
- send_all = ktime_after(ktime, ktimeout);
/*
* Pages are set dirty so no one must touch lists
* if new md entries are dirtied they are added at the start of the list
@@ -1832,7 +1831,7 @@ static void ploop_submit_metadata_writeback(struct ploop *ploop)
list_for_each_entry_safe(md, mtmp, &ploop->wb_batch_list, wb_link) {
write_lock_irq(&ploop->bat_rwlock);
list_del_init(&md->wb_link);
- if (md->high_prio || send_all) {
+ if (md->high_prio || ktime_after(md->dirty_time, ktimeout)) {
/* L1L2 mustn't be redirtyed, when wb in-flight! */
WARN_ON_ONCE(!test_bit(MD_DIRTY, &md->status));
WARN_ON_ONCE(test_bit(MD_WRITEBACK, &md->status));
diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
index aceaeeeb8af3..1651293e2fd8 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -130,6 +130,7 @@ struct md_page {
rwlock_t lock;
bool high_prio;
+ ktime_t dirty_time;
};
enum {
--
2.43.0
More information about the Devel
mailing list