[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250221081109.734170-4-zhengqixing@huaweicloud.com>
Date: Fri, 21 Feb 2025 16:11:00 +0800
From: Zheng Qixing <zhengqixing@...weicloud.com>
To: axboe@...nel.dk,
song@...nel.org,
colyli@...nel.org,
yukuai3@...wei.com,
dan.j.williams@...el.com,
vishal.l.verma@...el.com,
dave.jiang@...el.com,
ira.weiny@...el.com,
dlemoal@...nel.org,
yanjun.zhu@...ux.dev,
kch@...dia.com,
hare@...e.de,
zhengqixing@...wei.com,
john.g.garry@...cle.com,
geliang@...nel.org,
xni@...hat.com,
colyli@...e.de
Cc: linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-raid@...r.kernel.org,
nvdimm@...ts.linux.dev,
yi.zhang@...wei.com,
yangerkun@...wei.com
Subject: [PATCH 03/12] badblocks: attempt to merge adjacent badblocks during ack_all_badblocks
From: Li Nan <linan122@...wei.com>
If ack and unack badblocks are adjacent, they will not be merged and will
remain as two separate badblocks. Even after the bad blocks are written
to disk and both become ack, they will still remain as two independent
bad blocks. This is not ideal as it wastes the limited space for
badblocks. Therefore, during ack_all_badblocks(), attempt to merge
badblocks if they are adjacent.
Fixes: aa511ff8218b ("badblocks: switch to the improved badblock handling code")
Signed-off-by: Li Nan <linan122@...wei.com>
---
block/badblocks.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block/badblocks.c b/block/badblocks.c
index f069c93e986d..ad8652fbe1c8 100644
--- a/block/badblocks.c
+++ b/block/badblocks.c
@@ -1491,6 +1491,11 @@ void ack_all_badblocks(struct badblocks *bb)
p[i] = BB_MAKE(start, len, 1);
}
}
+
+ for (i = 0; i < bb->count ; i++)
+ while (try_adjacent_combine(bb, i))
+ ;
+
bb->unacked_exist = 0;
}
write_sequnlock_irq(&bb->lock);
--
2.39.2
Powered by blists - more mailing lists