summaryrefslogtreecommitdiff
blob: dcf81c7566de06c47b3610d6285dd2362cce8d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Patch from:
https://github.com/knorrie/python-btrfs/commit/8ebe99f77b5e4da38d8e9322bb5a7c4688c98b4a

From 8ebe99f77b5e4da38d8e9322bb5a7c4688c98b4a Mon Sep 17 00:00:00 2001
From: Cebtenzzre <cebtenzzre@gmail.com>
Date: Sun, 28 Nov 2021 14:46:39 -0500
Subject: [PATCH] examples/show_file_csum: Fix vaddr computation

extent.logical_offset is relative to the start of the file, whereas
extent.offset is relative to the start of the extent data on disk.
--- a/examples/show_file_csum.py
+++ b/examples/show_file_csum.py
@@ -90,11 +90,11 @@ def first_regular_file_extent(inum, tree):
          "inside a data extent at vaddr {}.".format(
              extent.logical_offset, extent.num_bytes, extent.offset, extent.disk_bytenr))
 
-vaddr = extent.disk_bytenr + extent.logical_offset
+vaddr = extent.disk_bytenr + extent.offset
 
 wraprint("Now, we first look up the checksum value for one block ({} bytes) "
          "of data at vaddr {} ({} + {}).".format(
-             fs.sectorsize, vaddr, extent.disk_bytenr, extent.logical_offset))
+             fs.sectorsize, vaddr, extent.disk_bytenr, extent.offset))
 wraprint("If we're lucky, the checksum tree has a key at {}. "
          "If not, we have to try searching back a bit to find the csum object that "
          "holds information about our data block. Searching back is done in a very clumsy "