ext2: Cache physical location of current content block
diff --git a/src/filo-fs-ext2.adb b/src/filo-fs-ext2.adb
index ee9265b..db1c1a3 100644
--- a/src/filo-fs-ext2.adb
+++ b/src/filo-fs-ext2.adb
@@ -754,6 +754,7 @@
 
          if Success then
             State.Inode.I := Inode;
+            State.Inode.Map_Cache := (others => <>);
             State.S := File_Opened;
          end if;
       end;
@@ -956,12 +957,16 @@
                Physical : FSBlock_Offset;
                Success : Boolean;
             begin
-               if State.Inode.Use_Extents then
+               if State.Inode.Map_Cache.Logical = Block_Offset (Logical) then
+                  Physical := State.Inode.Map_Cache.Phys;
+                  Success := True;
+               elsif State.Inode.Use_Extents then
                   Extent_Block_Map (State, Logical, Physical, Success);
                else
                   Ext2_Block_Map (State, Logical, Physical, Success);
                end if;
                exit when not Success;
+               State.Inode.Map_Cache := (Phys => Physical, Logical => Block_Offset (Logical));
 
                if Physical > 0 then
                   Cache_FSBlock
diff --git a/src/filo-fs-ext2.ads b/src/filo-fs-ext2.ads
index 8e64a5d..96c3597 100644
--- a/src/filo-fs-ext2.ads
+++ b/src/filo-fs-ext2.ads
@@ -80,12 +80,18 @@
    type Inode_Type is (Dir, Regular, Link, Fast_Link);
    type Inode_Length is range 0 .. 2 ** 46;
 
+   type Inode_Map_Cache is record
+      Phys     : FSBlock_Offset := 0;
+      Logical  : Block_Offset := Block_Offset'Last;
+   end record;
+
    type Inode_Info is record
       I           : Inode_Index := Inode_Index'First;
       Mode        : Inode_Type := Inode_Type'First;
       Size        : Inode_Length := 0;
       Use_Extents : Boolean := False;
       Inline      : Inode_Extents := (others => 16#00#);
+      Map_Cache   : Inode_Map_Cache := (others => <>);
    end record;
 
    type Group_Index is new Inode_0_Index;