Btrfs-progs: add feature to get mininum size for resizing a fs/device
authorFilipe Manana <fdmanana@suse.com>
Thu, 16 Jul 2015 15:47:13 +0000 (16:47 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 31 Aug 2015 17:25:03 +0000 (19:25 +0200)
commita57606e815f3e1c4fe66c61ce3c6e3621ea522e9
treec080653dec7deef76a04045c57ee170a8b091aae
parent9dbee1a6802896a6443896bfe407ab4062dff4f9
Btrfs-progs: add feature to get mininum size for resizing a fs/device

Currently there is not way for a user to know what is the minimum size a
device of a btrfs filesystem can be resized to. Sometimes the value of
total allocated space (sum of all allocated chunks/device extents), which
can be parsed from 'btrfs filesystem show' and 'btrfs filesystem usage',
works as the minimum size, but sometimes it does not, namely when device
extents have to relocated to holes (unallocated space) within the new
size of the device (the total allocated space sum).

This change adds the ability to reliably compute such minimum value and
extents 'btrfs filesystem resize' with the following syntax to get such
value:

   btrfs filesystem resize [devid:]get_min_size

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Documentation/btrfs-filesystem.asciidoc
cmds-filesystem.c
ctree.h
tests/misc-tests.sh
tests/misc-tests/004-shrink-fs/test.sh [new file with mode: 0755]