linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: linux-btrfs@vger.kernel.org
Cc: Josef Bacik <jbacik@fb.com>, Liu Bo <bo.li.liu@oracle.com>,
	kernel-team@fb.com
Subject: [PATCH 0/7] Btrfs: fix total_bytes_pinned counter
Date: Tue,  6 Jun 2017 16:45:25 -0700	[thread overview]
Message-ID: <cover.1496792333.git.osandov@fb.com> (raw)

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:

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
 		;;
 	*)

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(-)

-- 
2.13.0


             reply	other threads:[~2017-06-06 23:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 23:45 Omar Sandoval [this message]
2017-06-06 23:45 ` [PATCH 1/7] Btrfs: make add_pinned_bytes() take an s64 num_bytes instead of u64 Omar Sandoval
2017-06-12 13:39   ` David Sterba
2017-06-12 17:34   ` Liu Bo
2017-06-06 23:45 ` [PATCH 2/7] Btrfs: make BUG_ON() in add_pinned_bytes() an ASSERT() Omar Sandoval
2017-06-12 13:26   ` David Sterba
2017-06-21 17:31   ` David Sterba
2017-06-06 23:45 ` [PATCH 3/7] Btrfs: update total_bytes_pinned when pinning down extents Omar Sandoval
2017-06-12 17:37   ` Liu Bo
2017-06-06 23:45 ` [PATCH 4/7] Btrfs: always account pinned bytes when dropping a tree block ref Omar Sandoval
2017-06-07 20:20   ` Liu Bo
2017-06-06 23:45 ` [PATCH 5/7] Btrfs: return old and new total ref mods when adding delayed refs Omar Sandoval
2017-06-07 20:06   ` Liu Bo
2017-06-06 23:45 ` [PATCH 6/7] Btrfs: rework delayed ref total_bytes_pinned accounting Omar Sandoval
2017-06-07 20:18   ` Liu Bo
2017-06-09 23:38     ` Omar Sandoval
2017-06-06 23:45 ` [PATCH 7/7] Btrfs: warn if total_bytes_pinned is non-zero on unmount Omar Sandoval
2017-06-07 20:22   ` Liu Bo
2017-06-09 23:45     ` Omar Sandoval
2017-06-13 18:35   ` Jeff Mahoney
2017-06-21 17:40   ` David Sterba
2017-06-07 15:48 ` [PATCH 0/7] Btrfs: fix total_bytes_pinned counter Holger Hoffstätte
2017-06-07 17:37   ` Omar Sandoval

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=cover.1496792333.git.osandov@fb.com \
    --to=osandov@osandov.com \
    --cc=bo.li.liu@oracle.com \
    --cc=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    --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).