All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.cz>
Subject: [PATCH 01/14] btrfs-progs: read global reserve size from space infos
Date: Tue, 29 Apr 2014 17:57:01 +0200	[thread overview]
Message-ID: <b0d096eacc220f6d523706c1685099a37070925d.1398786620.git.dsterba@suse.cz> (raw)
In-Reply-To: <cover.1398786620.git.dsterba@suse.cz>

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/ctree.h b/ctree.h
index 8ac17619b9dc..5c43fc5f5f6e 100644
--- a/ctree.h
+++ b/ctree.h
@@ -862,6 +862,12 @@ struct btrfs_csum_item {
 /* used in struct btrfs_balance_args fields */
 #define BTRFS_AVAIL_ALLOC_BIT_SINGLE	(1ULL << 48)
 
+/*
+ * GLOBAL_RSV does not exist as a on-disk block group type and is used
+ * internally for exporting info about global block reserve from space infos
+ */
+#define BTRFS_SPACE_INFO_GLOBAL_RSV    (1ULL << 49)
+
 #define BTRFS_QGROUP_STATUS_OFF			0
 #define BTRFS_QGROUP_STATUS_ON			1
 #define BTRFS_QGROUP_STATUS_SCANNING		2
diff --git a/utils.c b/utils.c
index f2ab416c28b2..ca150404ea6f 100644
--- a/utils.c
+++ b/utils.c
@@ -2240,7 +2240,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:
@@ -2249,6 +2252,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


  reply	other threads:[~2014-04-29 15:57 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 15:56 [PATCH 00/14] Enhanced df - followup David Sterba
2014-04-29 15:57 ` David Sterba [this message]
2014-04-29 15:57 ` [PATCH 02/14] btrfs-progs: add original 'df' and rename 'disk_usage' to 'usage' David Sterba
2014-04-29 15:58 ` [PATCH 03/14] btrfs-progs: move device usage to cmds-device, more cleanups David Sterba
2014-04-29 15:58 ` [PATCH 04/14] btrfs-progs: check if we can't get info from ioctls due to permissions David Sterba
2014-04-29 16:01 ` [PATCH 05/14] btrfs-progs: zero out structures before calling ioctl David Sterba
2014-04-29 16:02 ` [PATCH 06/14] btrfs-progs: print B for bytes David Sterba
2014-04-29 16:02 ` [PATCH 07/14] btrfs-progs: Print more info about device sizes David Sterba
2014-04-29 19:23   ` Mike Fleetwood
2014-04-30 11:39     ` Goffredo Baroncelli
2014-04-30 12:11       ` David Sterba
2014-04-30 13:31         ` Frank Kingswood
2014-04-30 13:37           ` David Taylor
2014-04-30 17:38             ` Goffredo Baroncelli
2014-05-02 13:13               ` David Sterba
2014-05-02 13:15             ` David Sterba
2014-05-14 18:00           ` David Sterba
2014-04-30 11:52     ` David Sterba
2014-04-29 16:02 ` [PATCH 08/14] btrfs-progs: compare unallocated space against the correct value David Sterba
2014-04-29 16:02 ` [PATCH 09/14] btrfs-progs: add section of overall filesystem usage David Sterba
2014-04-29 16:02 ` [PATCH 10/14] btrfs-progs: cleanup filesystem/device usage code David Sterba
2014-04-29 16:02 ` [PATCH 11/14] btrfs-progs: extend pretty printers with unit mode David Sterba
2014-04-29 16:02 ` [PATCH 12/14] btrfs-progs: replace df_pretty_sizes with pretty_size_mode David Sterba
2014-04-29 16:02 ` [PATCH 13/14] btrfs-progs: clean up return codes and paths David Sterba
2014-04-29 16:03 ` [PATCH 14/14] btrfs-progs: move global reserve to overall summary David Sterba
2014-04-29 17:10 ` [PATCH 00/14] Enhanced df - followup Duncan
2014-04-29 17:17   ` Marc MERLIN
2014-04-29 17:33     ` Holger Hoffstätte
2014-04-30  0:42       ` Duncan
2014-04-30  8:15         ` Martin Steigerwald
2014-04-30 12:37           ` David Sterba
2014-04-30 13:01   ` David Sterba
2014-04-30 17:25     ` Duncan
2014-04-29 19:14 ` Mike Fleetwood
2014-04-30 12:22   ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b0d096eacc220f6d523706c1685099a37070925d.1398786620.git.dsterba@suse.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.