public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@redhat.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs-progs: add orphan support to print-tree
Date: Fri, 25 Jul 2008 09:10:14 -0400	[thread overview]
Message-ID: <20080725131014.GG28414@unused.rdu.redhat.com> (raw)

Hello,

This adds orphan support to print-tree so when debug_tree hits an orphan item it
will print out "orphan item" under it so you know what it is.  Thanks,

Josef


diff -r e08f2f90e4f8 ctree.h
--- a/ctree.h	Thu Jul 24 13:52:04 2008 -0400
+++ b/ctree.h	Fri Jul 25 16:18:38 2008 -0400
@@ -54,6 +54,9 @@ struct btrfs_trans_handle;
 
 /* directory objectid inside the root tree */
 #define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
+
+/* oprhan objectid for tracking unlinked/truncated files */
+#define BTRFS_ORPHAN_OBJECTID -5ULL
 
 /*
  * All files have objectids higher than this.
@@ -564,6 +567,7 @@ struct btrfs_root {
 #define BTRFS_INODE_ITEM_KEY		1
 #define BTRFS_INODE_REF_KEY		2
 #define BTRFS_XATTR_ITEM_KEY		8
+#define BTRFS_ORPHAN_ITEM_KEY		9
 
 /* reserve 3-15 close to the inode for later flexibility */
 
diff -r e08f2f90e4f8 print-tree.c
--- a/print-tree.c	Thu Jul 24 13:52:04 2008 -0400
+++ b/print-tree.c	Fri Jul 25 16:18:38 2008 -0400
@@ -183,6 +183,9 @@ void btrfs_print_leaf(struct btrfs_root 
 			di = btrfs_item_ptr(l, i, struct btrfs_dir_item);
 			print_dir_item(l, item, di);
 			break;
+		case BTRFS_ORPHAN_ITEM_KEY:
+			printf("\t\torphan item\n");
+			break;
 		case BTRFS_ROOT_ITEM_KEY:
 			ri = btrfs_item_ptr(l, i, struct btrfs_root_item);
 			read_extent_buffer(l, &root_item, (unsigned long)ri, sizeof(root_item));

                 reply	other threads:[~2008-07-25 13:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080725131014.GG28414@unused.rdu.redhat.com \
    --to=jbacik@redhat.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