[dm-devel] [PATCH] dm zoned: update atime for new buffer zones

Hannes Reinecke hare at suse.de
Wed Jul 15 08:17:52 UTC 2020


When a new buffer zone is allocated in dmz_handle_buffered_write()
we should update the 'atime' to inform reclaim that this zone has
been accessed.
Otherwise we end up with the pathological case where the first write
allocates a new buffer zone, but the next write will start reclaim
before processing the bio. As the atime is not set reclaim declares
the system idle and reclaims the zone. Then the write will be processed
and re-allocate the very same zone again; this repeats for every
consecutive write, making for a _very_ slow mkfs.

Signed-off-by: Hannes Reinecke <hare at suse.de>
---
 drivers/md/dm-zoned-target.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index cf915009c306..b32d37bef14f 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -297,6 +297,9 @@ static int dmz_handle_buffered_write(struct dmz_target *dmz,
 	if (dmz_is_readonly(bzone))
 		return -EROFS;
 
+	/* Tell reclaim we're doing some work here */
+	dmz_reclaim_bio_acc(bzone->dev->reclaim);
+
 	/* Submit write */
 	ret = dmz_submit_bio(dmz, bzone, bio, chunk_block, nr_blocks);
 	if (ret)
-- 
2.16.4




More information about the dm-devel mailing list