Open josefbacik opened 4 years ago
Doesn't seem to be the case in my testing:
root@ubuntu18:~/xfstests-dev# filefrag -v /media/scratch/sub1/file
Filesystem type is: 9123683e
File size of /media/scratch/sub1/file is 1048576 (256 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 255: 3548.. 3803: 256: last,shared,eof
/media/scratch/sub1/file: 1 extent found
root@ubuntu18:~/xfstests-dev# btrfs sub delete /media/scratch/sub1/
Delete subvolume (no-commit): '/media/scratch/sub1'
root@ubuntu18:~/xfstests-dev# filefrag -v /media/scratch/sub1/file
open: No such file or directory
root@ubuntu18:~/xfstests-dev# filefrag -v /media/scratch/snap1/file
Filesystem type is: 9123683e
File size of /media/scratch/snap1/file is 1048576 (256 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 255: 3548.. 3803: 256: last,eof
/media/scratch/snap1/file: 1 extent found
Is it possible that the extent is shown as SHARED for the duration between queuing the subvolume for delete and the transaction committing, actually performing the delete?
root@localhost ~/btrfs-next# btrfs sub create /mnt/test/foo
Create subvolume '/mnt/test/foo'
root@localhost ~/btrfs-next# dd if=/dev/zero of=/mnt/test/foo/file bs=1M count=1 && sync
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00225162 s, 466 MB/s
root@localhost ~/btrfs-next# btrfs sub snap /mnt/test/foo /mnt/test/snap
Create a snapshot of '/mnt/test/foo' in '/mnt/test/snap'
root@localhost ~/btrfs-next# btrfs sub delete /mnt/test/foo
Delete subvolume (no-commit): '/mnt/test/foo'
root@localhost ~/btrfs-next# filefrag -v /mnt/test/snap/file
Filesystem type is: 9123683e
File size of /mnt/test/snap/file is 1048576 (256 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 255: 3328.. 3583: 256: last,shared,eof
/mnt/test/snap/file: 1 extent found
root@localhost ~/btrfs-next# uname -a
Linux localhost.localdomain 5.9.0-rc2+ #33 SMP Thu Aug 27 14:05:32 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
root@localhost ~/btrfs-next# btrfs fi sync /mnt/test
root@localhost ~/btrfs-next# filefrag -v /mnt/test/snap/file
Filesystem type is: 9123683e
File size of /mnt/test/snap/file is 1048576 (256 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 255: 3328.. 3583: 256: last,eof
/mnt/test/snap/file: 1 extent found
Yup you're right. @cmurf I think the problem you reported was on a fs that had long since settled the snapshot delete right? Or was it the same as this?
User reported no snapshots, reflinks or dedupe - no snapper or timeshift either. Shared extents was entirely unexpected.
Then I think we need to see a btrfs inspect-internal dump-tree
of the fs, at least for that bytenr, so we can see why fiemap might be confused.
btrfs-image -ss -c4 -t4
135MiB file
https://mega.nz/file/tM81lJCA#Pd3gZY2udCbFv04FJv82jERqHbomGLpktMBLsn5PClI
The file with claimed shared extents is ~300G, by far it'll be the single biggest file with the most extent items.
If there aren't supposed to be shared extents, I'm guessing the extent tree shouldn't have any 'shared data backref' and yet I see a lot of those, and for the file in question: inode/objectid 43141. Here's one extent tree leaf:
# btrfs insp dump-t -b 1412514185216 /dev/loop0
btrfs-progs v5.7
leaf 1412514185216 items 109 free space 7989 generation 102695 owner EXTENT_TREE
leaf 1412514185216 flags 0x1(WRITTEN) backref revision 1
fs uuid b68411ce-702a-4259-9121-ac21c9119ddf
chunk uuid ae171282-6d7b-4c58-9e9e-00b859a012d5
item 0 key (1191942553600 BLOCK_GROUP_ITEM 1073741824) itemoff 16259 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 1 key (1192210989056 EXTENT_ITEM 268435456) itemoff 16206 itemsize 53
refs 1 gen 92170 flags DATA
extent data backref root FS_TREE objectid 43141 offset 219848638464 count 1
item 2 key (1192479424512 EXTENT_ITEM 268435456) itemoff 16153 itemsize 53
refs 29 gen 92179 flags DATA
extent data backref root FS_TREE objectid 43141 offset 217969590272 count 29
item 3 key (1192747859968 EXTENT_ITEM 268435456) itemoff 15931 itemsize 222
refs 1679 gen 92179 flags DATA
extent data backref root FS_TREE objectid 43141 offset 216090542080 count 327
shared data backref parent 1412227186688 count 104
shared data backref parent 1412227170304 count 104
shared data backref parent 1412220026880 count 104
shared data backref parent 1412220010496 count 104
shared data backref parent 1412219994112 count 104
shared data backref parent 1412219977728 count 104
shared data backref parent 1412219961344 count 104
shared data backref parent 1412219944960 count 104
shared data backref parent 1412219928576 count 104
shared data backref parent 1412219912192 count 104
shared data backref parent 1412219895808 count 104
shared data backref parent 1412219879424 count 104
shared data backref parent 1412219863040 count 104
item 4 key (1193016295424 EXTENT_ITEM 268435456) itemoff 15878 itemsize 53
refs 103 gen 92179 flags DATA
extent data backref root FS_TREE objectid 43141 offset 218506461184 count 103
item 5 key (1193016295424 BLOCK_GROUP_ITEM 1073741824) itemoff 15854 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 6 key (1193284730880 EXTENT_ITEM 268435456) itemoff 15801 itemsize 53
refs 3 gen 92179 flags DATA
extent data backref root FS_TREE objectid 43141 offset 218774896640 count 3
item 7 key (1193553166336 EXTENT_ITEM 268435456) itemoff 15748 itemsize 53
refs 55 gen 92188 flags DATA
extent data backref root FS_TREE objectid 43141 offset 216895848448 count 55
item 8 key (1193821601792 EXTENT_ITEM 268435456) itemoff 15695 itemsize 53
refs 33 gen 92188 flags DATA
extent data backref root FS_TREE objectid 43141 offset 215016800256 count 33
item 9 key (1194090037248 EXTENT_ITEM 268435456) itemoff 15642 itemsize 53
refs 102 gen 92188 flags DATA
extent data backref root FS_TREE objectid 43141 offset 217432719360 count 102
item 10 key (1194090037248 BLOCK_GROUP_ITEM 1073741824) itemoff 15618 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 11 key (1194358472704 EXTENT_ITEM 268435456) itemoff 15565 itemsize 53
refs 125 gen 92188 flags DATA
extent data backref root FS_TREE objectid 43141 offset 217701154816 count 125
item 12 key (1194626908160 EXTENT_ITEM 268435456) itemoff 15512 itemsize 53
refs 246 gen 92197 flags DATA
extent data backref root FS_TREE objectid 43141 offset 215822106624 count 246
item 13 key (1194895343616 EXTENT_ITEM 268435456) itemoff 15459 itemsize 53
refs 72 gen 92197 flags DATA
extent data backref root FS_TREE objectid 43141 offset 213943058432 count 72
item 14 key (1195163779072 EXTENT_ITEM 268435456) itemoff 15406 itemsize 53
refs 27 gen 92197 flags DATA
extent data backref root FS_TREE objectid 43141 offset 216358977536 count 27
item 15 key (1195163779072 BLOCK_GROUP_ITEM 1073741824) itemoff 15382 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 16 key (1195432214528 EXTENT_ITEM 268435456) itemoff 15329 itemsize 53
refs 19 gen 92197 flags DATA
extent data backref root FS_TREE objectid 43141 offset 216627412992 count 19
item 17 key (1195700649984 EXTENT_ITEM 268435456) itemoff 15276 itemsize 53
refs 33 gen 92206 flags DATA
extent data backref root FS_TREE objectid 43141 offset 214748364800 count 33
item 18 key (1195969085440 EXTENT_ITEM 268435456) itemoff 15223 itemsize 53
refs 140 gen 92206 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212869316608 count 140
item 19 key (1196237520896 EXTENT_ITEM 268435456) itemoff 15170 itemsize 53
refs 2 gen 92206 flags DATA
extent data backref root FS_TREE objectid 43141 offset 215285235712 count 2
item 20 key (1196237520896 BLOCK_GROUP_ITEM 1073741824) itemoff 15146 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 21 key (1196505956352 EXTENT_ITEM 268435456) itemoff 15093 itemsize 53
refs 8 gen 92206 flags DATA
extent data backref root FS_TREE objectid 43141 offset 215553671168 count 8
item 22 key (1196774391808 EXTENT_ITEM 268435456) itemoff 15040 itemsize 53
refs 77 gen 92215 flags DATA
extent data backref root FS_TREE objectid 43141 offset 213674622976 count 77
item 23 key (1197042827264 EXTENT_ITEM 268435456) itemoff 14987 itemsize 53
refs 74 gen 92215 flags DATA
extent data backref root FS_TREE objectid 43141 offset 211795574784 count 74
item 24 key (1197311262720 EXTENT_ITEM 268435456) itemoff 14934 itemsize 53
refs 126 gen 92215 flags DATA
extent data backref root FS_TREE objectid 43141 offset 214211493888 count 126
item 25 key (1197311262720 BLOCK_GROUP_ITEM 1073741824) itemoff 14910 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 26 key (1197579698176 EXTENT_ITEM 268435456) itemoff 14857 itemsize 53
refs 101 gen 92215 flags DATA
extent data backref root FS_TREE objectid 43141 offset 214479929344 count 101
item 27 key (1197848133632 EXTENT_ITEM 268435456) itemoff 14804 itemsize 53
refs 92 gen 92224 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212600881152 count 92
item 28 key (1198116569088 EXTENT_ITEM 268435456) itemoff 14751 itemsize 53
refs 1 gen 92224 flags DATA
extent data backref root FS_TREE objectid 43141 offset 210721832960 count 1
item 29 key (1198385004544 EXTENT_ITEM 268435456) itemoff 14698 itemsize 53
refs 1 gen 92224 flags DATA
extent data backref root FS_TREE objectid 43141 offset 213137752064 count 1
item 30 key (1198385004544 BLOCK_GROUP_ITEM 1073741824) itemoff 14674 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 31 key (1198653440000 EXTENT_ITEM 268435456) itemoff 14621 itemsize 53
refs 6 gen 92224 flags DATA
extent data backref root FS_TREE objectid 43141 offset 213406187520 count 6
item 32 key (1198921875456 EXTENT_ITEM 268435456) itemoff 14568 itemsize 53
refs 144 gen 92233 flags DATA
extent data backref root FS_TREE objectid 43141 offset 211527139328 count 144
item 33 key (1199190310912 EXTENT_ITEM 268435456) itemoff 14515 itemsize 53
refs 256 gen 92233 flags DATA
extent data backref root FS_TREE objectid 43141 offset 209648091136 count 256
item 34 key (1199458746368 EXTENT_ITEM 268435456) itemoff 14462 itemsize 53
refs 246 gen 92233 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212064010240 count 246
item 35 key (1199458746368 BLOCK_GROUP_ITEM 1073741824) itemoff 14438 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 36 key (1199727181824 EXTENT_ITEM 268435456) itemoff 14385 itemsize 53
refs 120 gen 92233 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212332445696 count 120
item 37 key (1199995617280 EXTENT_ITEM 268435456) itemoff 14332 itemsize 53
refs 73 gen 92242 flags DATA
extent data backref root FS_TREE objectid 43141 offset 210453397504 count 73
item 38 key (1200264052736 EXTENT_ITEM 268435456) itemoff 14279 itemsize 53
refs 7 gen 92242 flags DATA
extent data backref root FS_TREE objectid 43141 offset 208574349312 count 7
item 39 key (1200532488192 EXTENT_ITEM 98304) itemoff 14226 itemsize 53
refs 1 gen 94242 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212144672768 count 1
item 40 key (1200532488192 BLOCK_GROUP_ITEM 1073741824) itemoff 14202 itemsize 24
block group used 1067335680 chunk_objectid 256 flags DATA
item 41 key (1200532586496 EXTENT_ITEM 131072) itemoff 14149 itemsize 53
refs 1 gen 94242 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212144771072 count 1
item 42 key (1200532717568 EXTENT_ITEM 98304) itemoff 14096 itemsize 53
refs 1 gen 94242 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212144902144 count 1
item 43 key (1200532815872 EXTENT_ITEM 65536) itemoff 14043 itemsize 53
refs 1 gen 94242 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145000448 count 1
item 44 key (1200532881408 EXTENT_ITEM 32768) itemoff 13990 itemsize 53
refs 1 gen 94587 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145065984 count 1
item 45 key (1200532914176 EXTENT_ITEM 32768) itemoff 13937 itemsize 53
refs 1 gen 95139 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145098752 count 1
item 46 key (1200532946944 EXTENT_ITEM 32768) itemoff 13884 itemsize 53
refs 1 gen 95353 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145131520 count 1
item 47 key (1200532979712 EXTENT_ITEM 32768) itemoff 13831 itemsize 53
refs 1 gen 95965 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145164288 count 1
item 48 key (1200533012480 EXTENT_ITEM 32768) itemoff 13778 itemsize 53
refs 1 gen 96044 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145197056 count 1
item 49 key (1200533045248 EXTENT_ITEM 32768) itemoff 13725 itemsize 53
refs 1 gen 96105 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145229824 count 1
item 50 key (1200533078016 EXTENT_ITEM 32768) itemoff 13672 itemsize 53
refs 1 gen 96196 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145262592 count 1
item 51 key (1200533110784 EXTENT_ITEM 32768) itemoff 13619 itemsize 53
refs 1 gen 96214 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145295360 count 1
item 52 key (1200533143552 EXTENT_ITEM 32768) itemoff 13566 itemsize 53
refs 1 gen 96668 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145328128 count 1
item 53 key (1200533176320 EXTENT_ITEM 32768) itemoff 13513 itemsize 53
refs 1 gen 96759 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145360896 count 1
item 54 key (1200533209088 EXTENT_ITEM 32768) itemoff 13460 itemsize 53
refs 1 gen 97625 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145393664 count 1
item 55 key (1200533241856 EXTENT_ITEM 32768) itemoff 13407 itemsize 53
refs 1 gen 97644 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145426432 count 1
item 56 key (1200533274624 EXTENT_ITEM 32768) itemoff 13354 itemsize 53
refs 1 gen 97660 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145459200 count 1
item 57 key (1200533307392 EXTENT_ITEM 32768) itemoff 13301 itemsize 53
refs 1 gen 98029 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145491968 count 1
item 58 key (1200533340160 EXTENT_ITEM 32768) itemoff 13248 itemsize 53
refs 1 gen 98057 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145524736 count 1
item 59 key (1200533372928 EXTENT_ITEM 32768) itemoff 13195 itemsize 53
refs 1 gen 98057 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145557504 count 1
item 60 key (1200533405696 EXTENT_ITEM 32768) itemoff 13142 itemsize 53
refs 1 gen 98239 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145590272 count 1
item 61 key (1200533438464 EXTENT_ITEM 32768) itemoff 13089 itemsize 53
refs 1 gen 98257 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145623040 count 1
item 62 key (1200533471232 EXTENT_ITEM 32768) itemoff 13036 itemsize 53
refs 1 gen 98627 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145655808 count 1
item 63 key (1200533504000 EXTENT_ITEM 32768) itemoff 12983 itemsize 53
refs 1 gen 98665 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145688576 count 1
item 64 key (1200533536768 EXTENT_ITEM 32768) itemoff 12930 itemsize 53
refs 1 gen 98678 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145721344 count 1
item 65 key (1200533569536 EXTENT_ITEM 163840) itemoff 12877 itemsize 53
refs 1 gen 98927 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145754112 count 1
item 66 key (1200533733376 EXTENT_ITEM 32768) itemoff 12824 itemsize 53
refs 1 gen 98968 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145917952 count 1
item 67 key (1200533766144 EXTENT_ITEM 32768) itemoff 12771 itemsize 53
refs 1 gen 99114 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145950720 count 1
item 68 key (1200533798912 EXTENT_ITEM 32768) itemoff 12718 itemsize 53
refs 1 gen 99140 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212145983488 count 1
item 69 key (1200533831680 EXTENT_ITEM 32768) itemoff 12665 itemsize 53
refs 1 gen 99313 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212146016256 count 1
item 70 key (1200533864448 EXTENT_ITEM 32768) itemoff 12612 itemsize 53
refs 1 gen 99417 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212146049024 count 1
item 71 key (1200533897216 EXTENT_ITEM 32768) itemoff 12559 itemsize 53
refs 1 gen 99695 flags DATA
extent data backref root FS_TREE objectid 43141 offset 212146081792 count 1
item 72 key (1200533929984 EXTENT_ITEM 55107584) itemoff 12506 itemsize 53
refs 1 gen 101895 flags DATA
extent data backref root FS_TREE objectid 43141 offset 30104616960 count 1
item 73 key (1200589037568 EXTENT_ITEM 50016256) itemoff 12453 itemsize 53
refs 1 gen 101895 flags DATA
extent data backref root FS_TREE objectid 43141 offset 30337253376 count 1
item 74 key (1200639053824 EXTENT_ITEM 50003968) itemoff 12400 itemsize 53
refs 1 gen 101895 flags DATA
extent data backref root FS_TREE objectid 43141 offset 30387269632 count 1
item 75 key (1200689057792 EXTENT_ITEM 108228608) itemoff 12347 itemsize 53
refs 1 gen 101895 flags DATA
extent data backref root FS_TREE objectid 43141 offset 213084291072 count 1
item 76 key (1200800923648 EXTENT_ITEM 268435456) itemoff 12294 itemsize 53
refs 23 gen 92242 flags DATA
extent data backref root FS_TREE objectid 43141 offset 211258703872 count 23
item 77 key (1201069359104 EXTENT_ITEM 268435456) itemoff 12241 itemsize 53
refs 72 gen 92251 flags DATA
extent data backref root FS_TREE objectid 43141 offset 209379655680 count 72
item 78 key (1201337794560 EXTENT_ITEM 134217728) itemoff 12188 itemsize 53
refs 1 gen 101956 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 209641472 count 1
item 79 key (1201472012288 EXTENT_ITEM 47050752) itemoff 12135 itemsize 53
refs 1 gen 101956 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 343859200 count 1
item 80 key (1201519063040 EXTENT_ITEM 84398080) itemoff 12082 itemsize 53
refs 1 gen 102280 flags DATA
extent data backref root FS_TREE objectid 1784660 offset 2027503616 count 1
item 81 key (1201606230016 EXTENT_ITEM 268435456) itemoff 12029 itemsize 53
refs 125 gen 92251 flags DATA
extent data backref root FS_TREE objectid 43141 offset 209916526592 count 125
item 82 key (1201606230016 BLOCK_GROUP_ITEM 1073741824) itemoff 12005 itemsize 24
block group used 1071144960 chunk_objectid 256 flags DATA
item 83 key (1201874665472 EXTENT_ITEM 268435456) itemoff 11952 itemsize 53
refs 170 gen 92251 flags DATA
extent data backref root FS_TREE objectid 43141 offset 210184962048 count 170
item 84 key (1202143100928 EXTENT_ITEM 268435456) itemoff 11899 itemsize 53
refs 17 gen 92260 flags DATA
extent data backref root FS_TREE objectid 43141 offset 208305913856 count 17
item 85 key (1202411536384 EXTENT_ITEM 134217728) itemoff 11846 itemsize 53
refs 1 gen 101957 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 390909952 count 1
item 86 key (1202545754112 EXTENT_ITEM 47497216) itemoff 11793 itemsize 53
refs 1 gen 101957 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 525127680 count 1
item 87 key (1202593251328 EXTENT_ITEM 24576) itemoff 11740 itemsize 53
refs 1 gen 101957 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 572624896 count 1
item 88 key (1202593275904 EXTENT_ITEM 84099072) itemoff 11687 itemsize 53
refs 1 gen 102282 flags DATA
extent data backref root FS_TREE objectid 1784744 offset 0 count 1
item 89 key (1202679971840 EXTENT_ITEM 268435456) itemoff 11634 itemsize 53
refs 6 gen 92260 flags DATA
extent data backref root FS_TREE objectid 43141 offset 208842784768 count 6
item 90 key (1202679971840 BLOCK_GROUP_ITEM 1073741824) itemoff 11610 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 91 key (1202948407296 EXTENT_ITEM 268435456) itemoff 11557 itemsize 53
refs 48 gen 92260 flags DATA
extent data backref root FS_TREE objectid 43141 offset 209111220224 count 48
item 92 key (1203216842752 EXTENT_ITEM 268435456) itemoff 11504 itemsize 53
refs 23 gen 92269 flags DATA
extent data backref root FS_TREE objectid 43141 offset 207232172032 count 23
item 93 key (1203485278208 EXTENT_ITEM 268435456) itemoff 11451 itemsize 53
refs 3 gen 92269 flags DATA
extent data backref root FS_TREE objectid 43141 offset 205353123840 count 3
item 94 key (1203753713664 EXTENT_ITEM 134217728) itemoff 11398 itemsize 53
refs 1 gen 101958 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 572649472 count 1
item 95 key (1203753713664 BLOCK_GROUP_ITEM 1073741824) itemoff 11374 itemsize 24
block group used 1073631232 chunk_objectid 256 flags DATA
item 96 key (1203887931392 EXTENT_ITEM 46821376) itemoff 11321 itemsize 53
refs 1 gen 101958 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 706867200 count 1
item 97 key (1203934752768 EXTENT_ITEM 45056) itemoff 11268 itemsize 53
refs 1 gen 101958 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 753688576 count 1
item 98 key (1203934797824 EXTENT_ITEM 7651328) itemoff 11215 itemsize 53
refs 1 gen 101958 flags DATA
extent data backref root FS_TREE objectid 1783298 offset 753733632 count 1
item 99 key (1203942449152 EXTENT_ITEM 48918528) itemoff 11162 itemsize 53
refs 1 gen 102293 flags DATA
extent data backref root FS_TREE objectid 1785078 offset 0 count 1
item 100 key (1203991367680 EXTENT_ITEM 30670848) itemoff 11109 itemsize 53
refs 1 gen 102695 flags DATA
extent data backref root FS_TREE objectid 1798244 offset 0 count 1
item 101 key (1204022149120 EXTENT_ITEM 268435456) itemoff 11056 itemsize 53
refs 4 gen 92269 flags DATA
extent data backref root FS_TREE objectid 43141 offset 208037478400 count 4
item 102 key (1204290584576 EXTENT_ITEM 268435456) itemoff 11003 itemsize 53
refs 5 gen 92278 flags DATA
extent data backref root FS_TREE objectid 43141 offset 206158430208 count 5
item 103 key (1204559020032 EXTENT_ITEM 268435456) itemoff 10950 itemsize 53
refs 44 gen 92278 flags DATA
extent data backref root FS_TREE objectid 43141 offset 204279382016 count 44
item 104 key (1204827455488 EXTENT_ITEM 134217728) itemoff 10897 itemsize 53
refs 1 gen 101958 flags DATA
extent data backref root FS_TREE objectid 1784167 offset 0 count 1
item 105 key (1204827455488 BLOCK_GROUP_ITEM 1073741824) itemoff 10873 itemsize 24
block group used 1073741824 chunk_objectid 256 flags DATA
item 106 key (1204961673216 EXTENT_ITEM 134217728) itemoff 10820 itemsize 53
refs 1 gen 101958 flags DATA
extent data backref root FS_TREE objectid 1784167 offset 134217728 count 1
item 107 key (1205095890944 EXTENT_ITEM 268435456) itemoff 10767 itemsize 53
refs 24 gen 92278 flags DATA
extent data backref root FS_TREE objectid 43141 offset 206963736576 count 24
item 108 key (1205364326400 EXTENT_ITEM 268435456) itemoff 10714 itemsize 53
refs 198 gen 92287 flags DATA
extent data backref root FS_TREE objectid 43141 offset 205084688384 count 198
The curious thing is that the shared extents don't show up at all. Not even once.
filefrag -v file | grep -m 10 shared
87954: 52756487..52756516: 291198215.. 291198244: 30: 291722503: shared
87955: 52756518..52756522: 291198246.. 291198250: 5: shared
87956: 52756524..52756528: 291198252.. 291198256: 5: shared
87957: 52756530..52756530: 291198258.. 291198258: 1: shared
87958: 52756532..52756534: 291198260.. 291198262: 3: shared
87959: 52756536..52756546: 291198264.. 291198274: 11: shared
87960: 52756548..52756553: 291198276.. 291198281: 6: shared
87961: 52756555..52756557: 291198283.. 291198285: 3: shared
87962: 52756559..52756578: 291198287.. 291198306: 20: shared
87963: 52756582..52756595: 291198310.. 291198323: 14: shared
btrfs inspect-internal dump-tree /dev/ | grep -C 10 $[291198258*4096]
Chris Murphy reported a problem where filefrag -v was showing an extent shared, but btrfs inspect-internal logical-resolve would only show one file. This is because fiemap is marking the extent as shared when it shouldn't be.
TO REPRODUCE:
btrfs sub create /mnt/test/foo
dd if=/dev/zero of=/mnt/test/foo/file bs=1M count=1 && sync
btrfs inspect-internal dump-tree /dev/whatever
btrfs sub snap /mnt/test/foo /mnt/test/snap
btrfs sub delete /mnt/test/foo
filefrag -v /mnt/test/snap/file
this will show the extent is shared even tho it no longer is.btrfs inspect-internal logical-resolve <bytenr> /mnt/test
just to verify it's still just one root.This is a problem with fiemap, I assume in btrfs_check_shared. We're probably hitting a SHARED extent item, not resolving the root properly, and bailing.