[Devel] [PATCH vz9 v1 28/63] dm-ploop: make md writeback timeout to be per page
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Fri Jan 24 18:36:02 MSK 2025
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 | 10 ++++------
drivers/md/dm-ploop.h | 1 +
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 2419d60e3ec6..40c3cb00856d 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -564,6 +564,8 @@ static bool ploop_md_make_dirty(struct ploop *ploop, struct md_page *md)
new = true;
}
write_unlock_irqrestore(&ploop->bat_rwlock, flags);
+ md->dirty_timeout = jiffies + ploop->md_submit_delay_ms*HZ/1000;
+
return new;
}
@@ -1829,14 +1831,10 @@ static void ploop_process_resubmit_pios(struct ploop *ploop,
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;
+ unsigned long timeout = jiffies;
- 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
@@ -1844,7 +1842,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 || time_before(md->dirty_timeout, timeout)) {
/* 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 02612339405c..fa2b02910296 100644
--- a/drivers/md/dm-ploop.h
+++ b/drivers/md/dm-ploop.h
@@ -129,6 +129,7 @@ struct md_page {
spinlock_t md_lock;
bool high_prio;
+ unsigned long dirty_timeout;
};
enum {
--
2.43.0
More information about the Devel
mailing list