If start buffer is latest then restart, we update committed LSN with
last record LSN of block (last_end_lsn) while applying action but
forget about it while printing records with -f for investigation
purpose.

Note that while applying actions we use start_buffer to calculate
latest page out of block 2 and block 3 and then from latest take
committed LSN. For -f we don't need buffers so we just compare
directly with committed LSN from restart.
---
 ntfsprogs/ntfsrecover.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/ntfsprogs/ntfsrecover.c b/ntfsprogs/ntfsrecover.c
index 567db15..47e01d7 100644
--- a/ntfsprogs/ntfsrecover.c
+++ b/ntfsprogs/ntfsrecover.c
@@ -3720,6 +3720,20 @@ static int walk(CONTEXT *ctx)
                                }
                if (!done) {
                        buf = nextbuf;
+                       if (blk >= RSTBLKS && blk < BASEBLKS) {
+                               /* The latest buf may be more recent
+                                  than restart */
+                               rph = &buf->block.record;
+                               if ((s64)(le64_to_cpu(rph->last_end_lsn)
+                                         - committed_lsn) > 0) {
+                                       committed_lsn =
+                                               le64_to_cpu(rph->last_end_lsn);
+                                       if (optv)
+                                               printf("* Restart page was "
+                                                      "obsolete, updated "
+                                                      "committed lsn\n");
+                               }
+                       }
                        if (optv)
                                printf("\n* block %d at 0x%llx\n",(int)blk,
                                        (long long)loclogblk(ctx, blk));
-- 
2.4.3


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to