linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: fdmanana@kernel.org
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 06/17] btrfs: print available space across all block groups when dumping space info
Date: Wed, 26 Jul 2023 16:57:02 +0100	[thread overview]
Message-ID: <ec09a059f39fe8281bc46b96f1a3d86396f06015.1690383587.git.fdmanana@suse.com> (raw)
In-Reply-To: <cover.1690383587.git.fdmanana@suse.com>

From: Filipe Manana <fdmanana@suse.com>

When dumping a space info also sum the available space for all block
groups and then print it. This often useful for debugging -ENOSPC
related problems.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/space-info.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 54d78e839c01..de0044283e29 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -510,6 +510,7 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
 			   int dump_block_groups)
 {
 	struct btrfs_block_group *cache;
+	u64 total_avail = 0;
 	int index = 0;
 
 	spin_lock(&info->lock);
@@ -537,10 +538,13 @@ void btrfs_dump_space_info(struct btrfs_fs_info *fs_info,
 			   avail, cache->ro ? "[readonly]" : "");
 		spin_unlock(&cache->lock);
 		btrfs_dump_free_space(cache, bytes);
+		total_avail += avail;
 	}
 	if (++index < BTRFS_NR_RAID_TYPES)
 		goto again;
 	up_read(&info->groups_sem);
+
+	btrfs_info(fs_info, "%llu bytes available across all block groups", total_avail);
 }
 
 static inline u64 calc_reclaim_items_nr(const struct btrfs_fs_info *fs_info,
-- 
2.34.1


  parent reply	other threads:[~2023-07-26 15:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 15:56 [PATCH 00/17] btrfs: some misc stuff around space flushing and enospc handling fdmanana
2023-07-26 15:56 ` [PATCH 01/17] btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART fdmanana
2023-07-26 15:56 ` [PATCH 02/17] btrfs: update comment for btrfs_join_transaction_nostart() fdmanana
2023-07-26 15:56 ` [PATCH 03/17] btrfs: print target number of bytes when dumping free space fdmanana
2023-07-26 15:57 ` [PATCH 04/17] btrfs: print block group super and delalloc bytes when dumping space info fdmanana
2023-07-26 15:57 ` [PATCH 05/17] btrfs: print available space for a block group when dumping a " fdmanana
2023-07-26 15:57 ` fdmanana [this message]
2023-07-26 15:57 ` [PATCH 07/17] btrfs: don't steal space from global rsv after a transaction abort fdmanana
2023-07-26 15:57 ` [PATCH 08/17] btrfs: store the error that turned the fs into error state fdmanana
2023-07-26 15:57 ` [PATCH 09/17] btrfs: return real error when orphan cleanup fails due to a transaction abort fdmanana
2023-07-26 15:57 ` [PATCH 10/17] btrfs: fail priority metadata ticket with real fs error fdmanana
2023-07-26 15:57 ` [PATCH 11/17] btrfs: make btrfs_cleanup_fs_roots() static fdmanana
2023-07-26 15:57 ` [PATCH 12/17] btrfs: make find_free_dev_extent() static fdmanana
2023-07-26 15:57 ` [PATCH 13/17] btrfs: merge find_free_dev_extent() and find_free_dev_extent_start() fdmanana
2023-07-26 15:57 ` [PATCH 14/17] btrfs: avoid starting new transaction when flushing delayed items and refs fdmanana
2023-07-26 15:57 ` [PATCH 15/17] btrfs: avoid starting and committing empty transaction when flushing space fdmanana
2023-07-26 15:57 ` [PATCH 16/17] btrfs: avoid start and commit empty transaction when starting qgroup rescan fdmanana
2023-07-26 15:57 ` [PATCH 17/17] btrfs: avoid start and commit empty transaction when flushing qgroups fdmanana
2023-08-17 12:58 ` [PATCH 00/17] btrfs: some misc stuff around space flushing and enospc handling 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=ec09a059f39fe8281bc46b96f1a3d86396f06015.1690383587.git.fdmanana@suse.com \
    --to=fdmanana@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).