path: root/ctree.h
diff options
authorFilipe Manana <>2015-07-16 16:47:13 +0100
committerDavid Sterba <>2015-08-31 19:25:03 +0200
commita57606e815f3e1c4fe66c61ce3c6e3621ea522e9 (patch)
treec080653dec7deef76a04045c57ee170a8b091aae /ctree.h
parent9dbee1a6802896a6443896bfe407ab4062dff4f9 (diff)
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 <> Signed-off-by: David Sterba <>
Diffstat (limited to 'ctree.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/ctree.h b/ctree.h
index 5550d453..227a00b3 100644
--- a/ctree.h
+++ b/ctree.h
@@ -1491,6 +1491,9 @@ BTRFS_SETGET_FUNCS(dev_extent_chunk_offset, struct btrfs_dev_extent,
chunk_offset, 64);
BTRFS_SETGET_FUNCS(dev_extent_length, struct btrfs_dev_extent, length, 64);
+BTRFS_SETGET_STACK_FUNCS(stack_dev_extent_length, struct btrfs_dev_extent,
+ length, 64);
static inline u8 *btrfs_dev_extent_chunk_tree_uuid(struct btrfs_dev_extent *dev)
unsigned long ptr = offsetof(struct btrfs_dev_extent, chunk_tree_uuid);