]> git.neil.brown.name Git - LaFS.git/commitdiff
Accelerate walk_indirect.
authorNeilBrown <neilb@suse.de>
Tue, 25 Aug 2009 07:09:54 +0000 (17:09 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 25 Aug 2009 07:09:54 +0000 (17:09 +1000)
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

index c12b069c852ea0448ef5a0fe720bc222f32ab5c8..c3b5cea30ac0e9dad2c2703fc27ea2bd1f9dc1a9 100644 (file)
--- 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) {