From: Stefan Behrens <sbehrens@giantdisaster.de>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v8 2/8] Btrfs: support printing UUID tree elements
Date: Thu, 15 Aug 2013 17:11:18 +0200 [thread overview]
Message-ID: <02fce9d487b6df1de4812e62e8708774afb1e121.1376575048.git.sbehrens@giantdisaster.de> (raw)
In-Reply-To: <cover.1376575048.git.sbehrens@giantdisaster.de>
In-Reply-To: <cover.1376575048.git.sbehrens@giantdisaster.de>
This commit adds support to print UUID tree elements to print-tree.c.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
---
fs/btrfs/print-tree.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index fe7bf4a..32022f3 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -155,6 +155,25 @@ static void print_extent_ref_v0(struct extent_buffer *eb, int slot)
}
#endif
+static void print_uuid_item(struct extent_buffer *l, unsigned long offset,
+ u32 item_size)
+{
+ if (!IS_ALIGNED(item_size, sizeof(u64))) {
+ pr_warn("btrfs: uuid item with illegal size %lu!\n",
+ (unsigned long)item_size);
+ return;
+ }
+ while (item_size) {
+ __le64 subvol_id;
+
+ read_extent_buffer(l, &subvol_id, offset, sizeof(subvol_id));
+ printk(KERN_INFO "\t\tsubvol_id %llu\n",
+ (unsigned long long)le64_to_cpu(subvol_id));
+ item_size -= sizeof(u64);
+ offset += sizeof(u64);
+ }
+}
+
void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
{
int i;
@@ -301,6 +320,11 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
case BTRFS_DEV_REPLACE_KEY:
printk(KERN_INFO "\t\tdev replace\n");
break;
+ case BTRFS_UUID_KEY_SUBVOL:
+ case BTRFS_UUID_KEY_RECEIVED_SUBVOL:
+ print_uuid_item(l, btrfs_item_ptr_offset(l, i),
+ btrfs_item_size_nr(l, i));
+ break;
};
}
}
--
1.8.3.4
next prev parent reply other threads:[~2013-08-15 15:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-15 15:11 [PATCH v8 0/8] Btrfs: introduce a tree for UUID to subvol ID mapping Stefan Behrens
2013-08-15 15:11 ` [PATCH v8 1/8] Btrfs: introduce a tree for items that map UUIDs to something Stefan Behrens
2013-08-15 15:11 ` Stefan Behrens [this message]
2013-08-15 15:11 ` [PATCH v8 3/8] Btrfs: create UUID tree if required Stefan Behrens
2013-08-15 15:11 ` [PATCH v8 4/8] Btrfs: maintain subvolume items in the UUID tree Stefan Behrens
2013-08-15 15:11 ` [PATCH v8 5/8] Btrfs: fill UUID tree initially Stefan Behrens
2013-08-15 15:11 ` [PATCH v8 6/8] Btrfs: introduce uuid-tree-gen field Stefan Behrens
2013-08-15 15:11 ` [PATCH v8 7/8] Btrfs: check UUID tree during mount if required Stefan Behrens
2013-08-15 15:11 ` [PATCH v8 8/8] Btrfs: add mount option to force UUID tree checking Stefan Behrens
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=02fce9d487b6df1de4812e62e8708774afb1e121.1376575048.git.sbehrens@giantdisaster.de \
--to=sbehrens@giantdisaster.de \
--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).