summaryrefslogtreecommitdiff
path: root/drivers/md/dm-io-tracker.h
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2021-06-28 09:59:37 -0400
committerMike Snitzer <snitzer@redhat.com>2021-06-28 16:30:13 -0400
commit5c0de3d72f8c05678ed769bea24e98128f7ab570 (patch)
tree9d41547dfdf367e5969af1244180d48564a1cc5b /drivers/md/dm-io-tracker.h
parent95b88f4d71cb953e02206be3c757083601391a0f (diff)
dm writecache: make writeback pause configurable
Commit 95b88f4d71cb953e02206be3c757083601391a0f ("dm writecache: pause writeback if cache full and origin being written directly") introduced a code that pauses cache flushing if we are issuing writes directly to the origin. Improve that initial commit by making the timeout code configurable (via the option "pause_writeback"). Also change the default from 1s to 3s because it performed better. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-io-tracker.h')
-rw-r--r--drivers/md/dm-io-tracker.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/md/dm-io-tracker.h b/drivers/md/dm-io-tracker.h
index 1dcf01f9f066..bdcc6273ebf0 100644
--- a/drivers/md/dm-io-tracker.h
+++ b/drivers/md/dm-io-tracker.h
@@ -45,6 +45,18 @@ static inline bool dm_iot_idle_for(struct dm_io_tracker *iot, unsigned long j)
return r;
}
+static inline unsigned long dm_iot_idle_time(struct dm_io_tracker *iot)
+{
+ unsigned long r = 0;
+
+ spin_lock_irq(&iot->lock);
+ if (!iot->in_flight)
+ r = jiffies - iot->idle_time;
+ spin_unlock_irq(&iot->lock);
+
+ return r;
+}
+
static inline void dm_iot_io_begin(struct dm_io_tracker *iot, sector_t len)
{
spin_lock_irq(&iot->lock);