[PATCH v2 11/14] replay-log: output log replay offset in verbose mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This helps exporting the recorded log to an image file using dd.

Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
---
 src/log-writes/log-writes.c | 8 +++++---
 src/log-writes/replay-log.c | 6 ++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/log-writes/log-writes.c b/src/log-writes/log-writes.c
index fa4f3f3..ba66a5c 100644
--- a/src/log-writes/log-writes.c
+++ b/src/log-writes/log-writes.c
@@ -158,12 +158,14 @@ int log_replay_next_entry(struct log *log, struct log_write_entry *entry,
 		}
 	}
 
-	if (log_writes_verbose)
-		printf("replaying %d: sector %llu, size %llu, flags %llu\n",
-		       (int)log->cur_entry - 1,
+	if (log_writes_verbose) {
+		offset = lseek(log->logfd, 0, SEEK_CUR);
+		printf("replaying %d@%llu: sector %llu, size %llu, flags %llu\n",
+		       (int)log->cur_entry - 1, offset / log->sectorsize,
 		       (unsigned long long)le64_to_cpu(entry->sector),
 		       (unsigned long long)size,
 		       (unsigned long long)le64_to_cpu(entry->flags));
+	}
 	if (!size)
 		return 0;
 
diff --git a/src/log-writes/replay-log.c b/src/log-writes/replay-log.c
index 759c3c7..87c03a2 100644
--- a/src/log-writes/replay-log.c
+++ b/src/log-writes/replay-log.c
@@ -284,8 +284,10 @@ int main(int argc, char **argv)
 			num_entries++;
 			if ((run_limit && num_entries == run_limit) ||
 			    should_stop(entry, stop_flags, end_mark)) {
-				printf("%llu\n",
-				       (unsigned long long)log->cur_entry - 1);
+				off_t offset = lseek(log->logfd, 0, SEEK_CUR);
+
+				printf("%llu@%llu\n",
+				       (unsigned long long)log->cur_entry - 1, offset / log->sectorsize);
 				log_free(log);
 				return 0;
 			}
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux