Commit 8df2085
btrfs: update superblock's device bytes_used when dropping chunk
Each superblock contains a copy of the device item for that device. In a
transaction which drops a chunk but doesn't create any new ones, we were
correctly updating the device item in the chunk tree but not copying
over the new bytes_used value to the superblock.
This can be seen by doing the following:
# cd
# dd if=/dev/zero of=test bs=4096 count=2621440
# mkfs.btrfs test
# mount test /root/temp
# cd /root/temp
# for i in {00..10}; do dd if=/dev/zero of=$i bs=4096 count=32768; done
# sync
# rm *
# sync
# btrfs balance start -dusage=0 .
# sync
# cd
# umount /root/temp
# btrfs check test
(For btrfs-check to detect this, you will also need my patch at
kdave/btrfs-progs#991.)
Change btrfs_remove_dev_extents() so that it adds the devices to the
post_commit_list if they're not there already. This causes
btrfs_commit_device_sizes() to be called, which updates the bytes_used
value in the superblock.
Signed-off-by: Mark Harmstone <maharmstone@fb.com>1 parent 18e274f commit 8df2085
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3282 | 3282 | | |
3283 | 3283 | | |
3284 | 3284 | | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
3285 | 3291 | | |
3286 | 3292 | | |
3287 | 3293 | | |
| |||
0 commit comments