From 3d69435ee3292b4b1db2d61c4784789d75883821 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Tue, 26 Jul 2016 13:24:39 +0100 Subject: Imported Upstream version 4.6.1 --- .gitignore | 77 + 64-btrfs-dm.rules | 10 + Android.mk | 111 + CHANGES | 499 + COPYING | 341 + Documentation/Makefile.in | 133 + Documentation/asciidoc.conf | 48 + Documentation/btrfs-balance.asciidoc | 223 + Documentation/btrfs-check.asciidoc | 111 + Documentation/btrfs-convert.asciidoc | 106 + Documentation/btrfs-device.asciidoc | 244 + Documentation/btrfs-filesystem.asciidoc | 373 + Documentation/btrfs-find-root.asciidoc | 35 + Documentation/btrfs-image.asciidoc | 66 + Documentation/btrfs-inspect-internal.asciidoc | 162 + Documentation/btrfs-man5.asciidoc | 465 + Documentation/btrfs-map-logical.asciidoc | 37 + Documentation/btrfs-property.asciidoc | 73 + Documentation/btrfs-qgroup.asciidoc | 145 + Documentation/btrfs-quota.asciidoc | 56 + Documentation/btrfs-receive.asciidoc | 73 + Documentation/btrfs-replace.asciidoc | 80 + Documentation/btrfs-rescue.asciidoc | 90 + Documentation/btrfs-restore.asciidoc | 108 + Documentation/btrfs-scrub.asciidoc | 97 + Documentation/btrfs-select-super.asciidoc | 47 + Documentation/btrfs-send.asciidoc | 76 + Documentation/btrfs-subvolume.asciidoc | 182 + Documentation/btrfs.asciidoc | 127 + Documentation/btrfstune.asciidoc | 75 + Documentation/fsck.btrfs.asciidoc | 51 + Documentation/manpage-base.xsl | 35 + Documentation/manpage-bold-literal.xsl | 17 + Documentation/manpage-normal.xsl | 13 + Documentation/mkfs.btrfs.asciidoc | 354 + INSTALL | 79 + Makefile.extrawarn | 90 + Makefile.in | 441 + README.md | 41 + androidcompat.h | 28 + autogen.sh | 100 + backref.c | 1651 ++++ backref.h | 73 + bcp | 159 + bitops.h | 224 + btrfs-calc-size.c | 36 + btrfs-completion | 152 + btrfs-convert.c | 3073 ++++++ btrfs-corrupt-block.c | 1309 +++ btrfs-crc.c | 95 + btrfs-debug-tree.c | 41 + btrfs-debugfs | 401 + btrfs-find-root.c | 221 + btrfs-fragments.c | 462 + btrfs-image.c | 2930 ++++++ btrfs-list.c | 1915 ++++ btrfs-list.h | 178 + btrfs-map-logical.c | 363 + btrfs-select-super.c | 106 + btrfs-show-super.c | 36 + btrfs-zero-log.c | 76 + btrfs.c | 248 + btrfsck.h | 203 + btrfstune.c | 553 ++ chunk-recover.c | 2407 +++++ cmds-balance.c | 906 ++ cmds-check.c | 9902 ++++++++++++++++++++ cmds-device.c | 591 ++ cmds-fi-du.c | 578 ++ cmds-fi-du.h | 23 + cmds-fi-usage.c | 1031 ++ cmds-fi-usage.h | 57 + cmds-filesystem.c | 1308 +++ cmds-inspect-dump-super.c | 544 ++ cmds-inspect-dump-super.h | 26 + cmds-inspect-dump-tree.c | 551 ++ cmds-inspect-dump-tree.h | 24 + cmds-inspect-tree-stats.c | 506 + cmds-inspect-tree-stats.h | 26 + cmds-inspect.c | 654 ++ cmds-property.c | 461 + cmds-qgroup.c | 508 + cmds-quota.c | 199 + cmds-receive.c | 1306 +++ cmds-replace.c | 561 ++ cmds-rescue.c | 219 + cmds-restore.c | 1608 ++++ cmds-scrub.c | 1805 ++++ cmds-send.c | 744 ++ cmds-subvolume.c | 1297 +++ commands.h | 128 + config.h.in | 132 + config/config.guess | 1568 ++++ config/config.sub | 1788 ++++ config/install-sh | 527 ++ configure | 7453 +++++++++++++++ configure.ac | 183 + crc32c.c | 222 + crc32c.h | 33 + ctree.c | 2977 ++++++ ctree.h | 2599 +++++ dir-item.c | 351 + dir-test.c | 517 + disk-io.c | 1792 ++++ disk-io.h | 168 + extent-cache.c | 341 + extent-cache.h | 121 + extent-tree.c | 4241 +++++++++ extent_io.c | 893 ++ extent_io.h | 159 + file-item.c | 487 + file.c | 162 + find-root.c | 150 + find-root.h | 87 + free-space-cache.c | 879 ++ free-space-cache.h | 62 + free-space-tree.c | 273 + free-space-tree.h | 25 + fsck.btrfs | 39 + hash.h | 28 + hasher.c | 42 + help.c | 271 + inode-item.c | 460 + inode-map.c | 101 + inode.c | 536 ++ internal.h | 42 + interval_tree_generic.h | 193 + ioctl-test.c | 37 + ioctl.h | 729 ++ kerncompat.h | 358 + library-test.c | 69 + list.h | 486 + list_sort.c | 144 + list_sort.h | 14 + m4/ax_check_define.m4 | 92 + mkfs.c | 1845 ++++ print-tree.c | 1157 +++ print-tree.h | 27 + props.c | 194 + props.h | 43 + qgroup-verify.c | 1230 +++ qgroup-verify.h | 32 + qgroup.c | 1398 +++ qgroup.h | 101 + quick-test.c | 221 + radix-tree.c | 849 ++ radix-tree.h | 97 + raid6.c | 101 + random-test.c | 433 + rbtree-utils.c | 82 + rbtree-utils.h | 53 + rbtree.c | 548 ++ rbtree.h | 118 + rbtree_augmented.h | 249 + repair.c | 50 + repair.h | 34 + root-tree.c | 192 + send-stream.c | 499 + send-stream.h | 80 + send-test.c | 447 + send-utils.c | 779 ++ send-utils.h | 108 + send.h | 147 + show-blocks | 325 + string-table.c | 151 + string-table.h | 34 + super-recover.c | 336 + task-utils.c | 143 + task-utils.h | 47 + tests/README.md | 161 + tests/clean-tests.sh | 24 + tests/cli-tests.sh | 40 + tests/cli-tests/001-btrfs/test.sh | 15 + .../cli-tests/002-balance-full-no-filters/test.sh | 21 + tests/cli-tests/003-fi-resize-args/test.sh | 46 + tests/common | 274 + tests/common.convert | 182 + tests/convert-tests.sh | 49 + tests/convert-tests/001-ext2-basic/test.sh | 16 + tests/convert-tests/002-ext3-basic/test.sh | 16 + tests/convert-tests/003-ext4-basic/test.sh | 16 + .../drdhdhdrd.e2image.raw.xz | Bin 0 -> 84564 bytes .../drdhdhrh.e2image.raw.xz | Bin 0 -> 84568 bytes .../hrhdhdrd.e2image.raw.xz | Bin 0 -> 84556 bytes .../hrhdhrh.e2image.raw.xz | Bin 0 -> 84568 bytes .../004-ext2-backup-superblock-ranges/test.sh | 43 + .../convert-tests/005-delete-all-rollback/test.sh | 61 + tests/fsck-tests.sh | 64 + .../001-bad-file-extent-bytenr/default_case.img | Bin 0 -> 4096 bytes tests/fsck-tests/002-bad-transid/default_case.img | Bin 0 -> 4096 bytes .../fsck-tests/003-shift-offsets/default_case.img | Bin 0 -> 4096 bytes tests/fsck-tests/004-no-dir-index/default_case.img | Bin 0 -> 4096 bytes .../005-bad-item-offset/default_case.img | Bin 0 -> 398336 bytes .../006-bad-root-items/default_case.tar.xz | Bin 0 -> 24980 bytes .../006-bad-root-items/skinny_case.tar.xz | Bin 0 -> 26520 bytes tests/fsck-tests/006-bad-root-items/test.sh | 17 + .../007-bad-offset-snapshots/default_case.img | Bin 0 -> 249856 bytes .../008-bad-dir-index-name/default_case.img | Bin 0 -> 4096 bytes .../009-no-dir-item-or-index/default_case.img | Bin 0 -> 4953088 bytes .../010-no-rootdir-inode-item/default_case.img | Bin 0 -> 398336 bytes .../fsck-tests/011-no-inode-item/default_case.img | Bin 0 -> 398336 bytes .../012-leaf-corruption/no_data_extent.tar.xz | Bin 0 -> 130260 bytes tests/fsck-tests/012-leaf-corruption/test.sh | 117 + tests/fsck-tests/013-extent-tree-rebuild/test.sh | 44 + .../fsck-tests/014-no-extent-info/default_case.img | Bin 0 -> 4096 bytes .../bko-97171-btrfs-image.raw.txt | 254 + .../bko-97171-btrfs-image.raw.xz | Bin 0 -> 6748 bytes .../016-wrong-inode-nbytes/default_case.img.xz | Bin 0 -> 1996 bytes .../default_case.img.xz | Bin 0 -> 1104 bytes .../018-leaf-crossing-stripes/default_case.raw.xz | Bin 0 -> 105064 bytes tests/fsck-tests/018-leaf-crossing-stripes/test.sh | 12 + .../019-non-skinny-false-alert/default_case.img.xz | Bin 0 -> 15236 bytes .../fsck-tests/019-non-skinny-false-alert/test.sh | 23 + .../020-extent-ref-cases/keyed_block_ref.img | Bin 0 -> 10240 bytes .../020-extent-ref-cases/keyed_data_ref.img | Bin 0 -> 4096 bytes .../020-extent-ref-cases/no_inline_ref.img | Bin 0 -> 4096 bytes .../020-extent-ref-cases/no_skinny_ref.img | Bin 0 -> 3072 bytes .../020-extent-ref-cases/shared_block_ref.img | Bin 0 -> 23552 bytes .../020-extent-ref-cases/shared_data_ref.img | Bin 0 -> 5120 bytes tests/fsck-tests/020-extent-ref-cases/test.sh | 23 + tests/fuzz-tests.sh | 40 + tests/fuzz-tests/001-simple-unmounted/test.sh | 20 + tests/fuzz-tests/images/bad-superblock-1.raw.xz | Bin 0 -> 228 bytes tests/fuzz-tests/images/bad-superblock-2.raw.xz | Bin 0 -> 228 bytes tests/fuzz-tests/images/bad-superblock-3.raw.xz | Bin 0 -> 228 bytes tests/fuzz-tests/images/bad-superblock.txt | 17 + .../images/bko-104131-fsck-oob-read.raw.xz | Bin 0 -> 192 bytes .../fuzz-tests/images/bko-104131-fsck-oob-read.txt | 31 + .../images/bko-104141-fsck-exception.raw.xz | Bin 0 -> 196 bytes .../images/bko-104141-fsck-exception.txt | 9 + .../fuzz-tests/images/bko-96971-btrfs-image.raw.xz | Bin 0 -> 6448 bytes tests/fuzz-tests/images/bko-96971-btrfs-image.txt | 69 + .../images/bko-97191-btrfs-image.raw.txt | 137 + .../fuzz-tests/images/bko-97191-btrfs-image.raw.xz | Bin 0 -> 7076 bytes .../images/bko-97271-btrfs-image.raw.txt | 54 + .../fuzz-tests/images/bko-97271-btrfs-image.raw.xz | Bin 0 -> 6580 bytes .../images/superblock-stripsize-bogus.raw.txt | 32 + .../images/superblock-stripsize-bogus.raw.xz | Bin 0 -> 41512 bytes .../images/superblock-total-bytes-0.raw.txt | 50 + .../images/superblock-total-bytes-0.raw.xz | Bin 0 -> 41424 bytes .../images/sys-array-num-stripes-0.raw.txt | 30 + .../images/sys-array-num-stripes-0.raw.xz | Bin 0 -> 8364 bytes .../images/sys-chunk-stripe-len-bogus.raw.txt | 54 + .../images/sys-chunk-stripe-len-bogus.raw.xz | Bin 0 -> 41440 bytes .../fuzz-tests/images/sys-chunk-type-bogus.raw.txt | 55 + .../fuzz-tests/images/sys-chunk-type-bogus.raw.xz | Bin 0 -> 41524 bytes tests/misc-tests.sh | 43 + tests/misc-tests/001-btrfstune-features/test.sh | 46 + tests/misc-tests/002-uuid-rewrite/test.sh | 66 + tests/misc-tests/003-zero-log/test.sh | 52 + tests/misc-tests/004-shrink-fs/test.sh | 72 + .../005-convert-progress-thread-crash/test.sh | 15 + .../misc-tests/006-image-on-missing-device/test.sh | 78 + tests/misc-tests/007-subvolume-sync/test.sh | 32 + tests/misc-tests/008-leaf-crossing-stripes/test.sh | 25 + .../009-subvolume-sync-must-wait/test.sh | 52 + .../010-convert-delete-ext2-subvol/test.sh | 26 + tests/misc-tests/011-delete-missing-device/test.sh | 83 + .../first_meta_chunk.btrfs-image | Bin 0 -> 4096 bytes tests/misc-tests/012-find-root-no-result/test.sh | 24 + tests/misc-tests/013-subvolume-sync-crash/test.sh | 49 + tests/misc-tests/014-filesystem-label/test.sh | 69 + tests/mkfs-tests.sh | 40 + tests/mkfs-tests/001-basic-profiles/test.sh | 93 + .../002-no-force-mixed-on-small-volume/test.sh | 13 + .../003-mixed-with-wrong-nodesize/test.sh | 12 + tests/mkfs-tests/004-rootdir-keeps-size/test.sh | 31 + .../005-long-device-name-for-ssd/test.sh | 41 + .../006-partitioned-loopdev/partition-1g-1g | Bin 0 -> 512 bytes tests/mkfs-tests/006-partitioned-loopdev/test.sh | 27 + .../mkfs-tests/007-mix-nodesize-sectorsize/test.sh | 36 + .../008-secorsize-nodesize-combination/test.sh | 50 + tests/test-console.sh | 23 + transaction.h | 64 + ulist.c | 253 + ulist.h | 81 + utils-lib.c | 40 + utils.c | 4133 ++++++++ utils.h | 402 + uuid-tree.c | 105 + version.h.in | 14 + version.sh | 37 + volumes.c | 2172 +++++ volumes.h | 229 + 284 files changed, 102719 insertions(+) create mode 100644 .gitignore create mode 100644 64-btrfs-dm.rules create mode 100644 Android.mk create mode 100644 CHANGES create mode 100644 COPYING create mode 100644 Documentation/Makefile.in create mode 100644 Documentation/asciidoc.conf create mode 100644 Documentation/btrfs-balance.asciidoc create mode 100644 Documentation/btrfs-check.asciidoc create mode 100644 Documentation/btrfs-convert.asciidoc create mode 100644 Documentation/btrfs-device.asciidoc create mode 100644 Documentation/btrfs-filesystem.asciidoc create mode 100644 Documentation/btrfs-find-root.asciidoc create mode 100644 Documentation/btrfs-image.asciidoc create mode 100644 Documentation/btrfs-inspect-internal.asciidoc create mode 100644 Documentation/btrfs-man5.asciidoc create mode 100644 Documentation/btrfs-map-logical.asciidoc create mode 100644 Documentation/btrfs-property.asciidoc create mode 100644 Documentation/btrfs-qgroup.asciidoc create mode 100644 Documentation/btrfs-quota.asciidoc create mode 100644 Documentation/btrfs-receive.asciidoc create mode 100644 Documentation/btrfs-replace.asciidoc create mode 100644 Documentation/btrfs-rescue.asciidoc create mode 100644 Documentation/btrfs-restore.asciidoc create mode 100644 Documentation/btrfs-scrub.asciidoc create mode 100644 Documentation/btrfs-select-super.asciidoc create mode 100644 Documentation/btrfs-send.asciidoc create mode 100644 Documentation/btrfs-subvolume.asciidoc create mode 100644 Documentation/btrfs.asciidoc create mode 100644 Documentation/btrfstune.asciidoc create mode 100644 Documentation/fsck.btrfs.asciidoc create mode 100644 Documentation/manpage-base.xsl create mode 100644 Documentation/manpage-bold-literal.xsl create mode 100644 Documentation/manpage-normal.xsl create mode 100644 Documentation/mkfs.btrfs.asciidoc create mode 100644 INSTALL create mode 100644 Makefile.extrawarn create mode 100644 Makefile.in create mode 100644 README.md create mode 100644 androidcompat.h create mode 100755 autogen.sh create mode 100644 backref.c create mode 100644 backref.h create mode 100755 bcp create mode 100644 bitops.h create mode 100644 btrfs-calc-size.c create mode 100644 btrfs-completion create mode 100644 btrfs-convert.c create mode 100644 btrfs-corrupt-block.c create mode 100644 btrfs-crc.c create mode 100644 btrfs-debug-tree.c create mode 100755 btrfs-debugfs create mode 100644 btrfs-find-root.c create mode 100644 btrfs-fragments.c create mode 100644 btrfs-image.c create mode 100644 btrfs-list.c create mode 100644 btrfs-list.h create mode 100644 btrfs-map-logical.c create mode 100644 btrfs-select-super.c create mode 100644 btrfs-show-super.c create mode 100644 btrfs-zero-log.c create mode 100644 btrfs.c create mode 100644 btrfsck.h create mode 100644 btrfstune.c create mode 100644 chunk-recover.c create mode 100644 cmds-balance.c create mode 100644 cmds-check.c create mode 100644 cmds-device.c create mode 100644 cmds-fi-du.c create mode 100644 cmds-fi-du.h create mode 100644 cmds-fi-usage.c create mode 100644 cmds-fi-usage.h create mode 100644 cmds-filesystem.c create mode 100644 cmds-inspect-dump-super.c create mode 100644 cmds-inspect-dump-super.h create mode 100644 cmds-inspect-dump-tree.c create mode 100644 cmds-inspect-dump-tree.h create mode 100644 cmds-inspect-tree-stats.c create mode 100644 cmds-inspect-tree-stats.h create mode 100644 cmds-inspect.c create mode 100644 cmds-property.c create mode 100644 cmds-qgroup.c create mode 100644 cmds-quota.c create mode 100644 cmds-receive.c create mode 100644 cmds-replace.c create mode 100644 cmds-rescue.c create mode 100644 cmds-restore.c create mode 100644 cmds-scrub.c create mode 100644 cmds-send.c create mode 100644 cmds-subvolume.c create mode 100644 commands.h create mode 100644 config.h.in create mode 100755 config/config.guess create mode 100755 config/config.sub create mode 100755 config/install-sh create mode 100755 configure create mode 100644 configure.ac create mode 100644 crc32c.c create mode 100644 crc32c.h create mode 100644 ctree.c create mode 100644 ctree.h create mode 100644 dir-item.c create mode 100644 dir-test.c create mode 100644 disk-io.c create mode 100644 disk-io.h create mode 100644 extent-cache.c create mode 100644 extent-cache.h create mode 100644 extent-tree.c create mode 100644 extent_io.c create mode 100644 extent_io.h create mode 100644 file-item.c create mode 100644 file.c create mode 100644 find-root.c create mode 100644 find-root.h create mode 100644 free-space-cache.c create mode 100644 free-space-cache.h create mode 100644 free-space-tree.c create mode 100644 free-space-tree.h create mode 100755 fsck.btrfs create mode 100644 hash.h create mode 100644 hasher.c create mode 100644 help.c create mode 100644 inode-item.c create mode 100644 inode-map.c create mode 100644 inode.c create mode 100644 internal.h create mode 100644 interval_tree_generic.h create mode 100644 ioctl-test.c create mode 100644 ioctl.h create mode 100644 kerncompat.h create mode 100644 library-test.c create mode 100644 list.h create mode 100644 list_sort.c create mode 100644 list_sort.h create mode 100644 m4/ax_check_define.m4 create mode 100644 mkfs.c create mode 100644 print-tree.c create mode 100644 print-tree.h create mode 100644 props.c create mode 100644 props.h create mode 100644 qgroup-verify.c create mode 100644 qgroup-verify.h create mode 100644 qgroup.c create mode 100644 qgroup.h create mode 100644 quick-test.c create mode 100644 radix-tree.c create mode 100644 radix-tree.h create mode 100644 raid6.c create mode 100644 random-test.c create mode 100644 rbtree-utils.c create mode 100644 rbtree-utils.h create mode 100644 rbtree.c create mode 100644 rbtree.h create mode 100644 rbtree_augmented.h create mode 100644 repair.c create mode 100644 repair.h create mode 100644 root-tree.c create mode 100644 send-stream.c create mode 100644 send-stream.h create mode 100644 send-test.c create mode 100644 send-utils.c create mode 100644 send-utils.h create mode 100644 send.h create mode 100755 show-blocks create mode 100644 string-table.c create mode 100644 string-table.h create mode 100644 super-recover.c create mode 100644 task-utils.c create mode 100644 task-utils.h create mode 100644 tests/README.md create mode 100755 tests/clean-tests.sh create mode 100755 tests/cli-tests.sh create mode 100755 tests/cli-tests/001-btrfs/test.sh create mode 100755 tests/cli-tests/002-balance-full-no-filters/test.sh create mode 100755 tests/cli-tests/003-fi-resize-args/test.sh create mode 100644 tests/common create mode 100644 tests/common.convert create mode 100755 tests/convert-tests.sh create mode 100755 tests/convert-tests/001-ext2-basic/test.sh create mode 100755 tests/convert-tests/002-ext3-basic/test.sh create mode 100755 tests/convert-tests/003-ext4-basic/test.sh create mode 100644 tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhdrd.e2image.raw.xz create mode 100644 tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhrh.e2image.raw.xz create mode 100644 tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhdrd.e2image.raw.xz create mode 100644 tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhrh.e2image.raw.xz create mode 100755 tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh create mode 100755 tests/convert-tests/005-delete-all-rollback/test.sh create mode 100755 tests/fsck-tests.sh create mode 100644 tests/fsck-tests/001-bad-file-extent-bytenr/default_case.img create mode 100644 tests/fsck-tests/002-bad-transid/default_case.img create mode 100644 tests/fsck-tests/003-shift-offsets/default_case.img create mode 100644 tests/fsck-tests/004-no-dir-index/default_case.img create mode 100644 tests/fsck-tests/005-bad-item-offset/default_case.img create mode 100644 tests/fsck-tests/006-bad-root-items/default_case.tar.xz create mode 100644 tests/fsck-tests/006-bad-root-items/skinny_case.tar.xz create mode 100755 tests/fsck-tests/006-bad-root-items/test.sh create mode 100644 tests/fsck-tests/007-bad-offset-snapshots/default_case.img create mode 100644 tests/fsck-tests/008-bad-dir-index-name/default_case.img create mode 100644 tests/fsck-tests/009-no-dir-item-or-index/default_case.img create mode 100644 tests/fsck-tests/010-no-rootdir-inode-item/default_case.img create mode 100644 tests/fsck-tests/011-no-inode-item/default_case.img create mode 100644 tests/fsck-tests/012-leaf-corruption/no_data_extent.tar.xz create mode 100755 tests/fsck-tests/012-leaf-corruption/test.sh create mode 100755 tests/fsck-tests/013-extent-tree-rebuild/test.sh create mode 100644 tests/fsck-tests/014-no-extent-info/default_case.img create mode 100644 tests/fsck-tests/015-check-bad-memory-access/bko-97171-btrfs-image.raw.txt create mode 100644 tests/fsck-tests/015-check-bad-memory-access/bko-97171-btrfs-image.raw.xz create mode 100644 tests/fsck-tests/016-wrong-inode-nbytes/default_case.img.xz create mode 100644 tests/fsck-tests/017-missing-all-file-extent/default_case.img.xz create mode 100644 tests/fsck-tests/018-leaf-crossing-stripes/default_case.raw.xz create mode 100755 tests/fsck-tests/018-leaf-crossing-stripes/test.sh create mode 100644 tests/fsck-tests/019-non-skinny-false-alert/default_case.img.xz create mode 100755 tests/fsck-tests/019-non-skinny-false-alert/test.sh create mode 100644 tests/fsck-tests/020-extent-ref-cases/keyed_block_ref.img create mode 100644 tests/fsck-tests/020-extent-ref-cases/keyed_data_ref.img create mode 100644 tests/fsck-tests/020-extent-ref-cases/no_inline_ref.img create mode 100644 tests/fsck-tests/020-extent-ref-cases/no_skinny_ref.img create mode 100644 tests/fsck-tests/020-extent-ref-cases/shared_block_ref.img create mode 100644 tests/fsck-tests/020-extent-ref-cases/shared_data_ref.img create mode 100755 tests/fsck-tests/020-extent-ref-cases/test.sh create mode 100755 tests/fuzz-tests.sh create mode 100755 tests/fuzz-tests/001-simple-unmounted/test.sh create mode 100644 tests/fuzz-tests/images/bad-superblock-1.raw.xz create mode 100644 tests/fuzz-tests/images/bad-superblock-2.raw.xz create mode 100644 tests/fuzz-tests/images/bad-superblock-3.raw.xz create mode 100644 tests/fuzz-tests/images/bad-superblock.txt create mode 100644 tests/fuzz-tests/images/bko-104131-fsck-oob-read.raw.xz create mode 100644 tests/fuzz-tests/images/bko-104131-fsck-oob-read.txt create mode 100644 tests/fuzz-tests/images/bko-104141-fsck-exception.raw.xz create mode 100644 tests/fuzz-tests/images/bko-104141-fsck-exception.txt create mode 100644 tests/fuzz-tests/images/bko-96971-btrfs-image.raw.xz create mode 100644 tests/fuzz-tests/images/bko-96971-btrfs-image.txt create mode 100644 tests/fuzz-tests/images/bko-97191-btrfs-image.raw.txt create mode 100644 tests/fuzz-tests/images/bko-97191-btrfs-image.raw.xz create mode 100644 tests/fuzz-tests/images/bko-97271-btrfs-image.raw.txt create mode 100644 tests/fuzz-tests/images/bko-97271-btrfs-image.raw.xz create mode 100644 tests/fuzz-tests/images/superblock-stripsize-bogus.raw.txt create mode 100644 tests/fuzz-tests/images/superblock-stripsize-bogus.raw.xz create mode 100644 tests/fuzz-tests/images/superblock-total-bytes-0.raw.txt create mode 100644 tests/fuzz-tests/images/superblock-total-bytes-0.raw.xz create mode 100644 tests/fuzz-tests/images/sys-array-num-stripes-0.raw.txt create mode 100644 tests/fuzz-tests/images/sys-array-num-stripes-0.raw.xz create mode 100644 tests/fuzz-tests/images/sys-chunk-stripe-len-bogus.raw.txt create mode 100644 tests/fuzz-tests/images/sys-chunk-stripe-len-bogus.raw.xz create mode 100644 tests/fuzz-tests/images/sys-chunk-type-bogus.raw.txt create mode 100644 tests/fuzz-tests/images/sys-chunk-type-bogus.raw.xz create mode 100755 tests/misc-tests.sh create mode 100755 tests/misc-tests/001-btrfstune-features/test.sh create mode 100755 tests/misc-tests/002-uuid-rewrite/test.sh create mode 100755 tests/misc-tests/003-zero-log/test.sh create mode 100755 tests/misc-tests/004-shrink-fs/test.sh create mode 100755 tests/misc-tests/005-convert-progress-thread-crash/test.sh create mode 100755 tests/misc-tests/006-image-on-missing-device/test.sh create mode 100755 tests/misc-tests/007-subvolume-sync/test.sh create mode 100755 tests/misc-tests/008-leaf-crossing-stripes/test.sh create mode 100755 tests/misc-tests/009-subvolume-sync-must-wait/test.sh create mode 100755 tests/misc-tests/010-convert-delete-ext2-subvol/test.sh create mode 100755 tests/misc-tests/011-delete-missing-device/test.sh create mode 100644 tests/misc-tests/012-find-root-no-result/first_meta_chunk.btrfs-image create mode 100755 tests/misc-tests/012-find-root-no-result/test.sh create mode 100755 tests/misc-tests/013-subvolume-sync-crash/test.sh create mode 100755 tests/misc-tests/014-filesystem-label/test.sh create mode 100755 tests/mkfs-tests.sh create mode 100755 tests/mkfs-tests/001-basic-profiles/test.sh create mode 100755 tests/mkfs-tests/002-no-force-mixed-on-small-volume/test.sh create mode 100755 tests/mkfs-tests/003-mixed-with-wrong-nodesize/test.sh create mode 100755 tests/mkfs-tests/004-rootdir-keeps-size/test.sh create mode 100755 tests/mkfs-tests/005-long-device-name-for-ssd/test.sh create mode 100644 tests/mkfs-tests/006-partitioned-loopdev/partition-1g-1g create mode 100755 tests/mkfs-tests/006-partitioned-loopdev/test.sh create mode 100755 tests/mkfs-tests/007-mix-nodesize-sectorsize/test.sh create mode 100755 tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh create mode 100755 tests/test-console.sh create mode 100644 transaction.h create mode 100644 ulist.c create mode 100644 ulist.h create mode 100644 utils-lib.c create mode 100644 utils.c create mode 100644 utils.h create mode 100644 uuid-tree.c create mode 100644 version.h.in create mode 100755 version.sh create mode 100644 volumes.c create mode 100644 volumes.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..214103d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,77 @@ +*.o +*.static.o +*.o.d +tags +.cc-defines.h +version.h +version +man/*.gz +Documentation/*.gz +Documentation/*.html +btrfs +btrfs.static +btrfs-debug-tree +btrfs-map-logical +btrfs-fragments +btrfsck +calc-size +ioctl-test +dir-test +send-test +quick-test +find-root +mkfs.btrfs +mkfs.btrfs.static +repair +restore +btrfs-convert +btrfs-find-root +btrfs-find-root.static +btrfs-image +btrfs-show-super +btrfs-zero-log +btrfs-corrupt-block +btrfs-select-super +btrfs-calc-size +btrfs-crc +btrfstune +libbtrfs.a +libbtrfs.so +libbtrfs.so.0 +libbtrfs.so.0.1 +library-test +library-test-static + +/tests/*-tests-results.txt +/tests/test-console.txt +/tests/test.img +/tests/mnt/ + +aclocal.m4 +autom4te.cache +compile +config.cache +config.guess +config.h +config.h.in +config.h.in~ +config.log +config.rpath +config.status +config.sub +config/ltmain.sh +config/py-compile +config/test-driver +configure +cscope.out +depcomp +libtool +Makefile +Documentation/Makefile +missing +mkinstalldirs +stamp-h +stamp-h.in +stamp-h1 +config/* + diff --git a/64-btrfs-dm.rules b/64-btrfs-dm.rules new file mode 100644 index 00000000..b2e49f4e --- /dev/null +++ b/64-btrfs-dm.rules @@ -0,0 +1,10 @@ +SUBSYSTEM!="block", GOTO="btrfs_end" +KERNEL!="dm-[0-9]*", GOTO="btrfs_end" +ACTION!="add|change", GOTO="btrfs_end" +ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end" + +# Once the device mapper symlink is created, tell btrfs about it +# so we get the friendly name in /proc/mounts (and tools that read it) +ENV{DM_NAME}=="?*", RUN{builtin}+="btrfs ready /dev/mapper/$env{DM_NAME}" + +LABEL="btrfs_end" diff --git a/Android.mk b/Android.mk new file mode 100644 index 00000000..fe3209b6 --- /dev/null +++ b/Android.mk @@ -0,0 +1,111 @@ +LOCAL_PATH:= $(call my-dir) + +#include $(call all-subdir-makefiles) + +CFLAGS := -g -O1 -Wall -D_FORTIFY_SOURCE=2 -include config.h \ + -DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC + +LDFLAGS := -static -rdynamic + +LIBS := -luuid -lblkid -lz -llzo2 -L. -lpthread +LIBBTRFS_LIBS := $(LIBS) + +STATIC_CFLAGS := $(CFLAGS) -ffunction-sections -fdata-sections +STATIC_LDFLAGS := -static -Wl,--gc-sections +STATIC_LIBS := -luuid -lblkid -luuid -lz -llzo2 -L. -pthread + +btrfs_shared_libraries := libext2_uuid \ + libext2_blkid + +objects := ctree.c disk-io.c radix-tree.c extent-tree.c print-tree.c \ + root-tree.c dir-item.c file-item.c inode-item.c inode-map.c \ + extent-cache.c extent_io.c volumes.c utils.c repair.c \ + qgroup.c raid6.c free-space-cache.c list_sort.c props.c \ + ulist.c qgroup-verify.c backref.c string-table.c task-utils.c \ + inode.c file.c find-root.c +cmds_objects := cmds-subvolume.c cmds-filesystem.c cmds-device.c cmds-scrub.c \ + cmds-inspect.c cmds-balance.c cmds-send.c cmds-receive.c \ + cmds-quota.c cmds-qgroup.c cmds-replace.c cmds-check.c \ + cmds-restore.c cmds-rescue.c chunk-recover.c super-recover.c \ + cmds-property.c cmds-fi-usage.c +libbtrfs_objects := send-stream.c send-utils.c rbtree.c btrfs-list.c crc32c.c \ + uuid-tree.c utils-lib.c rbtree-utils.c +libbtrfs_headers := send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \ + crc32c.h list.h kerncompat.h radix-tree.h extent-cache.h \ + extent_io.h ioctl.h ctree.h btrfsck.h version.h +TESTS := fsck-tests.sh convert-tests.sh +blkid_objects := partition/ superblocks/ topology/ + + +# external/e2fsprogs/lib is needed for uuid/uuid.h +common_C_INCLUDES := $(LOCAL_PATH) external/e2fsprogs/lib/ external/lzo/include/ external/zlib/ + +#---------------------------------------------------------- +include $(CLEAR_VARS) +LOCAL_SRC_FILES := $(libbtrfs_objects) +LOCAL_CFLAGS := $(STATIC_CFLAGS) +LOCAL_MODULE := libbtrfs +LOCAL_C_INCLUDES := $(common_C_INCLUDES) +include $(BUILD_STATIC_LIBRARY) + +#---------------------------------------------------------- +include $(CLEAR_VARS) +LOCAL_MODULE := btrfs +#LOCAL_FORCE_STATIC_EXECUTABLE := true +LOCAL_SRC_FILES := \ + $(objects) \ + $(cmds_objects) \ + btrfs.c \ + help.c \ + +LOCAL_C_INCLUDES := $(common_C_INCLUDES) +LOCAL_CFLAGS := $(STATIC_CFLAGS) +#LOCAL_LDLIBS := $(LIBBTRFS_LIBS) +#LOCAL_LDFLAGS := $(STATIC_LDFLAGS) +LOCAL_SHARED_LIBRARIES := $(btrfs_shared_libraries) +LOCAL_STATIC_LIBRARIES := libbtrfs liblzo-static libz +LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils + +LOCAL_EXPORT_C_INCLUDES := $(common_C_INCLUDES) +#LOCAL_MODULE_TAGS := optional +include $(BUILD_EXECUTABLE) + +#---------------------------------------------------------- +include $(CLEAR_VARS) +LOCAL_MODULE := mkfs.btrfs +LOCAL_SRC_FILES := \ + $(objects) \ + mkfs.c + +LOCAL_C_INCLUDES := $(common_C_INCLUDES) +LOCAL_CFLAGS := $(STATIC_CFLAGS) +#LOCAL_LDLIBS := $(LIBBTRFS_LIBS) +#LOCAL_LDFLAGS := $(STATIC_LDFLAGS) +LOCAL_SHARED_LIBRARIES := $(btrfs_shared_libraries) +LOCAL_STATIC_LIBRARIES := libbtrfs liblzo-static +LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils + +LOCAL_EXPORT_C_INCLUDES := $(common_C_INCLUDES) +#LOCAL_MODULE_TAGS := optional +include $(BUILD_EXECUTABLE) + +#--------------------------------------------------------------- +include $(CLEAR_VARS) +LOCAL_MODULE := btrfstune +LOCAL_SRC_FILES := \ + $(objects) \ + btrfstune.c + +LOCAL_C_INCLUDES := $(common_C_INCLUDES) +LOCAL_CFLAGS := $(STATIC_CFLAGS) +LOCAL_SHARED_LIBRARIES := $(btrfs_shared_libraries) +#LOCAL_LDLIBS := $(LIBBTRFS_LIBS) +#LOCAL_LDFLAGS := $(STATIC_LDFLAGS) +LOCAL_SHARED_LIBRARIES := $(btrfs_shared_libraries) +LOCAL_STATIC_LIBRARIES := libbtrfs liblzo-static +LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils + +LOCAL_EXPORT_C_INCLUDES := $(common_C_INCLUDES) +LOCAL_MODULE_TAGS := optional +include $(BUILD_EXECUTABLE) +#-------------------------------------------------------------- diff --git a/CHANGES b/CHANGES new file mode 100644 index 00000000..db900588 --- /dev/null +++ b/CHANGES @@ -0,0 +1,499 @@ +btrfs-progs-4.6.1 (2016-06-24) + * fi resize: negative resize argument accepted again (broken + * qgroup rescan: fix skipping when rescan is in progress + * mkfs: initialize stripesize to correct value + * testsuite updates, mostly convert tests + * documentation updates + * btrfs-device, btrfs-restore manual pages enhanced + * misc fixups + +btrfs-progs-4.6 (2016-06-10) + * convert - major rewrite: + * fix a long-standing bug that led to mixing data blocks into metadata block + groups + * the workaround was to do full balance after conversion, which was + recommended practice anyway + * explicitly set the lowest supported version of e2fstools to 1.41 + * provide and install udev rules file that addresses problems with device + mapper devices, renames after removal + * send: new option: quiet + * dev usage: report slack space (device size minus filesystem area on the dev) + * image: support DUP + * build: short options to enable debugging builds + * other: + * code cleanups + * build fixes + * more tests and other enhancements + +btrfs-progs-4.5.3 (2016-05-11) + * ioctl: fix unaligned access in buffer from TREE_SEARCH; might cause SIGBUS + on architectures that do not support unaligned access and do not performa + any fixups + * improved validation checks of superblock and chunk-related structures + * subvolume sync: fix handling of -s option + * balance: adjust timing of safety delay countdown with --full-balance + * rescue super-recover: fix reversed condition check + * check: fix bytes_used accounting + * documentation updates: mount options, scrub, send, receive, select-super, + check, mkfs + * testing: new fuzzed images, for superblock and chunks + +btrfs-progs-4.5.2 (2016-05-02) + * new/moved command: btrfs-calc-stats -> btrfs inspect tree-stats + * check: fix false alert for metadata blocks crossing stripe boundary + * check: catch when qgroup numbers mismatch + * check: detect running quota rescan and report mismatches + * balance start: add safety delay before doing a full balance + * fi sync: is now silent + * fi show: don't miss filesystems with partially matching uuids + * dev ready: accept only one argument for device + * dev stats: print "devid:N" for a missing device instead of "(null)" + * other: + * lowest supported version of e2fsprogs is 1.41 + * minor cleanups, test updates + +btrfs-progs-4.5.1 (2016-03-31) + * mkfs: allow DUP on multi-device filesystems + * bugfixes: build fixes, assorted other fixes + +btrfs-progs-4.5 (2016-03-20) + New/moved commands: + * btrfs-show-super -> btrfs inspect-internal dump-super + * btrfs-debug-tree -> btrfs inspect-internal dump-tree + + New commands: + * btrfs fi du - calculate disk usage, including shared extents + + Enhancements: + * device delete - delete by id (needs kernel support, not merged to + 4.6) + * check - new option to specify chunk root + * debug-tree/dump-tree - option -t understands human readable name of + the tree (along numerical ids) + * btrfs-debugfs - can dump block group information + + Bugfixes: + * all commands should accept the option separator "--" + * several fixes in device scan + * restore works on filesystems with sectorsize > 4k + * debug-tree/dump-tree - print compression type as string + * subvol sync: fix crash, memory corruption + * argument parsing fixes: subvol get-default, qgroup create/destroy/ + assign, inspect subvolid-resolve + * check for block device or regular file in several commands + + Other: + * documentation updates + * manual pages for the moved tools now point to btrfs-filesystem + * testsuite updates + +btrfs-progs-4.4.1 (2016-02-26) + * find-root: don't skip the first chunk + * free-space-tree compat bits fix + * build: target symlinks + * documentation updates + * test updates + +btrfs-progs-4.4 (2016-01-18) + User visible changes: + * mkfs.btrfs --data dup + + People asked about duplicating data on a single device for a long time. There + are no technical obstacles preventing that, so it got enabled with a warning + about potential dangers when the device will not do the duplicated copies. See + mkfs.btrfs section DUP PROFILES ON A SINGLE DEVICE. + + * support balance filters added/enhanced in linux 4.4 + * usage=min..max -- enhanced to take range + * stripes=min..max -- new, filter by stripes for raid0/10/5/6 + * limit=min..max -- enhanced to take range + Note: due to backward compatibility, the range maximum for 'usage' is not + inclusive as for the others, to keep the same behaviour as usage=N . + + * manual pages enhanced (btrfs, mkfs, mount, filesystem, balance) + * error messages updates, rewordings -- some fstests may break due to that + * added support for free-space-tree implementation of space cache -- this + requires kernel 4.5 and is not recommended for non-developers yet + * btrfs filesystem usage works with mixed blockgroups + + Other: + * installation to /usr/local -- this has unintentionally changed during + conversion to autotools in 3.19 + * check: fix a false alert where extent record has wrong metadata flag + * improved stability on fuzzed/crafted images when reading sys array in + superblock + * build: the 'ar' tool is properly detected during cross-compilation + * debug-tree: option -t understands ids for tree root and chunk tree + * preparatory work for btrfs-convert rewrite + * sparse, gcc warning fixes + * more memory allocation failure handling + * cleanups + * more tests + + Bugfixes: + * chunk recovery: fix floating point exception + * chunk recovery: endianity bugfix during rebuild + * mkfs with 64K pages and nodesize reported superblock checksum mismatch + * check: properly reset nlink of multi-linked file + +btrfs-progs-4.3.1 (2015-11-16) + * fixes + * device delete: recognize 'missing' again + * mkfs: long names are not trimmed when doing ssd check + * support partitioned loop devices + * other + * replace several mallocs with on-stack variables + * more memory allocation failure handling + * add tests for bugs fixed + * cmd-device: switch to new message printing helpers + * minor code cleanups + +btrfs-progs-4.3 (2015-11-06) + * mkfs + * mixed mode is not forced for filesystems smaller than 1GiB + * mixed mode broken with mismatching sectorsize and nodesize, fixed + * print version info earlier + * print devices sorted by id + * do not truncate target image with --rootsize + * fi usage: + * don't print global block reserve + * print device id + * minor output tuning + * other cleanups + * calc-size: + * div-by-zero fix on an empty filesystem + * fix crash + * bugfixes: + * more superblock sanity checks + * consistently round size of all devices down to sectorsize + * misc leak fixes + * convert: don't try to rollback with a half-deleted ext2_saved + subvolume + * other: + * check: add progress indicator + * scrub: enhanced error message + * show-super: read superblock from a given offset + * add README + * docs: update manual page for mkfs.btrfs, btrfstune, balance, + convert and inspect-internal + * build: optional build with more warnings (W=...) + * build: better support for static checkers + * build: html output of documentation + * pretty-print: last_snapshot for root_item + * pretty-print: stripe dev uuid + * error reporting wrappers, introduced and example use + * refactor open_file_or_dir + * other docs and help updates + * testing: + * test for nodes crossing stripes + * test for broken 'subvolume sync' + * basic tests for mkfs, raid option combinations + * basic tests for fuzzed images (check) + * command intrumentation (eg valgrind) + * print commands if requested + * add README for tests + +btrfs-progs-4.2.3 (2015-10-19) + * subvol sync: make it actually work again: it's been broken since 4.1.2, + due to a reversed condition it returned immediately instead of waiting + * scanning: do not scan already discovered filesystems (minor optimization) + * convert: better error message in case the filesystem is not finalized + * restore: off-by-one symlink path check fix + +btrfs-progs-4.2.2 (2015-10-05) + * fi label: use fallback if the label ioctl is not available + * convert: check nodesize constraints against commandline features (-O) + * scrub: report status 'running' until all devices are finished + * device scanning might crash in some scenarios + * fi usage: print summary for non-root users + +btrfs-progs-4.2.1 (2015-09-20) + * fix an off-by-one error in cross-stripe boundary check + * if nodesize was 64k, any metadata block was reported as crossing, + this leads to mkfs failure for example due to "no free blocks + found" + * for other nodesizes, if the end of the metadata block was 64k + aligned, it was incorrectly reported by fsck + * convert: don't write uninitialized data to image + * image: + * don't loop with option -t0 + * don't create threads if compression is not requested + * other: minor cleanups + +btrfs-progs-4.2 (2015-09-03) + * enhancements: + * mkfs: do not create extra single chunks on multiple devices + * resize: try to guess the minimal size, 'inspect min-dev-size' + * qgroup assign: add option to schedule rescan + * chunk-recover: be more verbose about the scanning process + * fixes: + * check: + * find stripes crossing stripe boundary -- created by convert + * print correct range for file hole when there are no extents + and learn how to fix it + * replace: more sanity checks + * convert: concurrency fixes related to reporting progress + * find-root: option -a will not skip the current root anymore + * subvol list: fix occasional crash + * do not create stripes crossing stripe boundary + * build: + * fixes for musl libc + * preliminary support for android (not working yet, more code changes + needed) + * new EXTRA_CFLAGS and EXTRA_LDFLAGS + * other: + * lots of cleanups + * tests: lots of updates, new tests, framework improvements + * documentation updates + * debugging: print-tree shows stripe length + +btrfs-progs-4.1.2 (2015-07-14) + * urgent bugfix: mkfs creates invalid filesystem, must be recreated + +btrfs-progs-4.1.1 (2015-07-10) -- Do not use this version! + Bugfixes: + * defrag: threshold overflow fix + * fsck: + * check if items fit into the leaf space + * fix wrong nbytes + * mkfs: + * create only desired block groups for single device + * preparatory work for fix on multiple devices + Enhancements: + * new alias for 'device delete': 'device remove' + Other: + * fix compilation on old gcc (4.3) + * documentation updates + * debug-tree: print nbytes + * test: image for corrupted nbytes + * corrupt-block: let it kill nbytes + +btrfs-progs-4.1 (2015-06-22) + Bugfixes: + * fsck.btrfs: no bash-isms + * bugzilla 97171: invalid memory access (with tests) + * receive: + * cloning works with --chroot + * capabilities not lost + * mkfs: do not try to register bare file images + * option --help accepted by the standalone utilities + + Enhancements: + * corrupt block: ability to remove csums + * mkfs: + * warn if metadata redundancy is lower than for data + * options to make the output quiet (only errors) + * mixed case names of raid profiles accepted + * rework the output: + * more comprehensive, 'key: value' format + * subvol: + * show: + * print received uuid + * update the output + * new options to specify size units + * sync: grab all deleted ids and print them as they're removed, + previous implementation only checked if there are any to be + deleted - change in command semantics + * scrub: print timestamps in days HMS format + * receive: + * can specify mount point, do not rely on /proc + * can work inside subvolumes + * send: new option to send stream without data (NO_FILE_DATA) + * convert: specify incompat features on the new fs + * qgroup: + * show: distinguish no limits and 0 limit value + * limit: ability to clear the limit + * help for 'btrfs' is shorter, 1st level command overview + * debug tree: print key names according to their C name + + New: + * rescue zero-log + * btrfsune: + * rewrite uuid on a filesystem image + * new option to turn on NO_HOLES incompat feature + + Deprecated: + * standalone btrfs-zero-log + + Other: + * testing framework updates + * uuid rewrite test + * btrfstune feature setting test + * zero-log tests + * more testing image formats + * manual page updates + * ioctl.h synced with current kernel uapi version + * convert: preparatory works for more filesystems (reiserfs pending) + * use static buffers for path handling where possible + * add new helpers for send uilts that check memory allocations, + switch all users, deprecate old helpers + * Makefile: fix build dependency generation + * map-logical: make it work again + +btrfs-progs-4.0.1 (2015-05-20) + * restore: + * can restore symlinks, new option --symlinks + * long option variants added + * convert: dropped dependency on acl.h header and libacl is not required + for build + * fix for 'check' crash + * device remove error message fix + * preparatory works for fsid change + +btrfs-progs-4.0 (2015-04-29) + * resize: + * don't accept file as an argument (it's confusing) + * print better error message in case of an error + * restore: optionally restore metadata (time, mode, uid/gid) + * receive: optionally enforce chroot + * new rescue subcommand 'zero-log', same as btrfs-zero-log, but now also + part of the main utility + * check: + * free space checks match kernel, fixes incorrect reports + * convert: fix setting of checksum bit if --no-datasum is used + * fsck.btrfs: don't print messages + * fix quota rescan on PPC64 (mangled ioctl number) + * test updates + * documentation: files renamed to .asciidoc, misc fixups + +btrfs-progs-3.19.1 (2015-03-25) + * convert: + * new option to specify metadata block size + * --no-progress actually works + * restore: properly handle the page boundary corner case + * build fixes: + * missing macro from public header, BTRFS_BUILD_VERSION + * wrong handling of --enable-convert + * fi usage: reports correct space for degraded mounts + * other: + * mkfs: help string updates + * completion: added 'usage' subcommands + * cleanups in qgroup code, preparatory work + +btrfs-progs-3.19 (2015-03-11) + * build converted to autotools + * btrfs-image + * restore can now run in parallel threads + * fixed restore of multiple image from multiple devices onto a single + dev + * introduced metadump v2 + * check: make --init-csum-tree and --init-extent-tree work together + * find-new: option to search through all metadata even if a root was + already found + * convert: show progress by default, can be turned off + * corrupt-block: option to work on a specific root + * bash completion script for all subcommands + +btrfs-progs-3.18.2 (2015-01-27) + * qgroup show: print human readable sizes, options to say otherwise + * check: new option to explicitly say no to writes + * mkfs: message about trimming is not printed to stderr + * fi show: fixed return value + * tests: new infrastructure + * btrfstune: force flag can be used together with seeding option + * backtrace support is back + * getopt cleanups + * doc and help updates + +btrfs-progs-3.18.1 (2015-01-09) + * minor fixes + * documentation updates + +btrfs-progs-3.18 (2014-12-30) + * mkfs - skinny-metadata feature is now on by default, first introduced in + kernel 3.10 + * filesystem usage - give an overview of fs usage in a way that's more + comprehensible than existing 'fi df' + * device usage - more detailed information about per-device allocations + * check + * option to set a different tree root byte number + * ability to link lost files to lost+found, caused by a recent kernel + bug + * repair of severely corrupted fs (use with care) + * convert - option to show progress + * subvol create - print the commit mode inline, print the global mode only + if --verbose + * other updates: musl-libc support, coverity bugfixes, new test images, + documentation + +btrfs-progs-3.17.3 (2014-12-04) + * convert: fix conversion of sparse ext* filesystems + * show: resolve to the correct path + * fsck: more verbose error for root dir problems + +btrfs-progs-3.17.2 (2014-11-19) + * check improvements + * add ability to replace missing dir item/dir indexes + * fix missing inode items + * create missing root dirid + * corrupt block: enhancements for testing fsck + * zero-log: able to reset a fs with bogus log tree pointer (bug_72151) + +btrfs-progs-3.17.1 (2014-11-04) + * fi df: argument handling + * fix linking with libbtrfs + * replace: better error reporting + * fi show: fixed stall if run concurrently with balance + * check: fixed argument parsing for --subvol-extents + * fi df: SI prefixes corrected + +btrfs-progs-3.17 (2014-10-17) + * check: --init-csum-tree actually does something useful, rebuilds the + whole csum tree + * /dev scanning for btrfs devices is gone + * /proc/partitions scanning is gone, blkid is used exclusively + * new subcommand subvolume sync + * filesystem df: new options to set unit format + * convert: allow to copy label from the origin, or specify a new one + +btrfs-progs-3.16.2 (2014-10-01) + * a few fixes in fsck and image tools + +btrfs-progs-3.16.1 (2014-09-15) + * print GlobalReserve in fi df output + * new option -R in subvol list + * library version defines + * static build is fixed + * build without documentation is possible + +btrfs-progs-3.16 (2014-08-26) + * mkfs: new option to specify UUID, drop experimental notice + * check: new option to verify quotas, reduced memory requirements, new + option to print extent sharing + * restore: check length before decompression, more error handling, option + to loop during restoring + * balance: new filter 'limit' + * recover: allow to read all sb copies + * btrfstune: new option to force dangerous changes + * receive: new option to limit number of errors + * show-super: skip unrecognized sb, add option to force + * debug-tree: print tree by id + * documentation updates + +btrfs-progs-3.14.2 (2014-05-29) + * documentation is now written in asciidoc and there are manpages for each + subcommand + * misc bugfixes + +btrfs-progs-3.14.1 (2014-04-18) + * properties: fix handling of option -t + * restore: fix reading of compressed extents + * minor code and doc updates + +btrfs-progs-3.14 (2014-04-06) + * fsck: fixes and enhancements to --init-extent-tree mode + * fsck: chunk-recover updates + * scrub: add force option -f + * send: check if subvolumes are read-only + * subvol delete: add options to affect commit behaviour + * btrfs: add property command group + * restore: add dry-run option + * restore: fix restoring of compressed files + * mkfs: support for no-holes feature + * mkfs: option -r deals with hardlinks and relative paths + * mkfs: discard phase is interruptible + * documentation updates + +btrfs-progs-3.12 (2013-11-25) + * announcement, tarballs + * first release after 0.19 (2009/06) with a lot of changes diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..10828e06 --- /dev/null +++ b/COPYING @@ -0,0 +1,341 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Documentation/Makefile.in b/Documentation/Makefile.in new file mode 100644 index 00000000..aea2cb47 --- /dev/null +++ b/Documentation/Makefile.in @@ -0,0 +1,133 @@ +# Guard against environment variables +MAN8_TXT = + +# Top level commands +MAN8_TXT += btrfs.asciidoc +MAN8_TXT += btrfs-convert.asciidoc +MAN8_TXT += btrfs-find-root.asciidoc +MAN8_TXT += btrfs-image.asciidoc +MAN8_TXT += btrfs-map-logical.asciidoc +MAN8_TXT += btrfs-select-super.asciidoc +MAN8_TXT += btrfstune.asciidoc +MAN8_TXT += fsck.btrfs.asciidoc +MAN8_TXT += mkfs.btrfs.asciidoc + +# Sub commands for btrfs +MAN8_TXT += btrfs-subvolume.asciidoc +MAN8_TXT += btrfs-filesystem.asciidoc +MAN8_TXT += btrfs-balance.asciidoc +MAN8_TXT += btrfs-device.asciidoc +MAN8_TXT += btrfs-scrub.asciidoc +MAN8_TXT += btrfs-check.asciidoc +MAN8_TXT += btrfs-rescue.asciidoc +MAN8_TXT += btrfs-inspect-internal.asciidoc +MAN8_TXT += btrfs-send.asciidoc +MAN8_TXT += btrfs-receive.asciidoc +MAN8_TXT += btrfs-quota.asciidoc +MAN8_TXT += btrfs-qgroup.asciidoc +MAN8_TXT += btrfs-replace.asciidoc +MAN8_TXT += btrfs-restore.asciidoc +MAN8_TXT += btrfs-property.asciidoc + +# Category 5 manual page +MAN5_TXT += btrfs-man5.asciidoc + +MAN_TXT = $(MAN8_TXT) $(MAN5_TXT) +MAN_XML = $(patsubst %.asciidoc,%.xml,$(MAN_TXT)) +MAN_HTML = $(patsubst %.asciidoc,%.html,$(MAN_TXT)) + +DOC_MAN5 = $(patsubst %.asciidoc,%.5,$(MAN5_TXT)) +GZ_MAN5 = $(patsubst %.asciidoc,%.5.gz,$(MAN5_TXT)) + +DOC_MAN8 = $(patsubst %.asciidoc,%.8,$(MAN8_TXT)) +GZ_MAN8 = $(patsubst %.asciidoc,%.8.gz,$(MAN8_TXT)) + +mandir ?= $(prefix)/share/man +man8dir = $(mandir)/man8 +man5dir = $(mandir)/man5 + +ASCIIDOC = @ASCIIDOC@ +ASCIIDOC_EXTRA = +MANPAGE_XSL = manpage-normal.xsl +XMLTO = @XMLTO@ +XMLTO_EXTRA = +XMLTO_EXTRA = -m manpage-bold-literal.xsl +GZIPCMD = @GZIP@ +INSTALL = @INSTALL@ +RM = @RM@ +RMDIR = @RMDIR@ +LN_S = @LN_S@ +MV = @MV@ +SED = @SED@ +BTRFS_VERSION = $(shell $(SED) -n 's/.*PACKAGE_VERSION "\(.*\)"/\1/p'\ + ../config.h) + +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifndef V + QUIET_RM = @ + QUIET_ASCIIDOC = @echo " [ASCII] $@"; + QUIET_XMLTO = @echo " [XMLTO] $@"; + QUIET_GZIP = @echo " [GZ] $@"; + QUIET_STDERR = 2> /dev/null + QUIET_SUBDIR0 = +@subdir= + QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ + $(MAKE) $(PRINT_DIR) -C $$subdir + export V +endif +endif + +all: man +man: man5 man8 +man5: $(GZ_MAN5) +man8: $(GZ_MAN8) +html: $(MAN_HTML) + +install: install-man + +install-man: man + $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir) + $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir) + $(INSTALL) -m 644 $(GZ_MAN5) $(DESTDIR)$(man5dir) + # the source file name of btrfs.5 clashes with section 8 page, but we + # want to keep the code generic + $(MV) $(DESTDIR)$(man5dir)/btrfs-man5.5.gz $(DESTDIR)$(man5dir)/btrfs.5.gz + $(INSTALL) -m 644 $(GZ_MAN8) $(DESTDIR)$(man8dir) + $(LN_S) -f btrfs-check.8.gz $(DESTDIR)$(man8dir)/btrfsck.8.gz + $(LN_S) -f btrfs-rescue.8.gz $(DESTDIR)$(man8dir)/btrfs-zero-log.8.gz + $(LN_S) -f btrfs-inspect-internal.8.gz $(DESTDIR)$(man8dir)/btrfs-debug-tree.8.gz + $(LN_S) -f btrfs-inspect-internal.8.gz $(DESTDIR)$(man8dir)/btrfs-show-super.8.gz + +uninstall: + cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8.gz $(GZ_MAN8) + $(RMDIR) -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir) + +clean: + $(QUIET_RM)$(RM) -f *.xml *.xml+ *.5 *.5.gz *.8 *.8.gz *.html + +%.5.gz : %.5 + $(QUIET_GZIP)$(GZIPCMD) -n -c $< > $@ + +%.8.gz : %.8 + $(QUIET_GZIP)$(GZIPCMD) -n -c $< > $@ + +%.5 : %.xml + $(QUIET_XMLTO)$(RM) -f $@ && \ + $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +%.8 : %.xml + $(QUIET_XMLTO)$(RM) -f $@ && \ + $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< + +%.xml : %.asciidoc asciidoc.conf + $(QUIET_ASCIIDOC)$(RM) -f $@+ $@ && \ + $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ + $(ASCIIDOC_EXTRA) -abtrfs_version=$(BTRFS_VERSION) \ + -o $@+ $< && \ + $(MV) $@+ $@ + +%.html : %.asciidoc asciidoc.conf + $(QUIET_ASCIIDOC)$(RM) -f $@+ $@ && \ + $(ASCIIDOC) -b html -d article -f asciidoc.conf \ + $(ASCIIDOC_EXTRA) -abtrfs_version=$(BTRFS_VERSION) \ + -o $@+ $< && \ + $(MV) $@+ $@ diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf new file mode 100644 index 00000000..1ea74591 --- /dev/null +++ b/Documentation/asciidoc.conf @@ -0,0 +1,48 @@ +## linkbtrfs: macro +# +# Usage: linkbtrfs:command[manpage-section] +# +# Note, {0} is the manpage section, while {target} is the command. +# +# Show Btrfslink as: (
); if section is defined, else just show +# the command. + +[macros] +(?su)[\\]?(?Plinkbtrfs):(?P\S*?)\[(?P.*?)\]= + +[tags] +bracket-emphasis={1?[{1}]}<|> + +[quotes] +<|>=#bracket-emphasis + +[attributes] +asterisk=* +plus=+ +caret=^ +startsb=[ +endsb=] +backslash=\ +tilde=~ +apostrophe=' +backtick=` +litdd=-- + +ifdef::doctype-manpage[] +ifdef::backend-docbook[] +[header] +template::[header-declarations] + + +{mantitle} +{manvolnum} +Btrfs +{btrfs_version} +Btrfs Manual + + + {manname} + {manpurpose} + +endif::backend-docbook[] +endif::doctype-manpage[] diff --git a/Documentation/btrfs-balance.asciidoc b/Documentation/btrfs-balance.asciidoc new file mode 100644 index 00000000..7df40b9c --- /dev/null +++ b/Documentation/btrfs-balance.asciidoc @@ -0,0 +1,223 @@ +btrfs-balance(8) +================ + +NAME +---- +btrfs-balance - balance block groups on a btrfs filesystem + +SYNOPSIS +-------- +*btrfs balance* + +DESCRIPTION +----------- +The primary purpose of the balance feature is to spread block groups across +all devices so they match constraints defined by the respective profiles. See +`mkfs.btrfs`(8) section 'PROFILES' for more details. +The scope of the balancing process can be further tuned by use of filters that +can select the block groups to process. Balance works only on a mounted +filesystem. + +The balance operation is cancellable by the user. The on-disk state of the +filesystem is always consistent so an unexpected interruption (eg. system crash, +reboot) does not corrupt the filesystem. The progress of the balance operation +is temporarily stored and will be resumed upon mount, unless the mount option +'skip_balance' is specified. + +WARNING: running balance without filters will take a lot of time as it basically +rewrites the entire filesystem and needs to update all block pointers. + +The filters can be used to perform following actions: + +- convert block group profiles (filter 'convert') +- make block group usage more compact (filter 'usage') +- perform actions only on a given device (filters 'devid', 'drange') + +The filters can be applied to a combination of block group types (data, +metadata, system). Note that changing 'system' needs the force option. + +NOTE: the balance operation needs enough work space, ie. space that is +completely unused in the filesystem, otherwise this may lead to ENOSPC reports. +See the section 'ENOSPC' for more details. + +COMPATIBILITY +------------- + +NOTE: The balance subcommand also exists under the *btrfs filesystem* +namespace. This still works for backward compatibility but is deprecated and +should not be used anymore. + +NOTE: A short syntax *btrfs balance * works due to backward compatibility +but is deprecated and should not be used anymore. Use *btrfs balance start* +command instead. + +SUBCOMMAND +---------- +*cancel* :: +cancel running or paused balance + +*pause* :: +pause running balance operation, this will store the state of the balance +progress and used filters to the filesystem + +*resume* :: +resume interrupted balance + +*start* [options] :: +start the balance operation according to the specified filters, no filters +will rewrite the entire filesystem. The process runs in the foreground. ++ +NOTE: the balance command without filters will basically rewrite everything +in the filesystem. The run time is potentially very long, depending on the +filesystem size. To prevent starting a full balance by accident, the user is +warned and has a few seconds to cancel the operation before it starts. The +warning and delay can be skipped with '--full-balance' option. ++ +`Options` ++ +-d[]:::: +act on data block groups, see `FILTERS` section for details about 'filters' +-m[]:::: +act on metadata chunks, see `FILTERS` section for details about 'filters' +-s[]:::: +act on system chunks (requires '-f'), see `FILTERS` section for details about 'filters'. +-v:::: +be verbose and print balance filter arguments +-f:::: +force reducing of metadata integrity, eg. when going from 'raid1' to 'single' + +*status* [-v] :: +Show status of running or paused balance. ++ +If '-v' option is given, output will be verbose. + +FILTERS +------- +From kernel 3.3 onwards, btrfs balance can limit its action to a subset of the +full filesystem, and can be used to change the replication configuration (e.g. +moving data from single to RAID1). This functionality is accessed through the +'-d', '-m' or '-s' options to btrfs balance start, which filter on data, +metadata and system blocks respectively. + +A filter has the following structure: 'type'[='params'][,'type'=...] + +The available types are: + +*profiles=*:: +Balances only block groups with the given profiles. Parameters +are a list of profile names separated by "'|'" (pipe). + +*usage=*:: +*usage=*:: +Balances only block groups with usage under the given percentage. The +value of 0 is allowed and will clean up completely unused block groups, this +should not require any new work space allocated. You may want to use 'usage=0' +in case balance is returning ENOSPC and your filesystem is not too full. ++ +The argument may be a single value or a range. The single value 'N' means 'at +most N percent used', equivalent to '..N' range syntax. Kernels prior to 4.4 +accept only the single value format. +The minimum range boundary is inclusive, maximum is exclusive. + +*devid=*:: +Balances only block groups which have at least one chunk on the given +device. To list devices with ids use *btrfs fi show*. + +*drange=*:: +Balance only block groups which overlap with the given byte range on any +device. Use in conjunction with 'devid' to filter on a specific device. The +parameter is a range specified as 'start..end'. + +*vrange=*:: +Balance only block groups which overlap with the given byte range in the +filesystem's internal virtual address space. This is the address space that +most reports from btrfs in the kernel log use. The parameter is a range +specified as 'start..end'. + +*convert=*:: +Convert each selected block group to the given profile name identified by +parameters. ++ +NOTE: starting with kernel 4.5, the 'data' chunks can be converted to/from the +'DUP' profile on a single device. + +*limit=*:: +*limit=*:: +Process only given number of chunks, after all filters are applied. This can be +used to specifically target a chunk in connection with other filters ('drange', +'vrange') or just simply limit the amount of work done by a single balance run. ++ +The argument may be a single value or a range. The single value 'N' means 'at +most N chunks', equivalent to '..N' range syntax. Kernels prior to 4.4 accept +only the single value format. The range minimum and maximum are inclusive. + +*stripes=*:: +Balance only block groups which have the given number of stripes. The parameter +is a range specified as 'start..end'. Makes sense for block group profiles that +utilize striping, ie. RAID0/10/5/6. The range minimum and maximum are +inclusive. + +*soft*:: +Takes no parameters. Only has meaning when converting between profiles. +When doing convert from one profile to another and soft mode is on, +chunks that already have the target profile are left untouched. +This is useful e.g. when half of the filesystem was converted earlier but got +cancelled. ++ +The soft mode switch is (like every other filter) per-type. +For example, this means that we can convert metadata chunks the "hard" way +while converting data chunks selectively with soft switch. + +Profile names, used in 'profiles' and 'convert' are one of: 'raid0', 'raid1', +'raid10', 'raid5', 'raid6', 'dup', 'single'. The mixed data/metadata profiles +can be converted in the same way, but it's conversion between mixed and non-mixed +is not implemented. For the constraints of the profiles please refer to `mkfs.btrfs`(8), +section 'PROFILES'. + +ENOSPC +------ + +The way balance operates, it usually needs to temporarily create a new block +group and move the old data there. For that it needs work space, otherwise +it fails for ENOSPC reasons. +This is not the same ENOSPC as if the free space is exhausted. This refers to +the space on the level of block groups. + +The free work space can be calculated from the output of the *btrfs filesystem show* +command: + +------------------------------ + Label: 'BTRFS' uuid: 8a9d72cd-ead3-469d-b371-9c7203276265 + Total devices 2 FS bytes used 77.03GiB + devid 1 size 53.90GiB used 51.90GiB path /dev/sdc2 + devid 2 size 53.90GiB used 51.90GiB path /dev/sde1 +------------------------------ + +'size' - 'used' = 'free work space' + +'53.90GiB' - '51.90GiB' = '2.00GiB' + +An example of a filter that does not require workspace is 'usage=0'. This will +scan through all unused block groups of a given type and will reclaim the +space. After that it might be possible to run other filters. + +**CONVERSIONS ON MULTIPLE DEVICES** + +Conversion to profiles based on striping (RAID0, RAID5/6) require the work +space on each device. An interrupted balance may leave partially filled block +groups that might consume the work space. + +EXIT STATUS +----------- +*btrfs balance* returns a zero exit status if it succeeds. Non zero is +returned in case of failure. + +AVAILABILITY +------------ +*btrfs* is part of btrfs-progs. +Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for +further details. + +SEE ALSO +-------- +`mkfs.btrfs`(8), +`btrfs-device`(8) diff --git a/Documentation/btrfs-check.asciidoc b/Documentation/btrfs-check.asciidoc new file mode 100644 index 00000000..74a2ad21 --- /dev/null +++ b/Documentation/btrfs-check.asciidoc @@ -0,0 +1,111 @@ +btrfs-check(8) +============== + +NAME +---- +btrfs-check - check or repair an unmounted btrfs filesystem + +SYNOPSIS +-------- +*btrfs check* [options] + +DESCRIPTION +----------- + +The filesystem checker is used to verify structural integrity of a filesystem +and attempt to repair it if requested. The filesystem must be unmounted. + +By default, *btrfs check* will not modify the device but you can reaffirm that +by the option '--readonly'. + +*btrfsck* is an alias of *btrfs check* command and is now deprecated. + +WARNING: Do not use '--repair' unless you are adviced to by a developer, an +experienced user or accept the fact that 'fsck' cannot possibly fix all sorts +of damage that could happen to a filesystem because of software and hardware +bugs. + +The structural integrity check verifies if internal filesystem objects or +data structures satisfy the constraints, point to the right objects or are +correctly connected together. + +There are several cross checks that can detect wrong reference counts of shared +extents, backrefrences, missing extents of inodes, directory and inode +connectivity etc. + +The amount of memory required can be high, depending on the size of the +filesystem, smililarly the run time. + +SAFE OR ADVISORY OPTIONS +------------------------ + +-b|--backup:: +use the first valid set of backup roots stored in the superblock ++ +This can be combined with '--super' if some of the superblocks are damaged. + +--check-data-csum:: +verify checksums of data blocks ++ +This expects that the filesystem is otherwise +OK, so this is basically and offline 'scrub' but does not repair data from +spare coipes. + +--chunk-root :: +use the given offset 'bytenr' for the chunk tree root + +-E|--subvol-extents :: +show extent state for the given subvolume + +-p|--progress:: +indicate progress at various checking phases + +--qgroup-report:: +verify qgroup accounting and compare against filesystem accounting + +-r|--tree-root :: +use the given offset 'bytenr' for the tree root + +--readonly:: +(default) +run in read-only mode, this option exists to calm potential panic when users +are going to run the checker + +-s|--super :: +use 'superblock'th superblock copy, valid values are 0, 1 or 2 if the +respective superblock offset is within the device size ++ +This can be used to use a different starting point if some of the primary +superblock is damaged. + +DANGEROUS OPTIONS +----------------- + +--repair:: +enable the repair mode and attempt to fix problems where possible +--init-csum-tree:: +create a new checksum tree and recalculate checksums in all files ++ +NOTE: Do not blindly use this option to fix checksum mismatch problems. + +--init-extent-tree:: +build the extent tree from scratch ++ +NOTE: Do not use unless you know what you're doing. + +EXIT STATUS +----------- +*btrfs check* returns a zero exit status if it succeeds. Non zero is +returned in case of failure. + +AVAILABILITY +------------ +*btrfs* is part of btrfs-progs. +Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for +further details. + +SEE ALSO +-------- +`mkfs.btrfs`(8), +`btrfs-scrub`(8), +`btrfs-rescue`(8) diff --git a/Documentation/btrfs-convert.asciidoc b/Documentation/btrfs-convert.asciidoc new file mode 100644 index 00000000..ab3577db --- /dev/null +++ b/Documentation/btrfs-convert.asciidoc @@ -0,0 +1,106 @@ +btrfs-convert(8) +================ + +NAME +---- +btrfs-convert - convert from ext2/3/4 filesystem to btrfs + +SYNOPSIS +-------- +*btrfs-convert* [options] + +DESCRIPTION +----------- +*btrfs-convert* is used to convert existing ext2/3/4 filesystem image to a +btrfs filesystem in-place. The original filesystem image is accessible +subvolume named 'ext2_saved' as file 'image'. + +WARNING: If you are going to perform rollback to ext2/3/4, you should not +execute *btrfs balance* command on the converted filesystem. This will change +the extent layout and make *btrfs-convert* unable to rollback. + +The conversion utilizes free space of the original filesystem. The exact +estimate of the required space cannot be foretold. The final btrfs metadata +might occupy several gigabytes on a hundreds-gigabyte filesystem. + +If you decide not to rollback anymore, it is recommended to perform a few more +steps to transform the btrfs filesystem to a more compact layout. The +conversion inherits the original data block fragmentation and the metadata +blocks are bound to the original free space layout. + +**REMOVE THE ORIGINAL FILESYSTEM METADATA** + +By removing the 'ext2_saved' subvolume, all metadata of the original filesystem +will be removed: + + # btrfs subvolume delete /mnt/ext2_saved + +At this point it's not possible to do rollback. The filesystem is usable but may +be impacted by the fragmentation. + +**MAKE FILE DATA MORE CONTIGUOUS** + +An optional but recommended step is to run defragmentation on the entire +filesystem. This will attempt to make file extents more contiguous. + + # btrfs filesystem defrag -v -r -f -t 32M /mnt/btrfs + +Verbose recursive defragmentation ('-v', '-r'), flush data per-file ('-f') with target +extent size 32M ('-t'). + +**ATTEMPT TO MAKE BTRFS METADATA MORE COMPACT** + +Optional but recommended step. + +The metadata block groups after conversion may be smaller than the default size +(256MiB or 1GiB). Running a balance will attempt to merge the block groups. +This depends on the free space layout (and fragmentation) and may fail. This is +a soft error leaving the filesystem usable but the block group layout may +remain unchanged. + +Note that balance operation takes a lot of time. + + # btrfs balance start -m /mnt/btrfs + +OPTIONS +------- +-d|--no-datasum:: +disable data checksum calculations and set NODATASUM file flag, this can speed +up the conversion +-i|--no-xattr:: +ignore xattrs and ACLs of files +-n|--no-inline:: +disable inlining of small files to metadata blocks, this will decrease the metadata +consumption and may help to convert a filesystem with low free space +-N|--nodesize :: +set filesystem nodesize, the tree block size in which btrfs stores its metadata. +The default value is 16KB (16384) or the page size, whichever is bigger. +Must be a multiple of the sectorsize, but not larger than 65536. See +`mkfs.btrfs`(8) for more details. +-r|--rollback:: +rollback to the original ext2/3/4 filesystem if possible +-l|--label