From 12d5c55fb2b68c604b362482e77a980d536c5064 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 25 Aug 2009 17:09:54 +1000 Subject: [PATCH] Accelerate walk_indirect. If an indirect block is being asked to incorporate an address that is very must after the address of the block, it has to count all the way up to that number, which is a waste of time. So if there is an opportunity to jump forward, take it. --- modify.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modify.c b/modify.c index c12b069..c3b5cea 100644 --- a/modify.c +++ b/modify.c @@ -797,7 +797,10 @@ static u32 walk_indirect(u32 addr, char **bufp, int len, struct uninc *ui, if (len >= 6) { phys = decode48(buf); len -= 6; - } + } else if (uinum < ui->pending_cnt && + addr < ui->pending_addr[uinum].fileaddr + uioffset) + /* Skip ahead quickly. */ + addr = ui->pending_addr[uinum].fileaddr + uioffset; if (uinum < ui->pending_cnt && ui->pending_addr[uinum].fileaddr + uioffset == addr) { -- 2.39.5