Accepting request 259577 from filesystems
- version 3.17 - check: --init-csum-tree acutally 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 OBS-URL: https://build.opensuse.org/request/show/259577 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/btrfsprogs?expand=0&rev=48
This commit is contained in:
commit
2255e4dd0c
@ -1,68 +0,0 @@
|
||||
From 3ecff1d8f1eaa5e0d065c439cf72032dd01da751 Mon Sep 17 00:00:00 2001
|
||||
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
|
||||
Date: Thu, 24 Apr 2014 11:19:16 +0800
|
||||
Subject: [PATCH 13/42] Btrfs-progs: fsck: clear out log tree in repair mode
|
||||
|
||||
Repair mode will commit transaction which will make us
|
||||
fail to load log tree anymore.
|
||||
|
||||
Give a warning to common users, if they really want to
|
||||
coninue, we will clear out log tree.
|
||||
|
||||
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-check.c | 33 +++++++++++++++++++++++++++++++++
|
||||
1 file changed, 33 insertions(+)
|
||||
|
||||
Index: btrfs-progs-v3.16/cmds-check.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/cmds-check.c
|
||||
+++ btrfs-progs-v3.16/cmds-check.c
|
||||
@@ -6538,6 +6538,22 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int zero_log_tree(struct btrfs_root *root)
|
||||
+{
|
||||
+ struct btrfs_trans_handle *trans;
|
||||
+ int ret;
|
||||
+
|
||||
+ trans = btrfs_start_transaction(root, 1);
|
||||
+ if (IS_ERR(trans)) {
|
||||
+ ret = PTR_ERR(trans);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ btrfs_set_super_log_root(root->fs_info->super_copy, 0);
|
||||
+ btrfs_set_super_log_root_level(root->fs_info->super_copy, 0);
|
||||
+ ret = btrfs_commit_transaction(trans, root);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static struct option long_options[] = {
|
||||
{ "super", 1, NULL, 's' },
|
||||
{ "repair", 0, NULL, 0 },
|
||||
@@ -6657,6 +6673,23 @@ int cmd_check(int argc, char **argv)
|
||||
}
|
||||
|
||||
root = info->fs_root;
|
||||
+ /*
|
||||
+ * repair mode will force us to commit transaction which
|
||||
+ * will make us fail to load log tree when mounting.
|
||||
+ */
|
||||
+ if (repair && btrfs_super_log_root(info->super_copy)) {
|
||||
+ ret = ask_user("repair mode will force to clear out log tree, Are you sure?");
|
||||
+ if (!ret) {
|
||||
+ ret = 1;
|
||||
+ goto close_out;
|
||||
+ }
|
||||
+ ret = zero_log_tree(root);
|
||||
+ if (ret) {
|
||||
+ fprintf(stderr, "fail to zero log tree\n");
|
||||
+ goto close_out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
uuid_unparse(info->super_copy->fsid, uuidbuf);
|
||||
if (qgroup_report) {
|
||||
printf("Print quota groups for %s\nUUID: %s\n", argv[optind],
|
@ -1,38 +0,0 @@
|
||||
From 20e9fa6f969b3c6a4b3ff9941c351e90320aed61 Mon Sep 17 00:00:00 2001
|
||||
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
|
||||
Date: Thu, 24 Apr 2014 11:19:17 +0800
|
||||
Subject: [PATCH 14/42] Btrfs-progs: fsck: avoid pinning same block several
|
||||
times
|
||||
|
||||
This can not only give some speedups but also avoid forever loop
|
||||
with a really broken filesystem.
|
||||
|
||||
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-check.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/cmds-check.c b/cmds-check.c
|
||||
index 7457618fb702..57d3f36eea1f 100644
|
||||
--- a/cmds-check.c
|
||||
+++ b/cmds-check.c
|
||||
@@ -6190,6 +6190,15 @@ static int pin_down_tree_blocks(struct btrfs_fs_info *fs_info,
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
+ /*
|
||||
+ * If we have pinned this block before, don't pin it again.
|
||||
+ * This can not only avoid forever loop with broken filesystem
|
||||
+ * but also give us some speedups.
|
||||
+ */
|
||||
+ if (test_range_bit(&fs_info->pinned_extents, eb->start,
|
||||
+ eb->start + eb->len - 1, EXTENT_DIRTY, 0))
|
||||
+ return 0;
|
||||
+
|
||||
btrfs_pin_extent(fs_info, eb->start, eb->len);
|
||||
|
||||
leafsize = btrfs_super_leafsize(fs_info->super_copy);
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,92 +0,0 @@
|
||||
From 26bf4f0a10dd192e4dc5494d2cf9398c666eaab6 Mon Sep 17 00:00:00 2001
|
||||
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
|
||||
Date: Thu, 24 Apr 2014 18:51:10 +0800
|
||||
Subject: [PATCH 15/42] Btrfs-progs: fsck: add ability to check reloc roots
|
||||
|
||||
When encountering system crash or balance enospc errors,
|
||||
there maybe still some reloc roots left.
|
||||
|
||||
The way we store reloc root is different from fs root:
|
||||
|
||||
reloc root's root key(BTRFS_RELOC_TREE_OBJECTID, ROOT_ITEM, objectid)
|
||||
fs root's root key(objectid, ROOT_ITEM, -1)
|
||||
reloc data's root key(BTRFS_DATA_RELOC_TREE_OBJECTID, ROOT_ITEM, 0)
|
||||
|
||||
So this patch use right key to search corresponding root node, and
|
||||
avoid using normal fs root cache for reloc roots.
|
||||
|
||||
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-check.c | 33 ++++++++++++++++++++++++++-------
|
||||
1 file changed, 26 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/cmds-check.c b/cmds-check.c
|
||||
index 57d3f36eea1f..103efc5718ec 100644
|
||||
--- a/cmds-check.c
|
||||
+++ b/cmds-check.c
|
||||
@@ -299,8 +299,22 @@ static struct inode_record *clone_inode_rec(struct inode_record *orig_rec)
|
||||
return rec;
|
||||
}
|
||||
|
||||
-static void print_inode_error(int errors)
|
||||
+static void print_inode_error(struct btrfs_root *root, struct inode_record *rec)
|
||||
{
|
||||
+ u64 root_objectid = root->root_key.objectid;
|
||||
+ int errors = rec->errors;
|
||||
+
|
||||
+ if (!errors)
|
||||
+ return;
|
||||
+ /* reloc root errors, we print its corresponding fs root objectid*/
|
||||
+ if (root_objectid == BTRFS_TREE_RELOC_OBJECTID) {
|
||||
+ root_objectid = root->root_key.offset;
|
||||
+ fprintf(stderr, "reloc");
|
||||
+ }
|
||||
+ fprintf(stderr, "root %llu inode %llu errors %x",
|
||||
+ (unsigned long long) root_objectid,
|
||||
+ (unsigned long long) rec->ino, rec->errors);
|
||||
+
|
||||
if (errors & I_ERR_NO_INODE_ITEM)
|
||||
fprintf(stderr, ", no inode item");
|
||||
if (errors & I_ERR_NO_ORPHAN_ITEM)
|
||||
@@ -1598,10 +1612,7 @@ static int check_inode_recs(struct btrfs_root *root,
|
||||
rec->errors |= I_ERR_NO_INODE_ITEM;
|
||||
if (rec->found_link != rec->nlink)
|
||||
rec->errors |= I_ERR_LINK_COUNT_WRONG;
|
||||
- fprintf(stderr, "root %llu inode %llu errors %x",
|
||||
- (unsigned long long) root->root_key.objectid,
|
||||
- (unsigned long long) rec->ino, rec->errors);
|
||||
- print_inode_error(rec->errors);
|
||||
+ print_inode_error(root, rec);
|
||||
list_for_each_entry(backref, &rec->backrefs, list) {
|
||||
if (!backref->found_dir_item)
|
||||
backref->errors |= REF_ERR_NO_DIR_ITEM;
|
||||
@@ -2060,8 +2071,14 @@ static int check_fs_roots(struct btrfs_root *root,
|
||||
btrfs_item_key_to_cpu(leaf, &key, path.slots[0]);
|
||||
if (key.type == BTRFS_ROOT_ITEM_KEY &&
|
||||
fs_root_objectid(key.objectid)) {
|
||||
- key.offset = (u64)-1;
|
||||
- tmp_root = btrfs_read_fs_root(root->fs_info, &key);
|
||||
+ if (key.objectid == BTRFS_TREE_RELOC_OBJECTID) {
|
||||
+ tmp_root = btrfs_read_fs_root_no_cache(
|
||||
+ root->fs_info, &key);
|
||||
+ } else {
|
||||
+ key.offset = (u64)-1;
|
||||
+ tmp_root = btrfs_read_fs_root(
|
||||
+ root->fs_info, &key);
|
||||
+ }
|
||||
if (IS_ERR(tmp_root)) {
|
||||
err = 1;
|
||||
goto next;
|
||||
@@ -2069,6 +2086,8 @@ static int check_fs_roots(struct btrfs_root *root,
|
||||
ret = check_fs_root(tmp_root, root_cache, &wc);
|
||||
if (ret)
|
||||
err = 1;
|
||||
+ if (key.objectid == BTRFS_TREE_RELOC_OBJECTID)
|
||||
+ btrfs_free_fs_root(tmp_root);
|
||||
} else if (key.type == BTRFS_ROOT_REF_KEY ||
|
||||
key.type == BTRFS_ROOT_BACKREF_KEY) {
|
||||
process_root_ref(leaf, path.slots[0], &key,
|
||||
--
|
||||
1.9.0
|
||||
|
147
0010-btrfs-progs-move-group-type-and-profile-pretty-print.patch
Normal file
147
0010-btrfs-progs-move-group-type-and-profile-pretty-print.patch
Normal file
@ -0,0 +1,147 @@
|
||||
From 86afea330be6179ac88e0fcaf14924e03257b445 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 23 Oct 2014 19:05:31 +0200
|
||||
Subject: [PATCH 01/42] btrfs-progs: move group type and profile pretty
|
||||
printers to utils
|
||||
|
||||
Move and add the btrfs_ prefix.
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-filesystem.c | 47 ++---------------------------------------------
|
||||
utils.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
utils.h | 2 ++
|
||||
3 files changed, 48 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
|
||||
index bb5881edef2d..ffa939c5b89a 100644
|
||||
--- a/cmds-filesystem.c
|
||||
+++ b/cmds-filesystem.c
|
||||
@@ -127,49 +127,6 @@ static const char * const cmd_df_usage[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
-static char *group_type_str(u64 flag)
|
||||
-{
|
||||
- u64 mask = BTRFS_BLOCK_GROUP_TYPE_MASK |
|
||||
- BTRFS_SPACE_INFO_GLOBAL_RSV;
|
||||
-
|
||||
- switch (flag & mask) {
|
||||
- case BTRFS_BLOCK_GROUP_DATA:
|
||||
- return "Data";
|
||||
- case BTRFS_BLOCK_GROUP_SYSTEM:
|
||||
- return "System";
|
||||
- case BTRFS_BLOCK_GROUP_METADATA:
|
||||
- return "Metadata";
|
||||
- case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
|
||||
- return "Data+Metadata";
|
||||
- case BTRFS_SPACE_INFO_GLOBAL_RSV:
|
||||
- return "GlobalReserve";
|
||||
- default:
|
||||
- return "unknown";
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static char *group_profile_str(u64 flag)
|
||||
-{
|
||||
- switch (flag & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
|
||||
- case 0:
|
||||
- return "single";
|
||||
- case BTRFS_BLOCK_GROUP_RAID0:
|
||||
- return "RAID0";
|
||||
- case BTRFS_BLOCK_GROUP_RAID1:
|
||||
- return "RAID1";
|
||||
- case BTRFS_BLOCK_GROUP_RAID5:
|
||||
- return "RAID5";
|
||||
- case BTRFS_BLOCK_GROUP_RAID6:
|
||||
- return "RAID6";
|
||||
- case BTRFS_BLOCK_GROUP_DUP:
|
||||
- return "DUP";
|
||||
- case BTRFS_BLOCK_GROUP_RAID10:
|
||||
- return "RAID10";
|
||||
- default:
|
||||
- return "unknown";
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
|
||||
{
|
||||
u64 count = 0;
|
||||
@@ -225,8 +182,8 @@ static void print_df(struct btrfs_ioctl_space_args *sargs, unsigned unit_mode)
|
||||
|
||||
for (i = 0; i < sargs->total_spaces; i++, sp++) {
|
||||
printf("%s, %s: total=%s, used=%s\n",
|
||||
- group_type_str(sp->flags),
|
||||
- group_profile_str(sp->flags),
|
||||
+ btrfs_group_type_str(sp->flags),
|
||||
+ btrfs_group_profile_str(sp->flags),
|
||||
pretty_size_mode(sp->total_bytes, unit_mode),
|
||||
pretty_size_mode(sp->used_bytes, unit_mode));
|
||||
}
|
||||
diff --git a/utils.c b/utils.c
|
||||
index f10c178bf36e..43b693c94039 100644
|
||||
--- a/utils.c
|
||||
+++ b/utils.c
|
||||
@@ -2431,3 +2431,47 @@ int find_next_key(struct btrfs_path *path, struct btrfs_key *key)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+char* btrfs_group_type_str(u64 flag)
|
||||
+{
|
||||
+ u64 mask = BTRFS_BLOCK_GROUP_TYPE_MASK |
|
||||
+ BTRFS_SPACE_INFO_GLOBAL_RSV;
|
||||
+
|
||||
+ switch (flag & mask) {
|
||||
+ case BTRFS_BLOCK_GROUP_DATA:
|
||||
+ return "Data";
|
||||
+ case BTRFS_BLOCK_GROUP_SYSTEM:
|
||||
+ return "System";
|
||||
+ case BTRFS_BLOCK_GROUP_METADATA:
|
||||
+ return "Metadata";
|
||||
+ case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
|
||||
+ return "Data+Metadata";
|
||||
+ case BTRFS_SPACE_INFO_GLOBAL_RSV:
|
||||
+ return "GlobalReserve";
|
||||
+ default:
|
||||
+ return "unknown";
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+char* btrfs_group_profile_str(u64 flag)
|
||||
+{
|
||||
+ switch (flag & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
|
||||
+ case 0:
|
||||
+ return "single";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID0:
|
||||
+ return "RAID0";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID1:
|
||||
+ return "RAID1";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID5:
|
||||
+ return "RAID5";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID6:
|
||||
+ return "RAID6";
|
||||
+ case BTRFS_BLOCK_GROUP_DUP:
|
||||
+ return "DUP";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID10:
|
||||
+ return "RAID10";
|
||||
+ default:
|
||||
+ return "unknown";
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
diff --git a/utils.h b/utils.h
|
||||
index 7accbd20382c..0d202f6344c4 100644
|
||||
--- a/utils.h
|
||||
+++ b/utils.h
|
||||
@@ -159,5 +159,7 @@ static inline u64 btrfs_min_dev_size(u32 leafsize)
|
||||
}
|
||||
|
||||
int find_next_key(struct btrfs_path *path, struct btrfs_key *key);
|
||||
+char* btrfs_group_type_str(u64 flag);
|
||||
+char* btrfs_group_profile_str(u64 flag);
|
||||
|
||||
#endif
|
||||
--
|
||||
2.1.1
|
||||
|
@ -1,31 +1,32 @@
|
||||
From 04a9855f53cb7e4ad874cec28acfa537f00a28ba Mon Sep 17 00:00:00 2001
|
||||
From 8296d5dae853ada256834975148678125e51af6e Mon Sep 17 00:00:00 2001
|
||||
From: Goffredo Baroncelli <kreijack@libero.it>
|
||||
Date: Thu, 13 Feb 2014 20:19:01 +0100
|
||||
Subject: [PATCH 22/42] btrfs-progs: Enhance the command btrfs filesystem df
|
||||
Subject: [PATCH 02/42] btrfs-progs: Enhance the command btrfs filesystem df
|
||||
|
||||
Enhance the command "btrfs filesystem df" to show space usage information
|
||||
for a mount point(s). It shows also an estimation of the space available,
|
||||
on the basis of the current one used.
|
||||
|
||||
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
|
||||
[code moved under #if 0 instead of deletion]
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
cmds-fi-disk_usage.c | 516 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
cmds-fi-disk_usage.h | 25 +++
|
||||
cmds-filesystem.c | 92 +--------
|
||||
cmds-filesystem.c | 7 +-
|
||||
ctree.h | 5 +-
|
||||
utils.c | 12 ++
|
||||
utils.c | 11 ++
|
||||
utils.h | 1 +
|
||||
7 files changed, 560 insertions(+), 93 deletions(-)
|
||||
7 files changed, 563 insertions(+), 4 deletions(-)
|
||||
create mode 100644 cmds-fi-disk_usage.c
|
||||
create mode 100644 cmds-fi-disk_usage.h
|
||||
|
||||
Index: btrfs-progs-v3.16/Makefile
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/Makefile
|
||||
+++ btrfs-progs-v3.16/Makefile
|
||||
@@ -15,7 +15,7 @@ cmds_objects = cmds-subvolume.o cmds-fil
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 9c69adae9050..a6c1ccede7c4 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -15,7 +15,7 @@ cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
|
||||
cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
|
||||
cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
|
||||
cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \
|
||||
@ -34,10 +35,11 @@ Index: btrfs-progs-v3.16/Makefile
|
||||
libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \
|
||||
uuid-tree.o utils-lib.o
|
||||
libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
|
||||
Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
===================================================================
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
new file mode 100644
|
||||
index 000000000000..7f4415666bd8
|
||||
--- /dev/null
|
||||
+++ btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -0,0 +1,516 @@
|
||||
+/*
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
@ -94,7 +96,7 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
+ static char buf[30];
|
||||
+
|
||||
+ if (mode & DF_HUMAN_UNIT)
|
||||
+ (void)pretty_size_snprintf(size, buf, sizeof(buf));
|
||||
+ (void)pretty_size_snprintf(size, buf, sizeof(buf), UNITS_DEFAULT);
|
||||
+ else
|
||||
+ sprintf(buf, "%llu", size);
|
||||
+
|
||||
@ -555,10 +557,11 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
Index: btrfs-progs-v3.16/cmds-fi-disk_usage.h
|
||||
===================================================================
|
||||
diff --git a/cmds-fi-disk_usage.h b/cmds-fi-disk_usage.h
|
||||
new file mode 100644
|
||||
index 000000000000..9f68bb342d52
|
||||
--- /dev/null
|
||||
+++ btrfs-progs-v3.16/cmds-fi-disk_usage.h
|
||||
+++ b/cmds-fi-disk_usage.h
|
||||
@@ -0,0 +1,25 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2007 Oracle. All rights reserved.
|
||||
@ -585,10 +588,10 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.h
|
||||
+int cmd_filesystem_df(int argc, char **argv);
|
||||
+
|
||||
+#endif
|
||||
Index: btrfs-progs-v3.16/cmds-filesystem.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/cmds-filesystem.c
|
||||
+++ btrfs-progs-v3.16/cmds-filesystem.c
|
||||
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
|
||||
index ffa939c5b89a..91e4e2e5a881 100644
|
||||
--- a/cmds-filesystem.c
|
||||
+++ b/cmds-filesystem.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "volumes.h"
|
||||
#include "version.h"
|
||||
@ -597,115 +600,39 @@ Index: btrfs-progs-v3.16/cmds-filesystem.c
|
||||
#include "list_sort.h"
|
||||
#include "disk-io.h"
|
||||
|
||||
@@ -112,55 +113,6 @@ static const char * const filesystem_cmd_group_usage[] = {
|
||||
@@ -112,6 +113,7 @@ static const char * const filesystem_cmd_group_usage[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
-static const char * const cmd_df_usage[] = {
|
||||
- "btrfs filesystem df <path>",
|
||||
- "Show space usage information for a mount point",
|
||||
- NULL
|
||||
-};
|
||||
-
|
||||
-static char *group_type_str(u64 flag)
|
||||
-{
|
||||
- u64 mask = BTRFS_BLOCK_GROUP_TYPE_MASK |
|
||||
- BTRFS_SPACE_INFO_GLOBAL_RSV;
|
||||
-
|
||||
- switch (flag & mask) {
|
||||
- case BTRFS_BLOCK_GROUP_DATA:
|
||||
- return "Data";
|
||||
- case BTRFS_BLOCK_GROUP_SYSTEM:
|
||||
- return "System";
|
||||
- case BTRFS_BLOCK_GROUP_METADATA:
|
||||
- return "Metadata";
|
||||
- case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
|
||||
- return "Data+Metadata";
|
||||
- case BTRFS_SPACE_INFO_GLOBAL_RSV:
|
||||
- return "GlobalReserve";
|
||||
- default:
|
||||
- return "unknown";
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static char *group_profile_str(u64 flag)
|
||||
-{
|
||||
- switch (flag & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
|
||||
- case 0:
|
||||
- return "single";
|
||||
- case BTRFS_BLOCK_GROUP_RAID0:
|
||||
- return "RAID0";
|
||||
- case BTRFS_BLOCK_GROUP_RAID1:
|
||||
- return "RAID1";
|
||||
- case BTRFS_BLOCK_GROUP_RAID5:
|
||||
- return "RAID5";
|
||||
- case BTRFS_BLOCK_GROUP_RAID6:
|
||||
- return "RAID6";
|
||||
- case BTRFS_BLOCK_GROUP_DUP:
|
||||
- return "DUP";
|
||||
- case BTRFS_BLOCK_GROUP_RAID10:
|
||||
- return "RAID10";
|
||||
- default:
|
||||
- return "unknown";
|
||||
- }
|
||||
-}
|
||||
-
|
||||
+#if 0
|
||||
static const char * const cmd_df_usage[] = {
|
||||
"btrfs filesystem df [options] <path>",
|
||||
"Show space usage information for a mount point",
|
||||
@@ -126,6 +128,7 @@ static const char * const cmd_df_usage[] = {
|
||||
"-t|--tbytes show sizes in TiB, or tB with --si",
|
||||
NULL
|
||||
};
|
||||
+#endif
|
||||
|
||||
static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
|
||||
{
|
||||
u64 count = 0;
|
||||
@@ -204,51 +161,6 @@ static int get_df(int fd, struct btrfs_i
|
||||
@@ -175,6 +178,7 @@ static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void print_df(struct btrfs_ioctl_space_args *sargs)
|
||||
-{
|
||||
- u64 i;
|
||||
- struct btrfs_ioctl_space_info *sp = sargs->spaces;
|
||||
-
|
||||
- for (i = 0; i < sargs->total_spaces; i++, sp++) {
|
||||
- printf("%s, %s: total=%s, used=%s\n",
|
||||
- group_type_str(sp->flags),
|
||||
- group_profile_str(sp->flags),
|
||||
- pretty_size(sp->total_bytes),
|
||||
- pretty_size(sp->used_bytes));
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static int cmd_df(int argc, char **argv)
|
||||
-{
|
||||
- struct btrfs_ioctl_space_args *sargs = NULL;
|
||||
- int ret;
|
||||
- int fd;
|
||||
- char *path;
|
||||
- DIR *dirstream = NULL;
|
||||
-
|
||||
- if (check_argc_exact(argc, 2))
|
||||
- usage(cmd_df_usage);
|
||||
-
|
||||
- path = argv[1];
|
||||
-
|
||||
- fd = open_file_or_dir(path, &dirstream);
|
||||
- if (fd < 0) {
|
||||
- fprintf(stderr, "ERROR: can't access '%s'\n", path);
|
||||
- return 1;
|
||||
- }
|
||||
- ret = get_df(fd, &sargs);
|
||||
-
|
||||
- if (ret == 0) {
|
||||
- print_df(sargs);
|
||||
- free(sargs);
|
||||
- } else {
|
||||
- fprintf(stderr, "ERROR: get_df failed %s\n", strerror(-ret));
|
||||
- }
|
||||
-
|
||||
- close_file_or_dir(fd, dirstream);
|
||||
- return !!ret;
|
||||
-}
|
||||
-
|
||||
+#if 0
|
||||
static void print_df(struct btrfs_ioctl_space_args *sargs, unsigned unit_mode)
|
||||
{
|
||||
u64 i;
|
||||
@@ -269,6 +273,7 @@ static int cmd_df(int argc, char **argv)
|
||||
close_file_or_dir(fd, dirstream);
|
||||
return !!ret;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static int match_search_item_kernel(__u8 *fsid, char *mnt, char *label,
|
||||
char *search)
|
||||
{
|
||||
@@ -999,7 +911,7 @@ static int cmd_label(int argc, char **ar
|
||||
@@ -1263,7 +1268,7 @@ static int cmd_label(int argc, char **argv)
|
||||
|
||||
const struct cmd_group filesystem_cmd_group = {
|
||||
filesystem_cmd_group_usage, NULL, {
|
||||
@ -714,11 +641,11 @@ Index: btrfs-progs-v3.16/cmds-filesystem.c
|
||||
{ "show", cmd_show, cmd_show_usage, NULL, 0 },
|
||||
{ "sync", cmd_sync, cmd_sync_usage, NULL, 0 },
|
||||
{ "defragment", cmd_defrag, cmd_defrag_usage, NULL, 0 },
|
||||
Index: btrfs-progs-v3.16/ctree.h
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/ctree.h
|
||||
+++ btrfs-progs-v3.16/ctree.h
|
||||
@@ -845,9 +845,10 @@ struct btrfs_csum_item {
|
||||
diff --git a/ctree.h b/ctree.h
|
||||
index 89036defc396..5a60bd268871 100644
|
||||
--- a/ctree.h
|
||||
+++ b/ctree.h
|
||||
@@ -842,9 +842,10 @@ struct btrfs_csum_item {
|
||||
#define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4)
|
||||
#define BTRFS_BLOCK_GROUP_DUP (1ULL << 5)
|
||||
#define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6)
|
||||
@ -731,10 +658,10 @@ Index: btrfs-progs-v3.16/ctree.h
|
||||
|
||||
#define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | \
|
||||
BTRFS_BLOCK_GROUP_SYSTEM | \
|
||||
Index: btrfs-progs-v3.16/utils.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/utils.c
|
||||
+++ btrfs-progs-v3.16/utils.c
|
||||
diff --git a/utils.c b/utils.c
|
||||
index 43b693c94039..cf0559d9c9dd 100644
|
||||
--- a/utils.c
|
||||
+++ b/utils.c
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <linux/kdev_t.h>
|
||||
#include <limits.h>
|
||||
@ -744,11 +671,10 @@ Index: btrfs-progs-v3.16/utils.c
|
||||
#include "kerncompat.h"
|
||||
#include "radix-tree.h"
|
||||
#include "ctree.h"
|
||||
@@ -2439,3 +2441,13 @@ int test_isdir(const char *path)
|
||||
|
||||
return S_ISDIR(st.st_mode);
|
||||
@@ -2475,3 +2477,12 @@ char* btrfs_group_profile_str(u64 flag)
|
||||
}
|
||||
+
|
||||
}
|
||||
|
||||
+u64 disk_size(char *path)
|
||||
+{
|
||||
+ struct statfs sfs;
|
||||
@ -759,10 +685,10 @@ Index: btrfs-progs-v3.16/utils.c
|
||||
+ return sfs.f_bsize * sfs.f_blocks;
|
||||
+}
|
||||
diff --git a/utils.h b/utils.h
|
||||
index fd25126dac81..c683818e003f 100644
|
||||
index 0d202f6344c4..2976e11d7a93 100644
|
||||
--- a/utils.h
|
||||
+++ b/utils.h
|
||||
@@ -114,6 +114,7 @@ int find_mount_root(const char *path, char **mount_root);
|
||||
@@ -133,6 +133,7 @@ int find_mount_root(const char *path, char **mount_root);
|
||||
int get_device_info(int fd, u64 devid,
|
||||
struct btrfs_ioctl_dev_info_args *di_args);
|
||||
int test_uuid_unique(char *fs_uuid);
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a79f61440afaa0b77dc67c896fa3367a171c2306 Mon Sep 17 00:00:00 2001
|
||||
From a1faabe2147d3ba59b16ac16dc0862166e2dee15 Mon Sep 17 00:00:00 2001
|
||||
From: Goffredo Baroncelli <kreijack@libero.it>
|
||||
Date: Thu, 13 Feb 2014 20:19:21 +0100
|
||||
Subject: [PATCH 23/42] btrfs-progs: Add helpers functions to handle the
|
||||
Subject: [PATCH 03/42] btrfs-progs: Add helpers functions to handle the
|
||||
printing of data in tabular format
|
||||
|
||||
This patch adds some functions to manage the printing of the data in
|
||||
@ -33,22 +33,22 @@ Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
string_table.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
string_table.h | 36 +++++++++++++
|
||||
string-table.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
string-table.h | 36 +++++++++++++
|
||||
3 files changed, 193 insertions(+), 1 deletion(-)
|
||||
create mode 100644 string_table.c
|
||||
create mode 100644 string_table.h
|
||||
create mode 100644 string-table.c
|
||||
create mode 100644 string-table.h
|
||||
|
||||
Index: btrfs-progs-v3.16/Makefile
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/Makefile
|
||||
+++ btrfs-progs-v3.16/Makefile
|
||||
@@ -10,7 +10,7 @@ objects = ctree.o disk-io.o radix-tree.o
|
||||
diff --git a/Makefile b/Makefile
|
||||
index a6c1ccede7c4..7f76447e3c55 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -10,7 +10,7 @@ objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
|
||||
root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
|
||||
extent-cache.o extent_io.o volumes.o utils.o repair.o \
|
||||
qgroup.o raid6.o free-space-cache.o list_sort.o props.o \
|
||||
- ulist.o qgroup-verify.o
|
||||
+ ulist.o qgroup-verify.o string-table.o
|
||||
- ulist.o qgroup-verify.o backref.o rbtree-utils.o
|
||||
+ ulist.o qgroup-verify.o backref.o rbtree-utils.o string-table.o
|
||||
cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
|
||||
cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
|
||||
cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
|
||||
@ -256,3 +256,6 @@ index 000000000000..83c4425d5f76
|
||||
+void table_free(struct string_table *);
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From bb2b9f64b992f166533cc0d06aeec9518795d24a Mon Sep 17 00:00:00 2001
|
||||
From fa083296aa7ff515a46ca05e6dbddb38e8c0745f Mon Sep 17 00:00:00 2001
|
||||
From: Goffredo Baroncelli <kreijack@libero.it>
|
||||
Date: Thu, 13 Feb 2014 20:19:50 +0100
|
||||
Subject: [PATCH 24/42] btrfs-progs: Add command btrfs filesystem disk-usage
|
||||
Subject: [PATCH 04/42] btrfs-progs: Add command btrfs filesystem disk-usage
|
||||
|
||||
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
@ -9,14 +9,14 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
cmds-fi-disk_usage.c | 428 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
cmds-fi-disk_usage.h | 3 +
|
||||
cmds-filesystem.c | 3 +
|
||||
utils.c | 60 ++++++++
|
||||
utils.c | 16 ++
|
||||
utils.h | 5 +
|
||||
5 files changed, 499 insertions(+)
|
||||
5 files changed, 455 insertions(+)
|
||||
|
||||
Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/cmds-fi-disk_usage.c
|
||||
+++ btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 7f4415666bd8..25cd4ede97ab 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -20,10 +20,12 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -44,7 +44,7 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
/*
|
||||
* Pretty print the size
|
||||
* PAY ATTENTION: it return a statically buffer
|
||||
@@ -514,3 +523,422 @@ int cmd_filesystem_df(int argc, char **a
|
||||
@@ -514,3 +523,422 @@ int cmd_filesystem_df(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
+ const char *description;
|
||||
+
|
||||
+ u64 flags = sargs->spaces[i].flags;
|
||||
+ description = group_type_str(flags);
|
||||
+ description = btrfs_group_type_str(flags);
|
||||
+
|
||||
+ table_printf(matrix, 1+i, 0, "<%s", description);
|
||||
+ }
|
||||
@ -176,7 +176,7 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
+ const char *r_mode;
|
||||
+
|
||||
+ u64 flags = sargs->spaces[i].flags;
|
||||
+ r_mode = group_profile_str(flags);
|
||||
+ r_mode = btrfs_group_profile_str(flags);
|
||||
+
|
||||
+ table_printf(matrix, 1+i, 1, "<%s", r_mode);
|
||||
+ }
|
||||
@ -338,8 +338,8 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
+ const char *r_mode;
|
||||
+
|
||||
+ u64 flags = sargs->spaces[i].flags;
|
||||
+ description= group_type_str(flags);
|
||||
+ r_mode = group_profile_str(flags);
|
||||
+ description = btrfs_group_type_str(flags);
|
||||
+ r_mode = btrfs_group_profile_str(flags);
|
||||
+
|
||||
+ printf("%s,%s: Size:%s, ",
|
||||
+ description,
|
||||
@ -467,10 +467,10 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
Index: btrfs-progs-v3.16/cmds-fi-disk_usage.h
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/cmds-fi-disk_usage.h
|
||||
+++ btrfs-progs-v3.16/cmds-fi-disk_usage.h
|
||||
diff --git a/cmds-fi-disk_usage.h b/cmds-fi-disk_usage.h
|
||||
index 9f68bb342d52..c7459b1521e4 100644
|
||||
--- a/cmds-fi-disk_usage.h
|
||||
+++ b/cmds-fi-disk_usage.h
|
||||
@@ -22,4 +22,7 @@
|
||||
extern const char * const cmd_filesystem_df_usage[];
|
||||
int cmd_filesystem_df(int argc, char **argv);
|
||||
@ -479,11 +479,11 @@ Index: btrfs-progs-v3.16/cmds-fi-disk_usage.h
|
||||
+int cmd_filesystem_disk_usage(int argc, char **argv);
|
||||
+
|
||||
#endif
|
||||
Index: btrfs-progs-v3.16/cmds-filesystem.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/cmds-filesystem.c
|
||||
+++ btrfs-progs-v3.16/cmds-filesystem.c
|
||||
@@ -918,6 +918,9 @@ const struct cmd_group filesystem_cmd_gr
|
||||
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
|
||||
index 91e4e2e5a881..43d5c31dcbb0 100644
|
||||
--- a/cmds-filesystem.c
|
||||
+++ b/cmds-filesystem.c
|
||||
@@ -1275,6 +1275,9 @@ const struct cmd_group filesystem_cmd_group = {
|
||||
{ "balance", cmd_balance, NULL, &balance_cmd_group, 1 },
|
||||
{ "resize", cmd_resize, cmd_resize_usage, NULL, 0 },
|
||||
{ "label", cmd_label, cmd_label_usage, NULL, 0 },
|
||||
@ -493,11 +493,11 @@ Index: btrfs-progs-v3.16/cmds-filesystem.c
|
||||
NULL_CMD_STRUCT
|
||||
}
|
||||
};
|
||||
Index: btrfs-progs-v3.16/utils.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/utils.c
|
||||
+++ btrfs-progs-v3.16/utils.c
|
||||
@@ -2448,3 +2448,63 @@ u64 disk_size(char *path)
|
||||
diff --git a/utils.c b/utils.c
|
||||
index cf0559d9c9dd..643f000a5bd0 100644
|
||||
--- a/utils.c
|
||||
+++ b/utils.c
|
||||
@@ -2486,3 +2486,19 @@ u64 disk_size(char *path)
|
||||
else
|
||||
return sfs.f_bsize * sfs.f_blocks;
|
||||
}
|
||||
@ -517,55 +517,11 @@ Index: btrfs-progs-v3.16/utils.c
|
||||
+
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Convert a chunk type to a chunk description
|
||||
+ */
|
||||
+const char *group_type_str(u64 flag)
|
||||
+{
|
||||
+ switch (flag & BTRFS_BLOCK_GROUP_TYPE_MASK) {
|
||||
+ case BTRFS_BLOCK_GROUP_DATA:
|
||||
+ return "Data";
|
||||
+ case BTRFS_BLOCK_GROUP_SYSTEM:
|
||||
+ return "System";
|
||||
+ case BTRFS_BLOCK_GROUP_METADATA:
|
||||
+ return "Metadata";
|
||||
+ case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
|
||||
+ return "Data+Metadata";
|
||||
+ default:
|
||||
+ return "unknown";
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Convert a chunk type to a chunk profile description
|
||||
+ */
|
||||
+const char *group_profile_str(u64 flag)
|
||||
+{
|
||||
+ switch (flag & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
|
||||
+ case 0:
|
||||
+ return "single";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID0:
|
||||
+ return "RAID0";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID1:
|
||||
+ return "RAID1";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID5:
|
||||
+ return "RAID5";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID6:
|
||||
+ return "RAID6";
|
||||
+ case BTRFS_BLOCK_GROUP_DUP:
|
||||
+ return "DUP";
|
||||
+ case BTRFS_BLOCK_GROUP_RAID10:
|
||||
+ return "RAID10";
|
||||
+ default:
|
||||
+ return "unknown";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/utils.h b/utils.h
|
||||
index c683818e003f..5c364b61dffa 100644
|
||||
index 2976e11d7a93..77455ef4d20e 100644
|
||||
--- a/utils.h
|
||||
+++ b/utils.h
|
||||
@@ -115,6 +115,11 @@ int get_device_info(int fd, u64 devid,
|
||||
@@ -134,6 +134,11 @@ int get_device_info(int fd, u64 devid,
|
||||
struct btrfs_ioctl_dev_info_args *di_args);
|
||||
int test_uuid_unique(char *fs_uuid);
|
||||
u64 disk_size(char *path);
|
||||
|
@ -1,7 +1,7 @@
|
||||
From b8eb50e005cc92d870faf6bfe285950c4ac66e09 Mon Sep 17 00:00:00 2001
|
||||
From 89a6910a4505829a88bca362541fa75e3ab829e3 Mon Sep 17 00:00:00 2001
|
||||
From: Goffredo Baroncelli <kreijack@libero.it>
|
||||
Date: Thu, 13 Feb 2014 20:20:12 +0100
|
||||
Subject: [PATCH 25/42] btrfs-progs: Add btrfs device disk-usage command
|
||||
Subject: [PATCH 05/42] btrfs-progs: Add btrfs device disk-usage command
|
||||
|
||||
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
@ -12,7 +12,7 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
3 files changed, 142 insertions(+)
|
||||
|
||||
diff --git a/cmds-device.c b/cmds-device.c
|
||||
index 29da661e2a0d..f2e08ba55ba6 100644
|
||||
index 62f0b85b4d0c..037332d87498 100644
|
||||
--- a/cmds-device.c
|
||||
+++ b/cmds-device.c
|
||||
@@ -28,6 +28,7 @@
|
||||
@ -23,7 +23,7 @@ index 29da661e2a0d..f2e08ba55ba6 100644
|
||||
|
||||
#include "commands.h"
|
||||
|
||||
@@ -435,6 +436,8 @@ const struct cmd_group device_cmd_group = {
|
||||
@@ -468,6 +469,8 @@ const struct cmd_group device_cmd_group = {
|
||||
{ "scan", cmd_scan_dev, cmd_scan_dev_usage, NULL, 0 },
|
||||
{ "ready", cmd_ready_dev, cmd_ready_dev_usage, NULL, 0 },
|
||||
{ "stats", cmd_dev_stats, cmd_dev_stats_usage, NULL, 0 },
|
||||
@ -33,7 +33,7 @@ index 29da661e2a0d..f2e08ba55ba6 100644
|
||||
}
|
||||
};
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 16b3ab250956..e4eb72be0a88 100644
|
||||
index 25cd4ede97ab..5274a73240cf 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -942,3 +942,139 @@ int cmd_filesystem_disk_usage(int argc, char **argv)
|
||||
@ -62,8 +62,8 @@ index 16b3ab250956..e4eb72be0a88 100644
|
||||
+
|
||||
+ flags = chunks_info_ptr[i].type;
|
||||
+
|
||||
+ description = group_type_str(flags);
|
||||
+ r_mode = group_profile_str(flags);
|
||||
+ description = btrfs_group_type_str(flags);
|
||||
+ r_mode = btrfs_group_profile_str(flags);
|
||||
+ size = calc_chunk_size(chunks_info_ptr+i);
|
||||
+ printf(" %s,%s:%*s%10s\n",
|
||||
+ description,
|
||||
@ -189,5 +189,5 @@ index c7459b1521e4..c315004cd806 100644
|
||||
+
|
||||
#endif
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a604369c26e4e816579c59d7a595279b1b720cbc Mon Sep 17 00:00:00 2001
|
||||
From 00f8e6d5c8262a3f3738784e21cf1aca08224efb Mon Sep 17 00:00:00 2001
|
||||
From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
|
||||
Date: Thu, 6 Mar 2014 11:36:46 +0800
|
||||
Subject: [PATCH 26/42] btrfs-progs: cleanup dead return after usage() for
|
||||
Subject: [PATCH 06/42] btrfs-progs: cleanup dead return after usage() for
|
||||
fi-disk_usage
|
||||
|
||||
The usage() calls exit() internally, so remove the return after it.
|
||||
@ -13,7 +13,7 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
1 file changed, 3 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index e4eb72be0a88..a3b06bebba72 100644
|
||||
index 5274a73240cf..edada5bbcf6b 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -494,10 +494,8 @@ int cmd_filesystem_df(int argc, char **argv)
|
||||
@ -53,5 +53,5 @@ index e4eb72be0a88..a3b06bebba72 100644
|
||||
for (i = optind; i < argc ; i++) {
|
||||
int r, fd;
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From ef568dad3da6887e656be617a178cbb69b36cdf3 Mon Sep 17 00:00:00 2001
|
||||
From bf9a3acde396575b141d9ac549aaf83466c0ab91 Mon Sep 17 00:00:00 2001
|
||||
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
|
||||
Date: Wed, 19 Mar 2014 06:10:02 +0000
|
||||
Subject: [PATCH 27/42] btrfs-progs: Fix memleak in get_raid56_used()
|
||||
Subject: [PATCH 07/42] btrfs-progs: Fix memleak in get_raid56_used()
|
||||
|
||||
Fix memleak in get_raid56_used().
|
||||
|
||||
@ -12,7 +12,7 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index a3b06bebba72..2bd591db0f8a 100644
|
||||
index edada5bbcf6b..736294eea3da 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -352,6 +352,7 @@ static int get_raid56_used(int fd, u64 *raid5_used, u64 *raid6_used)
|
||||
@ -24,5 +24,5 @@ index a3b06bebba72..2bd591db0f8a 100644
|
||||
return 0;
|
||||
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From b43d0660526d1a3e81f34fd499eb1dd038b00e08 Mon Sep 17 00:00:00 2001
|
||||
From 9102adcbc8521dfee5da2fd86b6f8333ee89f3d8 Mon Sep 17 00:00:00 2001
|
||||
From: Rakesh Pandit <rakesh@tuxera.com>
|
||||
Date: Sat, 19 Apr 2014 14:12:03 +0300
|
||||
Subject: [PATCH 28/42] Btrfs-progs: fi usage: free memory if realloc fails
|
||||
Subject: [PATCH 08/42] Btrfs-progs: fi usage: free memory if realloc fails
|
||||
|
||||
Lets not assign *info_ptr to 0 before calling free on it and lose
|
||||
track of already allocated memory if realloc fails in
|
||||
@ -14,7 +14,7 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 2bd591db0f8a..cd71c8da3cf4 100644
|
||||
index 736294eea3da..9fd59bc1b5ae 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -104,6 +104,7 @@ static int add_info_to_list(struct chunk_info **info_ptr,
|
||||
@ -34,5 +34,5 @@ index 2bd591db0f8a..cd71c8da3cf4 100644
|
||||
}
|
||||
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 28c2061817b8cb266458249cc7bdd770eb2b407b Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 16 Jan 2014 14:18:37 +0100
|
||||
Subject: [PATCH 29/42] btrfs-progs: read global reserve size from space infos
|
||||
|
||||
Kernels >= 3.15 export the global block reserve as a space info presented
|
||||
by 'btrfs fi df' but would display 'unknown' instead of some meaningful
|
||||
string.
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
ctree.h | 6 ++++++
|
||||
utils.c | 7 ++++++-
|
||||
2 files changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/utils.c b/utils.c
|
||||
index f2ab416c28b2..ca150404ea6f 100644
|
||||
--- a/utils.c
|
||||
+++ b/utils.c
|
||||
@@ -2473,7 +2473,10 @@ u64 get_partition_size(char *dev)
|
||||
*/
|
||||
const char *group_type_str(u64 flag)
|
||||
{
|
||||
- switch (flag & BTRFS_BLOCK_GROUP_TYPE_MASK) {
|
||||
+ u64 mask = BTRFS_BLOCK_GROUP_TYPE_MASK |
|
||||
+ BTRFS_SPACE_INFO_GLOBAL_RSV;
|
||||
+
|
||||
+ switch (flag & mask) {
|
||||
case BTRFS_BLOCK_GROUP_DATA:
|
||||
return "Data";
|
||||
case BTRFS_BLOCK_GROUP_SYSTEM:
|
||||
@@ -2482,6 +2485,8 @@ const char *group_type_str(u64 flag)
|
||||
return "Metadata";
|
||||
case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
|
||||
return "Data+Metadata";
|
||||
+ case BTRFS_SPACE_INFO_GLOBAL_RSV:
|
||||
+ return "GlobalReserve";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 90cbd00127631b5f8964d5518d6b22bfe994a686 Mon Sep 17 00:00:00 2001
|
||||
From 9a0ccdc7cc51262e98fa9345393aa45fd9bba9cb Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Wed, 23 Apr 2014 18:47:52 +0200
|
||||
Subject: [PATCH 30/42] btrfs-progs: add original 'df' and rename 'disk_usage'
|
||||
Subject: [PATCH 09/42] btrfs-progs: add original 'df' and rename 'disk_usage'
|
||||
to 'usage'
|
||||
|
||||
Add back the original output of the 'btrfs fi df' command for backward
|
||||
@ -13,11 +13,11 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-fi-disk_usage.c | 85 ++++++++++------------------------------------------
|
||||
cmds-fi-disk_usage.h | 7 ++---
|
||||
cmds-filesystem.c | 55 ++++++++++++++++++++++++++++++++--
|
||||
3 files changed, 71 insertions(+), 76 deletions(-)
|
||||
cmds-filesystem.c | 16 ++++------
|
||||
3 files changed, 24 insertions(+), 84 deletions(-)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index cd71c8da3cf4..efc640d13148 100644
|
||||
index 9fd59bc1b5ae..683d6fb36de4 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -328,6 +328,8 @@ static struct btrfs_ioctl_space_args *load_space_info(int fd, char *path)
|
||||
@ -205,75 +205,68 @@ index c315004cd806..95cf4aabefb4 100644
|
||||
extern const char * const cmd_device_disk_usage_usage[];
|
||||
int cmd_device_disk_usage(int argc, char **argv);
|
||||
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
|
||||
index 214a0cda518c..9340cb61cabe 100644
|
||||
index 43d5c31dcbb0..6626c7c9eaa2 100644
|
||||
--- a/cmds-filesystem.c
|
||||
+++ b/cmds-filesystem.c
|
||||
@@ -113,6 +113,26 @@ static const char * const filesystem_cmd_group_usage[] = {
|
||||
@@ -113,8 +113,7 @@ static const char * const filesystem_cmd_group_usage[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
-#if 0
|
||||
-static const char * const cmd_df_usage[] = {
|
||||
+static const char * const cmd_filesystem_df_usage[] = {
|
||||
+ "btrfs filesystem df <path>",
|
||||
+ "Show space usage information for a mount point",
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
+static void print_df(struct btrfs_ioctl_space_args *sargs)
|
||||
+{
|
||||
+ u64 i;
|
||||
+ struct btrfs_ioctl_space_info *sp = sargs->spaces;
|
||||
+
|
||||
+ for (i = 0; i < sargs->total_spaces; i++, sp++) {
|
||||
+ printf("%s, %s: total=%s, used=%s\n",
|
||||
+ group_type_str(sp->flags),
|
||||
+ group_profile_str(sp->flags),
|
||||
+ pretty_size(sp->total_bytes),
|
||||
+ pretty_size(sp->used_bytes));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
"btrfs filesystem df [options] <path>",
|
||||
"Show space usage information for a mount point",
|
||||
"-b|--raw raw numbers in bytes",
|
||||
@@ -128,7 +127,6 @@ static const char * const cmd_df_usage[] = {
|
||||
"-t|--tbytes show sizes in TiB, or tB with --si",
|
||||
NULL
|
||||
};
|
||||
-#endif
|
||||
|
||||
static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
|
||||
{
|
||||
u64 count = 0;
|
||||
@@ -161,6 +181,37 @@ static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
|
||||
@@ -178,7 +176,6 @@ static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#if 0
|
||||
static void print_df(struct btrfs_ioctl_space_args *sargs, unsigned unit_mode)
|
||||
{
|
||||
u64 i;
|
||||
@@ -193,7 +190,7 @@ static void print_df(struct btrfs_ioctl_space_args *sargs, unsigned unit_mode)
|
||||
}
|
||||
}
|
||||
|
||||
-static int cmd_df(int argc, char **argv)
|
||||
+static int cmd_filesystem_df(int argc, char **argv)
|
||||
+{
|
||||
+ struct btrfs_ioctl_space_args *sargs = NULL;
|
||||
+ int ret;
|
||||
+ int fd;
|
||||
+ char *path;
|
||||
+ DIR *dirstream = NULL;
|
||||
+
|
||||
+ if (check_argc_exact(argc, 2))
|
||||
{
|
||||
struct btrfs_ioctl_space_args *sargs = NULL;
|
||||
int ret;
|
||||
@@ -247,12 +244,12 @@ static int cmd_df(int argc, char **argv)
|
||||
units_set_mode(&unit_mode, UNITS_BINARY);
|
||||
break;
|
||||
default:
|
||||
- usage(cmd_df_usage);
|
||||
+ usage(cmd_filesystem_df_usage);
|
||||
+
|
||||
+ path = argv[1];
|
||||
+
|
||||
+ fd = open_file_or_dir(path, &dirstream);
|
||||
+ if (fd < 0) {
|
||||
+ fprintf(stderr, "ERROR: can't access '%s'\n", path);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ ret = get_df(fd, &sargs);
|
||||
+
|
||||
+ if (!ret && sargs) {
|
||||
+ print_df(sargs);
|
||||
+ free(sargs);
|
||||
+ } else {
|
||||
+ fprintf(stderr, "ERROR: get_df failed %s\n", strerror(-ret));
|
||||
+ }
|
||||
+
|
||||
+ close_file_or_dir(fd, dirstream);
|
||||
+ return !!ret;
|
||||
+}
|
||||
+
|
||||
}
|
||||
}
|
||||
|
||||
if (check_argc_max(argc, optind + 1))
|
||||
- usage(cmd_df_usage);
|
||||
+ usage(cmd_filesystem_df_usage);
|
||||
|
||||
path = argv[optind];
|
||||
|
||||
@@ -273,7 +270,6 @@ static int cmd_df(int argc, char **argv)
|
||||
close_file_or_dir(fd, dirstream);
|
||||
return !!ret;
|
||||
}
|
||||
-#endif
|
||||
|
||||
static int match_search_item_kernel(__u8 *fsid, char *mnt, char *label,
|
||||
char *search)
|
||||
{
|
||||
@@ -918,8 +969,8 @@ const struct cmd_group filesystem_cmd_group = {
|
||||
@@ -1275,8 +1271,8 @@ const struct cmd_group filesystem_cmd_group = {
|
||||
{ "balance", cmd_balance, NULL, &balance_cmd_group, 1 },
|
||||
{ "resize", cmd_resize, cmd_resize_usage, NULL, 0 },
|
||||
{ "label", cmd_label, cmd_label_usage, NULL, 0 },
|
||||
@ -285,5 +278,5 @@ index 214a0cda518c..9340cb61cabe 100644
|
||||
NULL_CMD_STRUCT
|
||||
}
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 14462c746c40b97dd8efe0bea18cbc6372431a39 Mon Sep 17 00:00:00 2001
|
||||
From b90d57cf167b689fd1e191b80649bfcba42865b7 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Wed, 23 Apr 2014 19:00:22 +0200
|
||||
Subject: [PATCH 31/42] btrfs-progs: move device usage to cmds-device, more
|
||||
Subject: [PATCH 10/42] btrfs-progs: move device usage to cmds-device, more
|
||||
cleanups
|
||||
|
||||
Move the command definitions where they belong, keep common 'usage'
|
||||
@ -19,10 +19,10 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
3 files changed, 188 insertions(+), 219 deletions(-)
|
||||
|
||||
diff --git a/cmds-device.c b/cmds-device.c
|
||||
index f2e08ba55ba6..c20b26e9be90 100644
|
||||
index 037332d87498..96e6309c0185 100644
|
||||
--- a/cmds-device.c
|
||||
+++ b/cmds-device.c
|
||||
@@ -429,6 +429,98 @@ out:
|
||||
@@ -462,6 +462,98 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ index f2e08ba55ba6..c20b26e9be90 100644
|
||||
const struct cmd_group device_cmd_group = {
|
||||
device_cmd_group_usage, NULL, {
|
||||
{ "add", cmd_add_dev, cmd_add_dev_usage, NULL, 0 },
|
||||
@@ -436,8 +528,8 @@ const struct cmd_group device_cmd_group = {
|
||||
@@ -469,8 +561,8 @@ const struct cmd_group device_cmd_group = {
|
||||
{ "scan", cmd_scan_dev, cmd_scan_dev_usage, NULL, 0 },
|
||||
{ "ready", cmd_ready_dev, cmd_ready_dev_usage, NULL, 0 },
|
||||
{ "stats", cmd_dev_stats, cmd_dev_stats_usage, NULL, 0 },
|
||||
@ -133,7 +133,7 @@ index f2e08ba55ba6..c20b26e9be90 100644
|
||||
}
|
||||
};
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index efc640d13148..023659daac0e 100644
|
||||
index 683d6fb36de4..f432fa57fb91 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -26,38 +26,16 @@
|
||||
@ -708,5 +708,5 @@ index 95cf4aabefb4..787b4eb56acf 100644
|
||||
|
||||
#endif
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a6979c52fbff0e0961a0a0546c45bca11f6a0658 Mon Sep 17 00:00:00 2001
|
||||
From 10fd49e8ced9a8fe34a409ab76c69488b9aef704 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 24 Apr 2014 15:21:16 +0200
|
||||
Subject: [PATCH 32/42] btrfs-progs: check if we can't get info from ioctls due
|
||||
Subject: [PATCH 11/42] btrfs-progs: check if we can't get info from ioctls due
|
||||
to permissions
|
||||
|
||||
The TREE_SEARCH ioctl is root-only, FS_INFO will be available for
|
||||
@ -13,7 +13,7 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 023659daac0e..3fa2af004dc4 100644
|
||||
index f432fa57fb91..8bc4f58fee0b 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -172,6 +172,12 @@ int load_chunk_info(int fd, struct chunk_info **info_ptr, int *info_count)
|
||||
@ -41,5 +41,5 @@ index 023659daac0e..3fa2af004dc4 100644
|
||||
fprintf(stderr, "ERROR: cannot get filesystem info\n");
|
||||
return -1;
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 70b51a393b7d9ee6d20b16be0c925c58ea88f3c5 Mon Sep 17 00:00:00 2001
|
||||
From 5a44a4939129de6edb249c03133e5db347739643 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 24 Apr 2014 18:37:50 +0200
|
||||
Subject: [PATCH 33/42] btrfs-progs: zero out structures before calling ioctl
|
||||
Subject: [PATCH 12/42] btrfs-progs: zero out structures before calling ioctl
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
@ -9,7 +9,7 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 3fa2af004dc4..8c0462230510 100644
|
||||
index 8bc4f58fee0b..f984be838e3b 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -248,7 +248,7 @@ static struct btrfs_ioctl_space_args *load_space_info(int fd, char *path)
|
||||
@ -40,5 +40,5 @@ index 3fa2af004dc4..8c0462230510 100644
|
||||
|
||||
if (ret == -ENODEV)
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 86b1a432b74285db0096fdd4894626cb26773eeb Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 24 Apr 2014 18:31:28 +0200
|
||||
Subject: [PATCH 34/42] btrfs-progs: print B for bytes
|
||||
|
||||
This arguably helps parsers.
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
utils.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/utils.c b/utils.c
|
||||
index ca150404ea6f..159abf8bd0e4 100644
|
||||
--- a/utils.c
|
||||
+++ b/utils.c
|
||||
@@ -1252,7 +1252,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static char *size_strs[] = { "", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"};
|
||||
+static char *size_strs[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"};
|
||||
int pretty_size_snprintf(u64 size, char *str, size_t str_bytes)
|
||||
{
|
||||
int num_divs = 0;
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,7 +1,7 @@
|
||||
From c856f30b979c71ab5cda62753993e725dae922e6 Mon Sep 17 00:00:00 2001
|
||||
From 685cfb2cb0a7b402c9074e08d2803e275c6f78eb Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 24 Apr 2014 18:32:27 +0200
|
||||
Subject: [PATCH 35/42] btrfs-progs: Print more info about device sizes
|
||||
Subject: [PATCH 13/42] btrfs-progs: Print more info about device sizes
|
||||
|
||||
The entire device size may not be available to the filesystem, eg. if
|
||||
it's modified via resize. Print this information if it can be obtained
|
||||
@ -22,15 +22,15 @@ Sample:
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-device.c | 6 +++---
|
||||
cmds-fi-disk_usage.c | 13 ++++++++++++-
|
||||
cmds-fi-disk_usage.c | 12 +++++++++++-
|
||||
cmds-fi-disk_usage.h | 6 +++++-
|
||||
3 files changed, 20 insertions(+), 5 deletions(-)
|
||||
3 files changed, 19 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/cmds-device.c b/cmds-device.c
|
||||
index c20b26e9be90..154188643c8f 100644
|
||||
index 96e6309c0185..f9a23ac644c0 100644
|
||||
--- a/cmds-device.c
|
||||
+++ b/cmds-device.c
|
||||
@@ -453,9 +453,9 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
@@ -486,9 +486,9 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
}
|
||||
|
||||
for (i = 0; i < device_info_count; i++) {
|
||||
@ -44,7 +44,7 @@ index c20b26e9be90..154188643c8f 100644
|
||||
device_info_ptr[i].size,
|
||||
info_ptr, info_count,
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 8c0462230510..63ed9ba089d5 100644
|
||||
index f984be838e3b..83a3c6d52cc5 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -499,7 +499,8 @@ int load_device_info(int fd, struct device_info **device_info_ptr,
|
||||
@ -53,7 +53,7 @@ index 8c0462230510..63ed9ba089d5 100644
|
||||
strcpy(info[ndevs].path, (char *)dev_info.path);
|
||||
- info[ndevs].size = get_partition_size((char *)dev_info.path);
|
||||
+ info[ndevs].device_size = get_partition_size((char *)dev_info.path);
|
||||
+ info[ndevs].size = dev_info.total_size;
|
||||
+ info[ndevs].size = dev_info.total_bytes;
|
||||
++ndevs;
|
||||
}
|
||||
|
||||
@ -96,5 +96,5 @@ index 787b4eb56acf..79cc2a115bc5 100644
|
||||
|
||||
#endif
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From a2b5656ac87bd741153b97ac1e7bcf40ecc4f16c Mon Sep 17 00:00:00 2001
|
||||
From f775e02b0210e5128f980a19a5490c58d80bfc27 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 24 Apr 2014 18:57:12 +0200
|
||||
Subject: [PATCH 36/42] btrfs-progs: compare unallocated space against the
|
||||
Subject: [PATCH 14/42] btrfs-progs: compare unallocated space against the
|
||||
correct value
|
||||
|
||||
The device may not be fully occupied by the filesystem, the value of
|
||||
@ -11,15 +11,15 @@ size provided by DEV_INFO.
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-device.c | 6 ++----
|
||||
cmds-fi-disk_usage.c | 9 ++++-----
|
||||
cmds-fi-disk_usage.c | 6 +++---
|
||||
cmds-fi-disk_usage.h | 2 +-
|
||||
3 files changed, 7 insertions(+), 10 deletions(-)
|
||||
3 files changed, 6 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/cmds-device.c b/cmds-device.c
|
||||
index 154188643c8f..3e851badc116 100644
|
||||
index f9a23ac644c0..1de7f007ed43 100644
|
||||
--- a/cmds-device.c
|
||||
+++ b/cmds-device.c
|
||||
@@ -456,10 +456,8 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
@@ -489,10 +489,8 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
printf("%s, ID: %llu\n", device_info_ptr[i].path,
|
||||
device_info_ptr[i].devid);
|
||||
print_device_sizes(fd, &device_info_ptr[i], mode);
|
||||
@ -33,18 +33,9 @@ index 154188643c8f..3e851badc116 100644
|
||||
}
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 63ed9ba089d5..0e93dc836f16 100644
|
||||
index 83a3c6d52cc5..0ee6e6bb5dc4 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -500,7 +500,7 @@ int load_device_info(int fd, struct device_info **device_info_ptr,
|
||||
info[ndevs].devid = dev_info.devid;
|
||||
strcpy(info[ndevs].path, (char *)dev_info.path);
|
||||
info[ndevs].device_size = get_partition_size((char *)dev_info.path);
|
||||
- info[ndevs].size = dev_info.total_size;
|
||||
+ info[ndevs].size = dev_info.total_bytes;
|
||||
++ndevs;
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ int cmd_filesystem_usage(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
@ -86,5 +77,5 @@ index 79cc2a115bc5..dbc2a10f31eb 100644
|
||||
int chunks_info_count, int mode);
|
||||
void print_device_sizes(int fd, struct device_info *devinfo, int mode);
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From d8ca04ddc42461c462e3b52031e1134f01c71663 Mon Sep 17 00:00:00 2001
|
||||
From d8f3097050e2b7545aed2119e39e9763f21923a3 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Fri, 25 Apr 2014 17:24:40 +0200
|
||||
Subject: [PATCH 37/42] btrfs-progs: add section of overall filesystem usage
|
||||
Subject: [PATCH 15/42] btrfs-progs: add section of overall filesystem usage
|
||||
|
||||
The 'fi usage' lacks an overall report, this used to be in the enhanced
|
||||
df command. Add it back.
|
||||
@ -22,7 +22,7 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
1 file changed, 13 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 0e93dc836f16..e17f04e31d35 100644
|
||||
index 0ee6e6bb5dc4..92402bea314c 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -302,8 +302,6 @@ static struct btrfs_ioctl_space_args *load_space_info(int fd, char *path)
|
||||
@ -103,5 +103,5 @@ index 0e93dc836f16..e17f04e31d35 100644
|
||||
close_file_or_dir(fd, dirstream);
|
||||
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From e81d2614ff21e3e9e723cc645cc73646a42d06e8 Mon Sep 17 00:00:00 2001
|
||||
From 5f40eaf09d3c21a6422bc03639a46f4a4087f867 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Fri, 25 Apr 2014 19:39:11 +0200
|
||||
Subject: [PATCH 38/42] btrfs-progs: cleanup filesystem/device usage code
|
||||
Subject: [PATCH 16/42] btrfs-progs: cleanup filesystem/device usage code
|
||||
|
||||
The main point of this is to load the device and chunk infos at one
|
||||
place and pass down to the printers. The EPERM is handled separately, in
|
||||
@ -22,10 +22,10 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
3 files changed, 105 insertions(+), 94 deletions(-)
|
||||
|
||||
diff --git a/cmds-device.c b/cmds-device.c
|
||||
index 3e851badc116..bf5898f6da68 100644
|
||||
index 1de7f007ed43..9ab60bcafedc 100644
|
||||
--- a/cmds-device.c
|
||||
+++ b/cmds-device.c
|
||||
@@ -441,31 +441,29 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
@@ -474,31 +474,29 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
@ -71,7 +71,7 @@ index 3e851badc116..bf5898f6da68 100644
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -507,6 +505,7 @@ int cmd_device_usage(int argc, char **argv)
|
||||
@@ -540,6 +538,7 @@ int cmd_device_usage(int argc, char **argv)
|
||||
argv[1]);
|
||||
return 12;
|
||||
}
|
||||
@ -80,7 +80,7 @@ index 3e851badc116..bf5898f6da68 100644
|
||||
close_file_or_dir(fd, dirstream);
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index e17f04e31d35..9d1c4085b4ea 100644
|
||||
index 92402bea314c..3be0e6173eec 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -141,7 +141,7 @@ static int cmp_chunk_info(const void *a, const void *b)
|
||||
@ -368,5 +368,5 @@ index dbc2a10f31eb..0779defc71db 100644
|
||||
void print_device_chunks(int fd, struct device_info *devinfo,
|
||||
struct chunk_info *chunks_info_ptr,
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,169 +0,0 @@
|
||||
From f54a92b54b57ea8be8d55ea012c9b69c9f0db5ff Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Mon, 28 Apr 2014 18:04:48 +0200
|
||||
Subject: [PATCH 39/42] btrfs-progs: extend pretty printers with unit mode
|
||||
|
||||
The functionality of pretty unit printing was duplicated by
|
||||
df_pretty_sizes, merge it with pretty_size and enhance the interface
|
||||
with more suffix mode. Raw, binary or decimal.
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-fi-disk_usage.c | 9 ++-----
|
||||
utils.c | 71 ++++++++++++++++++++++++++++++++++++----------------
|
||||
utils.h | 21 +++++++++++-----
|
||||
3 files changed, 66 insertions(+), 35 deletions(-)
|
||||
|
||||
Index: btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/cmds-fi-disk_usage.c
|
||||
+++ btrfs-progs-v3.16/cmds-fi-disk_usage.c
|
||||
@@ -33,18 +33,13 @@
|
||||
|
||||
/*
|
||||
* Pretty print the size
|
||||
- * PAY ATTENTION: it return a statically buffer
|
||||
*/
|
||||
char *df_pretty_sizes(u64 size, int mode)
|
||||
{
|
||||
- static char buf[30];
|
||||
-
|
||||
if (mode & DF_HUMAN_UNIT)
|
||||
- (void)pretty_size_snprintf(size, buf, sizeof(buf));
|
||||
+ return pretty_size_mode(size, UNITS_HUMAN);
|
||||
else
|
||||
- sprintf(buf, "%llu", size);
|
||||
-
|
||||
- return buf;
|
||||
+ return pretty_size_mode(size, UNITS_RAW);
|
||||
}
|
||||
|
||||
/*
|
||||
Index: btrfs-progs-v3.16/utils.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/utils.c
|
||||
+++ btrfs-progs-v3.16/utils.c
|
||||
@@ -1378,35 +1378,62 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static char *size_strs[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"};
|
||||
-int pretty_size_snprintf(u64 size, char *str, size_t str_bytes)
|
||||
+static const char const *unit_suffix_binary[] =
|
||||
+ { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"};
|
||||
+static const char const *unit_suffix_decimal[] =
|
||||
+ { "B", "KB", "MB", "GB", "TB", "PB", "EB"};
|
||||
+
|
||||
+int pretty_size_snprintf(u64 size, char *str, size_t str_size, int unit_mode)
|
||||
{
|
||||
- int num_divs = 0;
|
||||
+ int num_divs;
|
||||
float fraction;
|
||||
+ int base = 0;
|
||||
+ const char const **suffix = NULL;
|
||||
+ u64 last_size;
|
||||
|
||||
- if (str_bytes == 0)
|
||||
+ if (str_size == 0)
|
||||
return 0;
|
||||
|
||||
- if( size < 1024 ){
|
||||
- fraction = size;
|
||||
- num_divs = 0;
|
||||
- } else {
|
||||
- u64 last_size = size;
|
||||
- num_divs = 0;
|
||||
- while(size >= 1024){
|
||||
- last_size = size;
|
||||
- size /= 1024;
|
||||
- num_divs ++;
|
||||
- }
|
||||
+ if (unit_mode == UNITS_RAW) {
|
||||
+ snprintf(str, str_size, "%llu", size);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
- if (num_divs >= ARRAY_SIZE(size_strs)) {
|
||||
- str[0] = '\0';
|
||||
- return -1;
|
||||
- }
|
||||
- fraction = (float)last_size / 1024;
|
||||
+ if (unit_mode == UNITS_BINARY) {
|
||||
+ base = 1024;
|
||||
+ suffix = unit_suffix_binary;
|
||||
+ } else if (unit_mode == UNITS_DECIMAL) {
|
||||
+ base = 1000;
|
||||
+ suffix = unit_suffix_decimal;
|
||||
}
|
||||
- return snprintf(str, str_bytes, "%.2f%s", fraction,
|
||||
- size_strs[num_divs]);
|
||||
+
|
||||
+ /* Unknown mode */
|
||||
+ if (!base) {
|
||||
+ fprintf(stderr, "INTERNAL ERROR: unknown unit base, mode %d",
|
||||
+ unit_mode);
|
||||
+ assert(0);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ num_divs = 0;
|
||||
+ last_size = size;
|
||||
+
|
||||
+ while (size >= base) {
|
||||
+ last_size = size;
|
||||
+ size /= base;
|
||||
+ num_divs++;
|
||||
+ }
|
||||
+
|
||||
+ if (num_divs >= ARRAY_SIZE(unit_suffix_binary)) {
|
||||
+ str[0] = '\0';
|
||||
+ printf("INTERNAL ERROR: unsupported unit suffix, index %d\n",
|
||||
+ num_divs);
|
||||
+ assert(0);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ fraction = (float)last_size / base;
|
||||
+
|
||||
+ return snprintf(str, str_size, "%.2f%s", fraction, suffix[num_divs]);
|
||||
}
|
||||
|
||||
/*
|
||||
Index: btrfs-progs-v3.16/utils.h
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/utils.h
|
||||
+++ btrfs-progs-v3.16/utils.h
|
||||
@@ -49,6 +49,14 @@ int check_argc_max(int nargs, int expect
|
||||
void fixup_argv0(char **argv, const char *token);
|
||||
void set_argv0(char **argv);
|
||||
|
||||
+/*
|
||||
+ * Output mode of byte units
|
||||
+ */
|
||||
+#define UNITS_RAW (1)
|
||||
+#define UNITS_BINARY (2)
|
||||
+#define UNITS_DECIMAL (3)
|
||||
+#define UNITS_HUMAN UNITS_BINARY
|
||||
+
|
||||
int make_btrfs(int fd, const char *device, const char *label,
|
||||
char *fs_uuid, u64 blocks[6], u64 num_bytes, u32 nodesize,
|
||||
u32 leafsize, u32 sectorsize, u32 stripesize, u64 features);
|
||||
@@ -71,12 +79,13 @@ int check_mounted_where(int fd, const ch
|
||||
int btrfs_device_already_in_root(struct btrfs_root *root, int fd,
|
||||
int super_offset);
|
||||
|
||||
-int pretty_size_snprintf(u64 size, char *str, size_t str_bytes);
|
||||
-#define pretty_size(size) \
|
||||
- ({ \
|
||||
- static __thread char _str[24]; \
|
||||
- (void)pretty_size_snprintf((size), _str, sizeof(_str)); \
|
||||
- _str; \
|
||||
+int pretty_size_snprintf(u64 size, char *str, size_t str_bytes, int unit_mode);
|
||||
+#define pretty_size(size) pretty_size_mode(size, UNITS_BINARY)
|
||||
+#define pretty_size_mode(size, mode) \
|
||||
+ ({ \
|
||||
+ static __thread char _str[32]; \
|
||||
+ (void)pretty_size_snprintf((size), _str, sizeof(_str), mode); \
|
||||
+ _str; \
|
||||
})
|
||||
|
||||
int get_mountpt(char *dev, char *mntpt, size_t size);
|
296
0028-btrfs-progs-rework-calculations-of-fi-usage.patch
Normal file
296
0028-btrfs-progs-rework-calculations-of-fi-usage.patch
Normal file
@ -0,0 +1,296 @@
|
||||
From 5a16b93f94cfdb7b2028bc9498dd33131254e164 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 26 Jun 2014 15:42:24 +0200
|
||||
Subject: [PATCH 25/42] btrfs-progs: rework calculations of fi usage
|
||||
|
||||
This patch reworks the basic calculations of 'fi usage'. It does not address
|
||||
all problems but should make the code more prepared to do so.
|
||||
|
||||
The original code tries to estimate the free space that could lead to negative
|
||||
numbers for some raid profiles:
|
||||
|
||||
Data, RAID1: total=147.00GiB, used=141.92GiB
|
||||
System, RAID1: total=32.00MiB, used=36.00KiB
|
||||
Metadata, RAID1: total=2.00GiB, used=1.17GiB
|
||||
GlobalReserve, single: total=404.00MiB, used=0.00B
|
||||
|
||||
Overall:
|
||||
Device size: 279.46GiB
|
||||
Device allocated: 298.06GiB
|
||||
Device unallocated: 16.00EiB
|
||||
Used: 286.18GiB
|
||||
Free (estimated): 8.00EiB (min: 8.00EiB)
|
||||
Data ratio: 2.00
|
||||
Metadata ratio: 2.00
|
||||
Global reserve: 404.00MiB (used: 0.00B)
|
||||
|
||||
Eg. "Device size" - "Device allocated" = negative number or a very large
|
||||
positive, hence the EiB values.
|
||||
|
||||
There are logical and raw numbers multiplied by ratios mixed together,
|
||||
so the new code makes it explicit which kind is being used. The data and
|
||||
metadata ratios are calculated separately.
|
||||
|
||||
Output after this patch will look like:
|
||||
|
||||
Overall:
|
||||
Device size: 558.92GiB
|
||||
Device allocated: 298.06GiB
|
||||
Device unallocated: 260.86GiB
|
||||
Used: 286.18GiB
|
||||
Free (estimated): 135.51GiB (min: 135.51GiB)
|
||||
Data ratio: 2.00
|
||||
Metadata ratio: 2.00
|
||||
Global reserve: 404.00MiB (used: 0.00B)
|
||||
|
||||
Data,RAID1: Size:147.00GiB, Used:141.92GiB
|
||||
/dev/sdc 147.00GiB
|
||||
/dev/sdd 147.00GiB
|
||||
|
||||
Metadata,RAID1: Size:2.00GiB, Used:1.17GiB
|
||||
/dev/sdc 2.00GiB
|
||||
/dev/sdd 2.00GiB
|
||||
|
||||
System,RAID1: Size:32.00MiB, Used:36.00KiB
|
||||
/dev/sdc 32.00MiB
|
||||
/dev/sdd 32.00MiB
|
||||
|
||||
Unallocated:
|
||||
/dev/sdc 130.43GiB
|
||||
/dev/sdd 130.43GiB
|
||||
|
||||
Changes:
|
||||
* Device size is now the raw size, same for the following three
|
||||
* Free is the logical size
|
||||
* Max/min were reduced to just min
|
||||
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
/dev/sdc 280G 144G 141G 51% /mnt/sdc
|
||||
|
||||
The difference between Avail and Free is there because userspace tool does a
|
||||
different guesswork than kernel.
|
||||
|
||||
Issues not addressed by this patch:
|
||||
* RAID56 profiles are not handled
|
||||
* mixed profiles are not handled
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-fi-disk_usage.c | 151 +++++++++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 103 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index d95024faf061..6a33b5d1da51 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -306,6 +306,7 @@ static void get_raid56_used(int fd, struct chunk_info *chunks, int chunkcount,
|
||||
}
|
||||
}
|
||||
|
||||
+#define MIN_UNALOCATED_THRESH (16 * 1024 * 1024)
|
||||
static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
int chunkcount, struct device_info *devinfo, int devcount,
|
||||
char *path, int mode)
|
||||
@@ -313,16 +314,33 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
struct btrfs_ioctl_space_args *sargs = 0;
|
||||
int i;
|
||||
int ret = 0;
|
||||
- int e, width;
|
||||
- u64 total_disk; /* filesystem size == sum of
|
||||
- device sizes */
|
||||
- u64 total_chunks; /* sum of chunks sizes on disk(s) */
|
||||
- u64 total_used; /* logical space used */
|
||||
- u64 total_free; /* logical space un-used */
|
||||
- double K;
|
||||
- u64 raid5_used, raid6_used;
|
||||
- u64 global_reserve;
|
||||
- u64 global_reserve_used;
|
||||
+ int width = 10; /* default 10 for human units */
|
||||
+ /*
|
||||
+ * r_* prefix is for raw data
|
||||
+ * l_* is for logical
|
||||
+ */
|
||||
+ u64 r_total_size = 0; /* filesystem size, sum of device sizes */
|
||||
+ u64 r_total_chunks = 0; /* sum of chunks sizes on disk(s) */
|
||||
+ u64 r_total_used = 0;
|
||||
+ u64 r_total_unused = 0;
|
||||
+ u64 r_data_used = 0;
|
||||
+ u64 r_data_chunks = 0;
|
||||
+ u64 l_data_chunks = 0;
|
||||
+ u64 r_metadata_used = 0;
|
||||
+ u64 r_metadata_chunks = 0;
|
||||
+ u64 l_metadata_chunks = 0;
|
||||
+ u64 r_system_used = 0;
|
||||
+ u64 r_system_chunks = 0;
|
||||
+ double data_ratio;
|
||||
+ double metadata_ratio;
|
||||
+ /* logical */
|
||||
+ u64 raid5_used = 0;
|
||||
+ u64 raid6_used = 0;
|
||||
+ u64 l_global_reserve = 0;
|
||||
+ u64 l_global_reserve_used = 0;
|
||||
+ u64 free_estimated = 0;
|
||||
+ u64 free_min = 0;
|
||||
+ int max_data_ratio = 1;
|
||||
|
||||
sargs = load_space_info(fd, path);
|
||||
if (!sargs) {
|
||||
@@ -330,27 +348,22 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
- total_disk = disk_size(path);
|
||||
- e = errno;
|
||||
- if (total_disk == 0) {
|
||||
+ r_total_size = 0;
|
||||
+ for (i = 0; i < devcount; i++)
|
||||
+ r_total_size += devinfo[i].device_size;
|
||||
+
|
||||
+ if (r_total_size == 0) {
|
||||
fprintf(stderr,
|
||||
"ERROR: couldn't get space info on '%s' - %s\n",
|
||||
- path, strerror(e));
|
||||
+ path, strerror(errno));
|
||||
|
||||
ret = 1;
|
||||
goto exit;
|
||||
}
|
||||
get_raid56_used(fd, chunkinfo, chunkcount, &raid5_used, &raid6_used);
|
||||
|
||||
- total_chunks = 0;
|
||||
- total_used = 0;
|
||||
- total_free = 0;
|
||||
- global_reserve = 0;
|
||||
- global_reserve_used = 0;
|
||||
-
|
||||
for (i = 0; i < sargs->total_spaces; i++) {
|
||||
- float ratio = 1;
|
||||
- u64 allocated;
|
||||
+ int ratio;
|
||||
u64 flags = sargs->spaces[i].flags;
|
||||
|
||||
/*
|
||||
@@ -372,52 +385,94 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
else
|
||||
ratio = 1;
|
||||
|
||||
+ if (!ratio)
|
||||
+ fprintf(stderr, "WARNING: RAID56 detected, not implemented\n");
|
||||
+
|
||||
+ if (ratio > max_data_ratio)
|
||||
+ max_data_ratio = ratio;
|
||||
+
|
||||
if (flags & BTRFS_SPACE_INFO_GLOBAL_RSV) {
|
||||
- global_reserve = sargs->spaces[i].total_bytes;
|
||||
- global_reserve_used = sargs->spaces[i].used_bytes;
|
||||
+ l_global_reserve = sargs->spaces[i].total_bytes;
|
||||
+ l_global_reserve_used = sargs->spaces[i].used_bytes;
|
||||
+ }
|
||||
+ if ((flags & (BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_METADATA))
|
||||
+ == (BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_METADATA)) {
|
||||
+ fprintf(stderr, "WARNING: MIXED blockgroups not handled\n");
|
||||
}
|
||||
|
||||
- allocated = sargs->spaces[i].total_bytes * ratio;
|
||||
+ if (flags & BTRFS_BLOCK_GROUP_DATA) {
|
||||
+ r_data_used += sargs->spaces[i].used_bytes * ratio;
|
||||
+ r_data_chunks += sargs->spaces[i].total_bytes * ratio;
|
||||
+ l_data_chunks += sargs->spaces[i].total_bytes;
|
||||
+ }
|
||||
+ if (flags & BTRFS_BLOCK_GROUP_METADATA) {
|
||||
+ r_metadata_used += sargs->spaces[i].used_bytes * ratio;
|
||||
+ r_metadata_chunks += sargs->spaces[i].total_bytes * ratio;
|
||||
+ l_metadata_chunks += sargs->spaces[i].total_bytes;
|
||||
+ }
|
||||
+ if (flags & BTRFS_BLOCK_GROUP_SYSTEM) {
|
||||
+ r_system_used += sargs->spaces[i].used_bytes * ratio;
|
||||
+ r_system_chunks += sargs->spaces[i].total_bytes * ratio;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- total_chunks += allocated;
|
||||
- total_used += sargs->spaces[i].used_bytes;
|
||||
- total_free += (sargs->spaces[i].total_bytes -
|
||||
- sargs->spaces[i].used_bytes);
|
||||
+ r_total_chunks = r_data_chunks + r_metadata_chunks + r_system_chunks;
|
||||
+ r_total_used = r_data_used + r_metadata_used + r_system_used;
|
||||
+ r_total_unused = r_total_size - r_total_chunks;
|
||||
|
||||
- }
|
||||
+ /* Raw / Logical = raid factor, >= 1 */
|
||||
+ data_ratio = (double)r_data_chunks / l_data_chunks;
|
||||
+ metadata_ratio = (double)r_metadata_chunks / l_metadata_chunks;
|
||||
|
||||
+#if 0
|
||||
/* add the raid5/6 allocated space */
|
||||
total_chunks += raid5_used + raid6_used;
|
||||
+#endif
|
||||
|
||||
- K = ((double)total_used + (double)total_free) / (double)total_chunks;
|
||||
+ /*
|
||||
+ * We're able to fill at least DATA for the unused space
|
||||
+ *
|
||||
+ * With mixed raid levels, this gives a rough estimate but more
|
||||
+ * accurate than just counting the logical free space
|
||||
+ * (l_data_chunks - l_data_used)
|
||||
+ *
|
||||
+ * In non-mixed case there's no difference.
|
||||
+ */
|
||||
+ free_estimated = (r_data_chunks - r_data_used) / data_ratio;
|
||||
+ free_min = free_estimated;
|
||||
+
|
||||
+ /* Chop unallocatable space */
|
||||
+ /* FIXME: must be applied per device */
|
||||
+ if (r_total_unused >= MIN_UNALOCATED_THRESH) {
|
||||
+ free_estimated += r_total_unused / data_ratio;
|
||||
+ /* Match the calculation of 'df', use the highest raid ratio */
|
||||
+ free_min += r_total_unused / max_data_ratio;
|
||||
+ }
|
||||
|
||||
- if (mode == UNITS_HUMAN)
|
||||
- width = 10;
|
||||
- else
|
||||
+ if (mode != UNITS_HUMAN)
|
||||
width = 18;
|
||||
|
||||
printf("Overall:\n");
|
||||
|
||||
printf(" Device size:\t\t%*s\n", width,
|
||||
- pretty_size_mode(total_disk, mode));
|
||||
+ pretty_size_mode(r_total_size, mode));
|
||||
printf(" Device allocated:\t\t%*s\n", width,
|
||||
- pretty_size_mode(total_chunks, mode));
|
||||
+ pretty_size_mode(r_total_chunks, mode));
|
||||
printf(" Device unallocated:\t\t%*s\n", width,
|
||||
- pretty_size_mode(total_disk - total_chunks, mode));
|
||||
+ pretty_size_mode(r_total_unused, mode));
|
||||
printf(" Used:\t\t\t%*s\n", width,
|
||||
- pretty_size_mode(total_used, mode));
|
||||
- printf(" Free (Estimated):\t\t%*s\t(",
|
||||
+ pretty_size_mode(r_total_used, mode));
|
||||
+ printf(" Free (estimated):\t\t%*s\t(",
|
||||
width,
|
||||
- pretty_size_mode((u64)(K * total_disk - total_used), mode));
|
||||
- printf("Max: %s, ",
|
||||
- pretty_size_mode(total_disk - total_chunks + total_free, mode));
|
||||
- printf("min: %s)\n",
|
||||
- pretty_size_mode((total_disk-total_chunks) / 2 + total_free, mode));
|
||||
- printf(" Data to device ratio:\t%*.0f %%\n",
|
||||
- width - 2, K * 100);
|
||||
+ pretty_size_mode(free_estimated, mode));
|
||||
+ printf("min: %s)\n", pretty_size_mode(free_min, mode));
|
||||
+ printf(" Data ratio:\t\t\t%*.2f\n",
|
||||
+ width, data_ratio);
|
||||
+ printf(" Metadata ratio:\t\t%*.2f\n",
|
||||
+ width, metadata_ratio);
|
||||
printf(" Global reserve:\t\t%*s\t(used: %s)\n", width,
|
||||
- pretty_size_mode(global_reserve, mode),
|
||||
- pretty_size_mode(global_reserve_used, mode));
|
||||
+ pretty_size_mode(l_global_reserve, mode),
|
||||
+ pretty_size_mode(l_global_reserve_used, mode));
|
||||
|
||||
exit:
|
||||
|
||||
--
|
||||
2.1.1
|
||||
|
@ -1,21 +1,21 @@
|
||||
From a1764abe279f04a664d2745d6d2ce49db722bce3 Mon Sep 17 00:00:00 2001
|
||||
From b6789cae1b21f0a8ceec5e60142bfac8a80c1278 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Mon, 28 Apr 2014 18:13:16 +0200
|
||||
Subject: [PATCH 40/42] btrfs-progs: replace df_pretty_sizes with
|
||||
Subject: [PATCH 17/42] btrfs-progs: replace df_pretty_sizes with
|
||||
pretty_size_mode
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
cmds-device.c | 8 +++----
|
||||
cmds-fi-disk_usage.c | 63 ++++++++++++++++++++++------------------------------
|
||||
cmds-fi-disk_usage.c | 68 ++++++++++++++++++++--------------------------------
|
||||
cmds-fi-disk_usage.h | 3 ---
|
||||
3 files changed, 30 insertions(+), 44 deletions(-)
|
||||
3 files changed, 30 insertions(+), 49 deletions(-)
|
||||
|
||||
diff --git a/cmds-device.c b/cmds-device.c
|
||||
index bf5898f6da68..eb6b79ca5127 100644
|
||||
index 9ab60bcafedc..e14eaf61296b 100644
|
||||
--- a/cmds-device.c
|
||||
+++ b/cmds-device.c
|
||||
@@ -471,19 +471,19 @@ exit:
|
||||
@@ -504,19 +504,19 @@ exit:
|
||||
int cmd_device_usage(int argc, char **argv)
|
||||
{
|
||||
|
||||
@ -38,7 +38,7 @@ index bf5898f6da68..eb6b79ca5127 100644
|
||||
break;
|
||||
default:
|
||||
usage(cmd_device_usage_usage);
|
||||
@@ -506,7 +506,7 @@ int cmd_device_usage(int argc, char **argv)
|
||||
@@ -539,7 +539,7 @@ int cmd_device_usage(int argc, char **argv)
|
||||
return 12;
|
||||
}
|
||||
|
||||
@ -48,28 +48,33 @@ index bf5898f6da68..eb6b79ca5127 100644
|
||||
|
||||
if (r)
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
index 3be0e6173eec..579230a79d85 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -32,17 +32,6 @@
|
||||
@@ -32,22 +32,6 @@
|
||||
#include "version.h"
|
||||
|
||||
/*
|
||||
- * Pretty print the size
|
||||
- * PAY ATTENTION: it return a statically buffer
|
||||
- */
|
||||
-char *df_pretty_sizes(u64 size, int mode)
|
||||
-{
|
||||
- static char buf[30];
|
||||
-
|
||||
- if (mode & DF_HUMAN_UNIT)
|
||||
- return pretty_size_mode(size, UNITS_HUMAN);
|
||||
- (void)pretty_size_snprintf(size, buf, sizeof(buf), UNITS_DEFAULT);
|
||||
- else
|
||||
- return pretty_size_mode(size, UNITS_RAW);
|
||||
- sprintf(buf, "%llu", size);
|
||||
-
|
||||
- return buf;
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
* Add the chunk info to the chunk_info list
|
||||
*/
|
||||
static int add_info_to_list(struct chunk_info **info_ptr,
|
||||
@@ -389,7 +378,7 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
@@ -394,7 +378,7 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
|
||||
K = ((double)total_used + (double)total_free) / (double)total_chunks;
|
||||
|
||||
@ -78,7 +83,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
width = 10;
|
||||
else
|
||||
width = 18;
|
||||
@@ -397,22 +386,22 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
@@ -402,22 +386,22 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
printf("Overall:\n");
|
||||
|
||||
printf(" Device size:\t\t%*s\n", width,
|
||||
@ -109,7 +114,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
|
||||
exit:
|
||||
|
||||
@@ -612,7 +601,7 @@ static void _cmd_filesystem_usage_tabular(int mode,
|
||||
@@ -617,7 +601,7 @@ static void _cmd_filesystem_usage_tabular(int mode,
|
||||
|
||||
if (size)
|
||||
table_printf(matrix, col, i+3,
|
||||
@ -118,7 +123,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
else
|
||||
table_printf(matrix, col, i+3, ">-");
|
||||
|
||||
@@ -624,7 +613,7 @@ static void _cmd_filesystem_usage_tabular(int mode,
|
||||
@@ -629,7 +613,7 @@ static void _cmd_filesystem_usage_tabular(int mode,
|
||||
- total_allocated;
|
||||
|
||||
table_printf(matrix, sargs->total_spaces + 1, i + 3,
|
||||
@ -127,7 +132,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
total_unused += unused;
|
||||
|
||||
}
|
||||
@@ -636,15 +625,15 @@ static void _cmd_filesystem_usage_tabular(int mode,
|
||||
@@ -641,15 +625,15 @@ static void _cmd_filesystem_usage_tabular(int mode,
|
||||
table_printf(matrix, 0, device_info_count + 4, "<Total");
|
||||
for (i = 0; i < sargs->total_spaces; i++)
|
||||
table_printf(matrix, 1 + i, device_info_count + 4, ">%s",
|
||||
@ -146,7 +151,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
|
||||
table_dump(matrix);
|
||||
table_free(matrix);
|
||||
@@ -670,7 +659,7 @@ static void print_unused(struct chunk_info *info_ptr,
|
||||
@@ -675,7 +659,7 @@ static void print_unused(struct chunk_info *info_ptr,
|
||||
|
||||
printf(" %s\t%10s\n",
|
||||
device_info_ptr[i].path,
|
||||
@ -155,7 +160,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,7 +693,7 @@ static void print_chunk_device(u64 chunk_type,
|
||||
@@ -709,7 +693,7 @@ static void print_chunk_device(u64 chunk_type,
|
||||
if (total > 0)
|
||||
printf(" %s\t%10s\n",
|
||||
device_info_ptr[i].path,
|
||||
@ -164,7 +169,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,10 +721,10 @@ static void _cmd_filesystem_usage_linear(int mode,
|
||||
@@ -737,10 +721,10 @@ static void _cmd_filesystem_usage_linear(int mode,
|
||||
printf("%s,%s: Size:%s, ",
|
||||
description,
|
||||
r_mode,
|
||||
@ -177,7 +182,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
print_chunk_device(flags, info_ptr, info_count,
|
||||
device_info_ptr, device_info_count, mode);
|
||||
printf("\n");
|
||||
@@ -787,7 +776,7 @@ const char * const cmd_filesystem_usage_usage[] = {
|
||||
@@ -792,7 +776,7 @@ const char * const cmd_filesystem_usage_usage[] = {
|
||||
|
||||
int cmd_filesystem_usage(int argc, char **argv)
|
||||
{
|
||||
@ -186,7 +191,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
int i, more_than_one = 0;
|
||||
int tabular = 0;
|
||||
|
||||
@@ -800,7 +789,7 @@ int cmd_filesystem_usage(int argc, char **argv)
|
||||
@@ -805,7 +789,7 @@ int cmd_filesystem_usage(int argc, char **argv)
|
||||
|
||||
switch (c) {
|
||||
case 'b':
|
||||
@ -195,7 +200,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
break;
|
||||
case 't':
|
||||
tabular = 1;
|
||||
@@ -837,12 +826,12 @@ int cmd_filesystem_usage(int argc, char **argv)
|
||||
@@ -842,12 +826,12 @@ int cmd_filesystem_usage(int argc, char **argv)
|
||||
goto cleanup;
|
||||
|
||||
ret = print_filesystem_usage_overall(fd, chunkinfo, chunkcount,
|
||||
@ -210,7 +215,7 @@ index 1e412c0b0e69..d1b8bbddc4d5 100644
|
||||
cleanup:
|
||||
close_file_or_dir(fd, dirstream);
|
||||
free(chunkinfo);
|
||||
@@ -881,22 +870,22 @@ void print_device_chunks(int fd, struct device_info *devinfo,
|
||||
@@ -886,22 +870,22 @@ void print_device_chunks(int fd, struct device_info *devinfo,
|
||||
description,
|
||||
r_mode,
|
||||
(int)(20 - strlen(description) - strlen(r_mode)), "",
|
||||
@ -259,5 +264,5 @@ index 0779defc71db..8a0c60f011e4 100644
|
||||
struct chunk_info *chunks_info_ptr,
|
||||
int chunks_info_count, int mode);
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 2c574dd5564fbe11a9e6e9c707fa907a7418c687 Mon Sep 17 00:00:00 2001
|
||||
From 3844fa84722d395a584ed8b331e89dc55361dd90 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Mon, 28 Apr 2014 18:55:05 +0200
|
||||
Subject: [PATCH 41/42] btrfs-progs: clean up return codes and paths
|
||||
Subject: [PATCH 18/42] btrfs-progs: clean up return codes and paths
|
||||
|
||||
Use the common patterns with one return statement at the end, pass down error
|
||||
|
||||
@ -12,10 +12,10 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
2 files changed, 34 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/cmds-device.c b/cmds-device.c
|
||||
index eb6b79ca5127..6dd5b05c7651 100644
|
||||
index e14eaf61296b..a728f2102f5c 100644
|
||||
--- a/cmds-device.c
|
||||
+++ b/cmds-device.c
|
||||
@@ -448,10 +448,8 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
@@ -481,10 +481,8 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
|
||||
ret = load_chunk_and_device_info(fd, &chunkinfo, &chunkcount, &devinfo,
|
||||
&devcount);
|
||||
@ -28,7 +28,7 @@ index eb6b79ca5127..6dd5b05c7651 100644
|
||||
|
||||
for (i = 0; i < devcount; i++) {
|
||||
printf("%s, ID: %llu\n", devinfo[i].path, devinfo[i].devid);
|
||||
@@ -461,7 +459,7 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
@@ -494,7 +492,7 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ index eb6b79ca5127..6dd5b05c7651 100644
|
||||
free(devinfo);
|
||||
free(chunkinfo);
|
||||
|
||||
@@ -472,6 +470,7 @@ int cmd_device_usage(int argc, char **argv)
|
||||
@@ -505,6 +503,7 @@ int cmd_device_usage(int argc, char **argv)
|
||||
{
|
||||
|
||||
int mode = UNITS_HUMAN;
|
||||
@ -45,7 +45,7 @@ index eb6b79ca5127..6dd5b05c7651 100644
|
||||
int i, more_than_one = 0;
|
||||
|
||||
optind = 1;
|
||||
@@ -494,28 +493,28 @@ int cmd_device_usage(int argc, char **argv)
|
||||
@@ -527,28 +526,28 @@ int cmd_device_usage(int argc, char **argv)
|
||||
usage(cmd_device_usage_usage);
|
||||
|
||||
for (i = optind; i < argc ; i++) {
|
||||
@ -84,7 +84,7 @@ index eb6b79ca5127..6dd5b05c7651 100644
|
||||
|
||||
const struct cmd_group device_cmd_group = {
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index d1b8bbddc4d5..7c93247e4f54 100644
|
||||
index 579230a79d85..e088956f9409 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -68,7 +68,7 @@ static int add_info_to_list(struct chunk_info **info_ptr,
|
||||
@ -229,5 +229,5 @@ index d1b8bbddc4d5..7c93247e4f54 100644
|
||||
|
||||
void print_device_chunks(int fd, struct device_info *devinfo,
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 552e2741a3b0ce344c73b3e1d80d385605d49e75 Mon Sep 17 00:00:00 2001
|
||||
From c440e750f10ec3a57e7fe204c5a9809c59590126 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Tue, 29 Apr 2014 17:32:22 +0200
|
||||
Subject: [PATCH 42/42] btrfs-progs: move global reserve to overall summary
|
||||
Subject: [PATCH 19/42] btrfs-progs: move global reserve to overall summary
|
||||
|
||||
It looks confusing among the chunks, it is not in fact a chunk type.
|
||||
|
||||
@ -22,7 +22,7 @@ Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
1 file changed, 20 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
||||
index 7c93247e4f54..0caba159b974 100644
|
||||
index e088956f9409..2c3c0a3ed51e 100644
|
||||
--- a/cmds-fi-disk_usage.c
|
||||
+++ b/cmds-fi-disk_usage.c
|
||||
@@ -319,6 +319,8 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo,
|
||||
@ -75,7 +75,7 @@ index 7c93247e4f54..0caba159b974 100644
|
||||
+ if (flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
||||
+ continue;
|
||||
+
|
||||
description = group_type_str(flags);
|
||||
description = btrfs_group_type_str(flags);
|
||||
|
||||
table_printf(matrix, 1+i, 0, "<%s", description);
|
||||
@@ -715,8 +730,11 @@ static void _cmd_filesystem_usage_linear(int mode,
|
||||
@ -88,9 +88,9 @@ index 7c93247e4f54..0caba159b974 100644
|
||||
+ if (flags & BTRFS_SPACE_INFO_GLOBAL_RSV)
|
||||
+ continue;
|
||||
+
|
||||
description= group_type_str(flags);
|
||||
r_mode = group_profile_str(flags);
|
||||
description = btrfs_group_type_str(flags);
|
||||
r_mode = btrfs_group_profile_str(flags);
|
||||
|
||||
--
|
||||
1.9.0
|
||||
2.1.1
|
||||
|
||||
|
39
0042-btrfs-progs-fix-linking-with-libbtrfs.patch
Normal file
39
0042-btrfs-progs-fix-linking-with-libbtrfs.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From b64e66feed24dd9fc008e96f0d5371b0bd0eb019 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Thu, 30 Oct 2014 18:33:41 +0100
|
||||
Subject: [PATCH 42/42] btrfs-progs: fix linking with libbtrfs
|
||||
|
||||
Reported at https://github.com/openSUSE/snapper/issues/128
|
||||
|
||||
Commit cdb9e22e292275237c added another rbtree file that defines
|
||||
functions that libbtrfs uses.
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 7f76447e3c55..7368502b5416 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -10,14 +10,14 @@ objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
|
||||
root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
|
||||
extent-cache.o extent_io.o volumes.o utils.o repair.o \
|
||||
qgroup.o raid6.o free-space-cache.o list_sort.o props.o \
|
||||
- ulist.o qgroup-verify.o backref.o rbtree-utils.o string-table.o
|
||||
+ ulist.o qgroup-verify.o backref.o string-table.o
|
||||
cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
|
||||
cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
|
||||
cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
|
||||
cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \
|
||||
cmds-property.o cmds-fi-disk_usage.o
|
||||
libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \
|
||||
- uuid-tree.o utils-lib.o
|
||||
+ uuid-tree.o utils-lib.o rbtree-utils.o
|
||||
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
|
||||
--
|
||||
2.1.1
|
||||
|
@ -0,0 +1,99 @@
|
||||
From cafacda441120976105d01c07286e843cb7cbb94 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Mon, 3 Nov 2014 23:50:50 +0100
|
||||
Subject: [PATCH] btrfs-progs: libbtrfs, make exported headers compatible with
|
||||
C++
|
||||
|
||||
Add externs and don't use a reserved keyword.
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
rbtree-utils.h | 8 ++++++++
|
||||
rbtree.h | 10 +++++++++-
|
||||
rbtree_augmented.h | 8 ++++++++
|
||||
3 files changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rbtree-utils.h b/rbtree-utils.h
|
||||
index 7298c72eba3d..718581ff105c 100644
|
||||
--- a/rbtree-utils.h
|
||||
+++ b/rbtree-utils.h
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
#include "rbtree.h"
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
/* The common insert/search/free functions */
|
||||
typedef int (*rb_compare_nodes)(struct rb_node *node1, struct rb_node *node2);
|
||||
typedef int (*rb_compare_keys)(struct rb_node *node, void *key);
|
||||
@@ -42,4 +46,8 @@ static void free_##name##_tree(struct rb_root *root) \
|
||||
rb_free_nodes(root, free_func); \
|
||||
}
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
diff --git a/rbtree.h b/rbtree.h
|
||||
index 03c06d8ec16a..0d4f2bfd5a5e 100644
|
||||
--- a/rbtree.h
|
||||
+++ b/rbtree.h
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <btrfs/kerncompat.h>
|
||||
#endif /* BTRFS_FLAT_INCLUDES */
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
struct rb_node {
|
||||
unsigned long __rb_parent_color;
|
||||
struct rb_node *rb_right;
|
||||
@@ -75,7 +79,7 @@ extern struct rb_node *rb_first_postorder(const struct rb_root *);
|
||||
extern struct rb_node *rb_next_postorder(const struct rb_node *);
|
||||
|
||||
/* Fast replacement of a single node without remove/rebalance/add/rebalance */
|
||||
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
|
||||
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new_node,
|
||||
struct rb_root *root);
|
||||
|
||||
static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
|
||||
@@ -107,4 +111,8 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
|
||||
typeof(*pos), field); 1; }); \
|
||||
pos = n)
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#endif /* _LINUX_RBTREE_H */
|
||||
diff --git a/rbtree_augmented.h b/rbtree_augmented.h
|
||||
index 079eb978dc4d..cbc963981667 100644
|
||||
--- a/rbtree_augmented.h
|
||||
+++ b/rbtree_augmented.h
|
||||
@@ -26,6 +26,10 @@
|
||||
|
||||
#include "rbtree.h"
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Please note - only struct rb_augment_callbacks and the prototypes for
|
||||
* rb_insert_augmented() and rb_erase_augmented() are intended to be public.
|
||||
@@ -228,4 +232,8 @@ rb_erase_augmented(struct rb_node *node, struct rb_root *root,
|
||||
__rb_erase_color(rebalance, root, augment->rotate);
|
||||
}
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#endif /* _LINUX_RBTREE_AUGMENTED_H */
|
||||
--
|
||||
2.1.1
|
||||
|
@ -1,106 +0,0 @@
|
||||
From f160d979c4f8d46a9d0a52394240d51b78237d89 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Tue, 31 Jan 2012 14:40:22 +0100
|
||||
Subject: [PATCH 164/170] btrfs-progs: convert: set label or copy from origin
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
btrfs-convert.c | 47 ++++++++++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 38 insertions(+), 9 deletions(-)
|
||||
|
||||
Index: btrfs-progs-v3.16/btrfs-convert.c
|
||||
===================================================================
|
||||
--- btrfs-progs-v3.16.orig/btrfs-convert.c
|
||||
+++ btrfs-progs-v3.16/btrfs-convert.c
|
||||
@@ -2196,8 +2196,8 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int do_convert(const char *devname, int datacsum, int packing,
|
||||
- int noxattr)
|
||||
+static int do_convert(const char *devname, int datacsum, int packing, int noxattr,
|
||||
+ int copylabel, const char *fslabel)
|
||||
{
|
||||
int i, ret;
|
||||
int fd = -1;
|
||||
@@ -2291,6 +2291,17 @@ static int do_convert(const char *devnam
|
||||
fprintf(stderr, "error during create_ext2_image %d\n", ret);
|
||||
goto fail;
|
||||
}
|
||||
+ memset(root->fs_info->super_copy->label, 0, BTRFS_LABEL_SIZE);
|
||||
+ if (copylabel == 1) {
|
||||
+ strncpy(root->fs_info->super_copy->label,
|
||||
+ ext2_fs->super->s_volume_name, 16);
|
||||
+ fprintf(stderr, "copy label '%s'\n",
|
||||
+ root->fs_info->super_copy->label);
|
||||
+ } else if (copylabel == -1) {
|
||||
+ strncpy(root->fs_info->super_copy->label, fslabel, BTRFS_LABEL_SIZE);
|
||||
+ fprintf(stderr, "set label to '%s'\n", fslabel);
|
||||
+ }
|
||||
+
|
||||
printf("cleaning up system chunk.\n");
|
||||
ret = cleanup_sys_chunk(root, ext2_root);
|
||||
if (ret) {
|
||||
@@ -2685,11 +2696,13 @@ fail:
|
||||
|
||||
static void print_usage(void)
|
||||
{
|
||||
- printf("usage: btrfs-convert [-d] [-i] [-n] [-r] device\n");
|
||||
- printf("\t-d disable data checksum\n");
|
||||
- printf("\t-i ignore xattrs and ACLs\n");
|
||||
- printf("\t-n disable packing of small files\n");
|
||||
- printf("\t-r roll back to ext2fs\n");
|
||||
+ printf("usage: btrfs-convert [-d] [-i] [-n] [-r] [-l label] [-L] device\n");
|
||||
+ printf("\t-d disable data checksum\n");
|
||||
+ printf("\t-i ignore xattrs and ACLs\n");
|
||||
+ printf("\t-n disable packing of small files\n");
|
||||
+ printf("\t-r roll back to ext2fs\n");
|
||||
+ printf("\t-l LABEL set filesystem label\n");
|
||||
+ printf("\t-L use label from converted fs\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -2699,10 +2712,13 @@ int main(int argc, char *argv[])
|
||||
int noxattr = 0;
|
||||
int datacsum = 1;
|
||||
int rollback = 0;
|
||||
+ int copylabel = 0;
|
||||
int usage_error = 0;
|
||||
char *file;
|
||||
+ char *fslabel = NULL;
|
||||
+
|
||||
while(1) {
|
||||
- int c = getopt(argc, argv, "dinr");
|
||||
+ int c = getopt(argc, argv, "dinrl:L");
|
||||
if (c < 0)
|
||||
break;
|
||||
switch(c) {
|
||||
@@ -2718,6 +2734,19 @@ int main(int argc, char *argv[])
|
||||
case 'r':
|
||||
rollback = 1;
|
||||
break;
|
||||
+ case 'l':
|
||||
+ copylabel = -1;
|
||||
+ fslabel = strdup(optarg);
|
||||
+ if (strlen(fslabel) > BTRFS_LABEL_SIZE) {
|
||||
+ fprintf(stderr,
|
||||
+ "warning: label too long, trimmed to %d bytes\n",
|
||||
+ BTRFS_LABEL_SIZE);
|
||||
+ fslabel[BTRFS_LABEL_SIZE]=0;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 'L':
|
||||
+ copylabel = 1;
|
||||
+ break;
|
||||
default:
|
||||
print_usage();
|
||||
return 1;
|
||||
@@ -2755,7 +2784,7 @@ int main(int argc, char *argv[])
|
||||
if (rollback) {
|
||||
ret = do_rollback(file);
|
||||
} else {
|
||||
- ret = do_convert(file, datacsum, packing, noxattr);
|
||||
+ ret = do_convert(file, datacsum, packing, noxattr, copylabel, fslabel);
|
||||
}
|
||||
if (ret)
|
||||
return 1;
|
@ -1,182 +0,0 @@
|
||||
From d4a4b24f0466b6559d54da3864538afb07188836 Mon Sep 17 00:00:00 2001
|
||||
From: David Sterba <dsterba@suse.cz>
|
||||
Date: Wed, 28 May 2014 11:25:24 +0200
|
||||
Subject: [PATCH] btrfs-progs: make free space checker work on non-4k
|
||||
sectorsize filesystems
|
||||
|
||||
The value of sector for space cache was hardcoded to 4k, and used to
|
||||
calculate bitmap sizes. In kernel, the BITS_PER_BITMAP is derived from
|
||||
PAGE_CACHE_SIZE which is not available for userspace, that can also deal
|
||||
with filesystem of varying sectorsize.
|
||||
|
||||
Signed-off-by: David Sterba <dsterba@suse.cz>
|
||||
---
|
||||
free-space-cache.c | 39 ++++++++++++++++++++++++---------------
|
||||
free-space-cache.h | 1 +
|
||||
2 files changed, 25 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/free-space-cache.c b/free-space-cache.c
|
||||
index bddde2403723..b705f1b8208e 100644
|
||||
--- a/free-space-cache.c
|
||||
+++ b/free-space-cache.c
|
||||
@@ -25,8 +25,12 @@
|
||||
#include "crc32c.h"
|
||||
#include "bitops.h"
|
||||
|
||||
-#define CACHE_SECTORSIZE 4096
|
||||
-#define BITS_PER_BITMAP (CACHE_SECTORSIZE * 8)
|
||||
+/*
|
||||
+ * Kernel always uses PAGE_CACHE_SIZE for sectorsize, but we don't have
|
||||
+ * anything like that in userspace and have to get the value from the
|
||||
+ * filesystem
|
||||
+ */
|
||||
+#define BITS_PER_BITMAP(sectorsize) ((sectorsize) * 8)
|
||||
#define MAX_CACHE_BYTES_PER_GIG (32 * 1024)
|
||||
|
||||
static int link_free_space(struct btrfs_free_space_ctl *ctl,
|
||||
@@ -48,7 +52,7 @@ static int io_ctl_init(struct io_ctl *io_ctl, u64 size, u64 ino,
|
||||
struct btrfs_root *root)
|
||||
{
|
||||
memset(io_ctl, 0, sizeof(struct io_ctl));
|
||||
- io_ctl->num_pages = (size + CACHE_SECTORSIZE - 1) / CACHE_SECTORSIZE;
|
||||
+ io_ctl->num_pages = (size + root->sectorsize - 1) / root->sectorsize;
|
||||
io_ctl->buffer = kzalloc(size, GFP_NOFS);
|
||||
if (!io_ctl->buffer)
|
||||
return -ENOMEM;
|
||||
@@ -75,11 +79,11 @@ static void io_ctl_unmap_page(struct io_ctl *io_ctl)
|
||||
static void io_ctl_map_page(struct io_ctl *io_ctl, int clear)
|
||||
{
|
||||
BUG_ON(io_ctl->index >= io_ctl->num_pages);
|
||||
- io_ctl->cur = io_ctl->buffer + (io_ctl->index++ * CACHE_SECTORSIZE);
|
||||
+ io_ctl->cur = io_ctl->buffer + (io_ctl->index++ * io_ctl->root->sectorsize);
|
||||
io_ctl->orig = io_ctl->cur;
|
||||
- io_ctl->size = CACHE_SECTORSIZE;
|
||||
+ io_ctl->size = io_ctl->root->sectorsize;
|
||||
if (clear)
|
||||
- memset(io_ctl->cur, 0, CACHE_SECTORSIZE);
|
||||
+ memset(io_ctl->cur, 0, io_ctl->root->sectorsize);
|
||||
}
|
||||
|
||||
static void io_ctl_drop_pages(struct io_ctl *io_ctl)
|
||||
@@ -203,7 +207,7 @@ static int io_ctl_check_crc(struct io_ctl *io_ctl, int index)
|
||||
val = *tmp;
|
||||
|
||||
io_ctl_map_page(io_ctl, 0);
|
||||
- crc = crc32c(crc, io_ctl->orig + offset, CACHE_SECTORSIZE - offset);
|
||||
+ crc = crc32c(crc, io_ctl->orig + offset, io_ctl->root->sectorsize - offset);
|
||||
btrfs_csum_final(crc, (char *)&crc);
|
||||
if (val != crc) {
|
||||
printk("btrfs: csum mismatch on free space cache\n");
|
||||
@@ -250,7 +254,7 @@ static int io_ctl_read_bitmap(struct io_ctl *io_ctl,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- memcpy(entry->bitmap, io_ctl->cur, CACHE_SECTORSIZE);
|
||||
+ memcpy(entry->bitmap, io_ctl->cur, io_ctl->root->sectorsize);
|
||||
io_ctl_unmap_page(io_ctl);
|
||||
|
||||
return 0;
|
||||
@@ -371,7 +375,7 @@ static int __load_free_space_cache(struct btrfs_root *root,
|
||||
} else {
|
||||
BUG_ON(!num_bitmaps);
|
||||
num_bitmaps--;
|
||||
- e->bitmap = kzalloc(CACHE_SECTORSIZE, GFP_NOFS);
|
||||
+ e->bitmap = kzalloc(ctl->sectorsize, GFP_NOFS);
|
||||
if (!e->bitmap) {
|
||||
free(e);
|
||||
goto free_cache;
|
||||
@@ -458,8 +462,9 @@ static inline u64 offset_to_bitmap(struct btrfs_free_space_ctl *ctl,
|
||||
{
|
||||
u64 bitmap_start;
|
||||
u64 bytes_per_bitmap;
|
||||
+ u32 sectorsize = ctl->sectorsize;
|
||||
|
||||
- bytes_per_bitmap = BITS_PER_BITMAP * ctl->unit;
|
||||
+ bytes_per_bitmap = BITS_PER_BITMAP(sectorsize) * ctl->unit;
|
||||
bitmap_start = offset - ctl->start;
|
||||
bitmap_start = bitmap_start / bytes_per_bitmap;
|
||||
bitmap_start *= bytes_per_bitmap;
|
||||
@@ -528,6 +533,7 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
|
||||
{
|
||||
struct rb_node *n = ctl->free_space_offset.rb_node;
|
||||
struct btrfs_free_space *entry, *prev = NULL;
|
||||
+ u32 sectorsize = ctl->sectorsize;
|
||||
|
||||
/* find entry that is closest to the 'offset' */
|
||||
while (1) {
|
||||
@@ -612,7 +618,7 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
|
||||
prev->offset + prev->bytes > offset)
|
||||
return prev;
|
||||
}
|
||||
- if (entry->offset + BITS_PER_BITMAP * ctl->unit > offset)
|
||||
+ if (entry->offset + BITS_PER_BITMAP(sectorsize) * ctl->unit > offset)
|
||||
return entry;
|
||||
} else if (entry->offset + entry->bytes > offset)
|
||||
return entry;
|
||||
@@ -622,7 +628,7 @@ tree_search_offset(struct btrfs_free_space_ctl *ctl,
|
||||
|
||||
while (1) {
|
||||
if (entry->bitmap) {
|
||||
- if (entry->offset + BITS_PER_BITMAP *
|
||||
+ if (entry->offset + BITS_PER_BITMAP(sectorsize) *
|
||||
ctl->unit > offset)
|
||||
break;
|
||||
} else {
|
||||
@@ -669,14 +675,15 @@ static int search_bitmap(struct btrfs_free_space_ctl *ctl,
|
||||
unsigned long found_bits = 0;
|
||||
unsigned long bits, i;
|
||||
unsigned long next_zero;
|
||||
+ u32 sectorsize = ctl->sectorsize;
|
||||
|
||||
i = offset_to_bit(bitmap_info->offset, ctl->unit,
|
||||
max_t(u64, *offset, bitmap_info->offset));
|
||||
bits = bytes_to_bits(*bytes, ctl->unit);
|
||||
|
||||
- for_each_set_bit_from(i, bitmap_info->bitmap, BITS_PER_BITMAP) {
|
||||
+ for_each_set_bit_from(i, bitmap_info->bitmap, BITS_PER_BITMAP(sectorsize)) {
|
||||
next_zero = find_next_zero_bit(bitmap_info->bitmap,
|
||||
- BITS_PER_BITMAP, i);
|
||||
+ BITS_PER_BITMAP(sectorsize), i);
|
||||
if ((next_zero - i) >= bits) {
|
||||
found_bits = next_zero - i;
|
||||
break;
|
||||
@@ -763,6 +770,7 @@ int btrfs_init_free_space_ctl(struct btrfs_block_group_cache *block_group,
|
||||
if (!ctl)
|
||||
return -ENOMEM;
|
||||
|
||||
+ ctl->sectorsize = sectorsize;
|
||||
ctl->unit = sectorsize;
|
||||
ctl->start = block_group->key.objectid;
|
||||
ctl->private = block_group;
|
||||
@@ -823,6 +831,7 @@ static void merge_space_tree(struct btrfs_free_space_ctl *ctl)
|
||||
struct btrfs_free_space *e, *prev = NULL;
|
||||
struct rb_node *n;
|
||||
int ret;
|
||||
+ u32 sectorsize = ctl->sectorsize;
|
||||
|
||||
again:
|
||||
prev = NULL;
|
||||
@@ -832,7 +841,7 @@ again:
|
||||
u64 offset = e->offset, bytes = ctl->unit;
|
||||
u64 end;
|
||||
|
||||
- end = e->offset + (u64)(BITS_PER_BITMAP * ctl->unit);
|
||||
+ end = e->offset + (u64)(BITS_PER_BITMAP(sectorsize) * ctl->unit);
|
||||
|
||||
unlink_free_space(ctl, e);
|
||||
while (!(search_bitmap(ctl, e, &offset, &bytes))) {
|
||||
diff --git a/free-space-cache.h b/free-space-cache.h
|
||||
index d28625867f76..ec213da66ccf 100644
|
||||
--- a/free-space-cache.h
|
||||
+++ b/free-space-cache.h
|
||||
@@ -36,6 +36,7 @@ struct btrfs_free_space_ctl {
|
||||
int unit;
|
||||
u64 start;
|
||||
void *private;
|
||||
+ u32 sectorsize;
|
||||
};
|
||||
|
||||
int load_free_space_cache(struct btrfs_fs_info *fs_info,
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c1f556c2d74bdefc58442ae09967a7cd0c3e54517dc0ba8757bce855e3495885
|
||||
size 389008
|
3
btrfs-progs-v3.17.tar.gz
Normal file
3
btrfs-progs-v3.17.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1cf3ed9ae5b0a03762f648fe71a2ddd4b1a7740480eeaeb8e8d9b57d6a7b1608
|
||||
size 477477
|
@ -1,3 +1,48 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 3 00:00:00 CET 2014 - dsterba@suse.cz
|
||||
|
||||
- version 3.17
|
||||
- check: --init-csum-tree acutally 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
|
||||
- Modified patches:
|
||||
* 0011-btrfs-progs-Enhance-the-command-btrfs-filesystem-df.patch
|
||||
* 0012-btrfs-progs-Add-helpers-functions-to-handle-the-prin.patch
|
||||
* 0013-btrfs-progs-Add-command-btrfs-filesystem-disk-usage.patch
|
||||
* 0014-btrfs-progs-Add-btrfs-device-disk-usage-command.patch
|
||||
* 0015-btrfs-progs-cleanup-dead-return-after-usage-for-fi-d.patch
|
||||
* 0016-btrfs-progs-Fix-memleak-in-get_raid56_used.patch
|
||||
* 0017-Btrfs-progs-fi-usage-free-memory-if-realloc-fails.patch
|
||||
* 0019-btrfs-progs-add-original-df-and-rename-disk_usage-to.patch
|
||||
* 0020-btrfs-progs-move-device-usage-to-cmds-device-more-cl.patch
|
||||
* 0021-btrfs-progs-check-if-we-can-t-get-info-from-ioctls-d.patch
|
||||
* 0022-btrfs-progs-zero-out-structures-before-calling-ioctl.patch
|
||||
* 0024-btrfs-progs-Print-more-info-about-device-sizes.patch
|
||||
* 0025-btrfs-progs-compare-unallocated-space-against-the-co.patch
|
||||
* 0026-btrfs-progs-add-section-of-overall-filesystem-usage.patch
|
||||
* 0027-btrfs-progs-cleanup-filesystem-device-usage-code.patch
|
||||
* 0029-btrfs-progs-replace-df_pretty_sizes-with-pretty_size.patch
|
||||
* 0030-btrfs-progs-clean-up-return-codes-and-paths.patch
|
||||
* 0031-btrfs-progs-move-global-reserve-to-overall-summary.patch
|
||||
- Added patches:
|
||||
* 0010-btrfs-progs-move-group-type-and-profile-pretty-print.patch
|
||||
* 0028-btrfs-progs-rework-calculations-of-fi-usage.patch
|
||||
* 0042-btrfs-progs-fix-linking-with-libbtrfs.patch
|
||||
* 0043-btrfs-progs-libbtrfs-make-exported-headers-compatibl.patch
|
||||
- Removed patches:
|
||||
* 0006-Btrfs-progs-fsck-clear-out-log-tree-in-repair-mode.patch
|
||||
* 0007-Btrfs-progs-fsck-avoid-pinning-same-block-several-ti.patch
|
||||
* 0008-Btrfs-progs-fsck-add-ability-to-check-reloc-roots.patch
|
||||
* 0018-btrfs-progs-read-global-reserve-size-from-space-info.patch
|
||||
* 0023-btrfs-progs-print-B-for-bytes.patch
|
||||
* 0028-btrfs-progs-extend-pretty-printers-with-unit-mode.patch
|
||||
* 0164-btrfs-progs-convert-set-label-or-copy-from-origin.patch
|
||||
* 0171-btrfs-progs-make-free-space-checker-work-on-non-4k-s.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Oct 4 00:00:03 CEST 2014 - dsterba@suse.cz
|
||||
|
||||
|
@ -16,9 +16,9 @@
|
||||
#
|
||||
|
||||
|
||||
%define tar_version v3.16.2
|
||||
%define tar_version v3.17
|
||||
Name: btrfsprogs
|
||||
Version: 3.16.2
|
||||
Version: 3.17
|
||||
Release: 0
|
||||
Summary: Utilities for the Btrfs filesystem
|
||||
License: GPL-2.0
|
||||
@ -30,9 +30,7 @@ Source: https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs
|
||||
Source1: boot-btrfs.sh
|
||||
Source4: setup-btrfs.sh
|
||||
|
||||
Patch6: 0006-Btrfs-progs-fsck-clear-out-log-tree-in-repair-mode.patch
|
||||
Patch7: 0007-Btrfs-progs-fsck-avoid-pinning-same-block-several-ti.patch
|
||||
Patch8: 0008-Btrfs-progs-fsck-add-ability-to-check-reloc-roots.patch
|
||||
Patch10: 0010-btrfs-progs-move-group-type-and-profile-pretty-print.patch
|
||||
Patch11: 0011-btrfs-progs-Enhance-the-command-btrfs-filesystem-df.patch
|
||||
Patch12: 0012-btrfs-progs-Add-helpers-functions-to-handle-the-prin.patch
|
||||
Patch13: 0013-btrfs-progs-Add-command-btrfs-filesystem-disk-usage.patch
|
||||
@ -40,27 +38,25 @@ Patch14: 0014-btrfs-progs-Add-btrfs-device-disk-usage-command.patch
|
||||
Patch15: 0015-btrfs-progs-cleanup-dead-return-after-usage-for-fi-d.patch
|
||||
Patch16: 0016-btrfs-progs-Fix-memleak-in-get_raid56_used.patch
|
||||
Patch17: 0017-Btrfs-progs-fi-usage-free-memory-if-realloc-fails.patch
|
||||
Patch18: 0018-btrfs-progs-read-global-reserve-size-from-space-info.patch
|
||||
Patch19: 0019-btrfs-progs-add-original-df-and-rename-disk_usage-to.patch
|
||||
Patch20: 0020-btrfs-progs-move-device-usage-to-cmds-device-more-cl.patch
|
||||
Patch21: 0021-btrfs-progs-check-if-we-can-t-get-info-from-ioctls-d.patch
|
||||
Patch22: 0022-btrfs-progs-zero-out-structures-before-calling-ioctl.patch
|
||||
Patch23: 0023-btrfs-progs-print-B-for-bytes.patch
|
||||
Patch24: 0024-btrfs-progs-Print-more-info-about-device-sizes.patch
|
||||
Patch25: 0025-btrfs-progs-compare-unallocated-space-against-the-co.patch
|
||||
Patch26: 0026-btrfs-progs-add-section-of-overall-filesystem-usage.patch
|
||||
Patch27: 0027-btrfs-progs-cleanup-filesystem-device-usage-code.patch
|
||||
Patch28: 0028-btrfs-progs-extend-pretty-printers-with-unit-mode.patch
|
||||
Patch28: 0028-btrfs-progs-rework-calculations-of-fi-usage.patch
|
||||
Patch29: 0029-btrfs-progs-replace-df_pretty_sizes-with-pretty_size.patch
|
||||
Patch30: 0030-btrfs-progs-clean-up-return-codes-and-paths.patch
|
||||
Patch31: 0031-btrfs-progs-move-global-reserve-to-overall-summary.patch
|
||||
Patch42: 0042-btrfs-progs-fix-linking-with-libbtrfs.patch
|
||||
Patch43: 0043-btrfs-progs-libbtrfs-make-exported-headers-compatibl.patch
|
||||
|
||||
Patch163: 0163-btrfs-progs-fsck-fix-segfault.patch
|
||||
Patch164: 0164-btrfs-progs-convert-set-label-or-copy-from-origin.patch
|
||||
Patch167: 0167-Btrfs-progs-make-find_and_setup_root-return-an-error.patch
|
||||
Patch168: 0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch
|
||||
Patch169: 0169-btrfs-progs-Check-metadata-mirrors-in-find-root.patch
|
||||
Patch171: 0171-btrfs-progs-make-free-space-checker-work-on-non-4k-s.patch
|
||||
|
||||
Patch1000: local-version-override.patch
|
||||
|
||||
@ -100,9 +96,7 @@ build applications to interface with btrfs.
|
||||
|
||||
%prep
|
||||
%setup -q -n btrfs-progs-%{tar_version}
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
@ -110,26 +104,24 @@ build applications to interface with btrfs.
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
%patch29 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch28 -p1
|
||||
%patch42 -p1
|
||||
%patch43 -p1
|
||||
%patch163 -p1
|
||||
%patch164 -p1
|
||||
%patch167 -p1
|
||||
%patch168 -p1
|
||||
%patch169 -p1
|
||||
%patch171 -p1
|
||||
%patch1000 -p1
|
||||
|
||||
%build
|
||||
|
@ -6,8 +6,8 @@ Index: btrfs-progs-v3.16.1/version.sh
|
||||
# Copyright 2008, Oracle
|
||||
# Released under the GNU GPLv2
|
||||
|
||||
-v="v3.16.2"
|
||||
+v="v3.16.2+20141003"
|
||||
-v="v3.17"
|
||||
+v="v3.17+20141103"
|
||||
|
||||
lib_major=0
|
||||
lib_minor=1
|
||||
|
Loading…
Reference in New Issue
Block a user