[0/7] Btrfs: fix total_bytes_pinned counter
diff mbox

Message ID cover.1496792333.git.osandov@fb.com
State New
Headers show

Commit Message

Omar Sandoval June 6, 2017, 11:45 p.m. UTC
From: Omar Sandoval <osandov@fb.com>

This series fixes several problems with the total_bytes_pinned counter.
Patches 1 and 2 are cleanups. Patches 3 and 4 are straightforward fixes.
Patch 5 is prep for patch 6. Patch 6 is the most complicated fix.
Patches 5 and 6 are ugly, I'd love any suggestions for a cleaner fix.
Finally, patch 7 adds a warning to catch similar issues in the future.

Tested with this xfstests diff, which exposes a bunch of the issues
without these fixes:


Omar Sandoval (7):
  Btrfs: make add_pinned_bytes() take an s64 num_bytes instead of u64
  Btrfs: make BUG_ON() in add_pinned_bytes() an ASSERT()
  Btrfs: update total_bytes_pinned when pinning down extents
  Btrfs: always account pinned bytes when dropping a tree block ref
  Btrfs: return old and new total ref mods when adding delayed refs
  Btrfs: rework delayed ref total_bytes_pinned accounting
  Btrfs: warn if total_bytes_pinned is non-zero on unmount

 fs/btrfs/delayed-ref.c |  29 +++++++---
 fs/btrfs/delayed-ref.h |   6 ++-
 fs/btrfs/extent-tree.c | 142 +++++++++++++++++++++++++++++--------------------
 3 files changed, 109 insertions(+), 68 deletions(-)

Comments

Holger Hoffstätte June 7, 2017, 3:48 p.m. UTC | #1
On 06/07/17 01:45, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> This series fixes several problems with the total_bytes_pinned counter.
> Patches 1 and 2 are cleanups. Patches 3 and 4 are straightforward fixes.
> Patch 5 is prep for patch 6. Patch 6 is the most complicated fix.
> Patches 5 and 6 are ugly, I'd love any suggestions for a cleaner fix.
> Finally, patch 7 adds a warning to catch similar issues in the future.

Since this didn't really change the code significantly from the previous
version (except for the addition of minor patches 2+7) have a

Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>

Thanks!
Holger
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Omar Sandoval June 7, 2017, 5:37 p.m. UTC | #2
On Wed, Jun 07, 2017 at 05:48:05PM +0200, Holger Hoffstätte wrote:
> On 06/07/17 01:45, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> > 
> > This series fixes several problems with the total_bytes_pinned counter.
> > Patches 1 and 2 are cleanups. Patches 3 and 4 are straightforward fixes.
> > Patch 5 is prep for patch 6. Patch 6 is the most complicated fix.
> > Patches 5 and 6 are ugly, I'd love any suggestions for a cleaner fix.
> > Finally, patch 7 adds a warning to catch similar issues in the future.
> 
> Since this didn't really change the code significantly from the previous
> version (except for the addition of minor patches 2+7) have a
> 
> Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>

Thanks for testing, Holger!
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/common/rc b/common/rc
index 743df427..95e7517b 100644
--- a/common/rc
+++ b/common/rc
@@ -484,6 +484,12 @@  _scratch_unmount()
 		_overlay_scratch_unmount
 		;;
 	btrfs)
+		if uuid="$(findmnt -n -o UUID "$SCRATCH_MNT")"; then
+			pushd "/sys/fs/btrfs/$uuid/allocation" >/dev/null
+			sync; sync; sync
+			grep -H -v '^0$' */total_bytes_pinned
+			popd >/dev/null
+		fi
 		$UMOUNT_PROG $SCRATCH_MNT
 		;;
 	*)