linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Brandt <alunduil@alunduil.com>
To: linux-btrfs@vger.kernel.org
Subject: boot fsck of btrfs
Date: Mon, 3 May 2010 19:39:43 -0500	[thread overview]
Message-ID: <201005031939.47927.alunduil@alunduil.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1058 bytes --]

I found recently that when I enabled the boot time check of the btrfs 
filesystem that: one, there was no fsck.btrfs so it wasn't getting 
called; and two, the parameters that were being passed were not being 
handled appropriately by btrfsck.

I have created a hack that allows the second problem to be bypassed but 
wanted to get a little more guidance on how I could improve btrfsck as 
well as make it compliant with the fsck interface that /etc/init.d/fsck 
of various distributions expects.

What options make sense?  What options could we potentially have?  Is 
there an issue tracker somewhere that would outline this or where I could 
create issues to keep track of this?

Would a modular design of the userspace utilities be frowned upon even if 
they were statically linked?  Any suggestions or ideas would be welcome.

I've attached the patch I applied to btrfsck (which is by no means a 
solution).

Regards,

Alex Brandt
-- 
B.S. Physics & Computer Science
Minnesota State University Moorhead
http://www.alunduil.com

[-- Attachment #1.2: btrfsck_boot.patch --]
[-- Type: text/x-patch, Size: 2136 bytes --]

diff --git a/btrfsck.c b/btrfsck.c
index 73f1836..b3fabcc 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -1847,7 +1847,7 @@ static int all_backpointers_checked(struct extent_record *rec, int print_errs)
 					(unsigned long long)rec->start,
 					back->full_backref ?
 					"parent" : "root",
-					back->full_backref ? 
+					back->full_backref ?
 					(unsigned long long)dback->parent:
 					(unsigned long long)dback->root,
 					(unsigned long long)dback->owner,
@@ -1941,7 +1941,7 @@ static int check_owner_ref(struct btrfs_root *root,
 		btrfs_item_key_to_cpu(buf, &key, 0);
 	else
 		btrfs_node_key_to_cpu(buf, &key, 0);
-	
+
 	btrfs_init_path(&path);
 	path.lowest_level = level + 1;
 	ret = btrfs_search_slot(NULL, ref_root, &key, &path, 0, 0);
@@ -2047,7 +2047,7 @@ static struct data_backref *find_data_backref(struct extent_record *rec,
 		if (!node->is_data)
 			continue;
 		back = (struct data_backref *)node;
-		if (parent > 0) { 
+		if (parent > 0) {
 			if (!node->full_backref)
 				continue;
 			if (parent == back->parent)
@@ -2583,7 +2583,7 @@ static int run_next_block(struct btrfs_root *root,
 				ref = btrfs_item_ptr(buf, i,
 						struct btrfs_shared_data_ref);
 				add_data_backref(extent_cache,
-					key.objectid, key.offset, 0, 0, 0, 
+					key.objectid, key.offset, 0, 0, 0,
 					btrfs_shared_data_ref_count(buf, ref),
 					0);
 				continue;
@@ -2626,7 +2626,7 @@ static int run_next_block(struct btrfs_root *root,
 					     ptr, size, 0, 0, 1, 0);
 			BUG_ON(ret);
 
-			add_tree_backref(extent_cache, ptr, parent, 
+			add_tree_backref(extent_cache, ptr, parent,
 					 owner, 1);
 
 			if (level > 1) {
@@ -2815,13 +2815,18 @@ int main(int ac, char **av)
 	struct cache_tree root_cache;
 	struct btrfs_root *root;
 	int ret;
+    int i;
 
 	if (ac < 2)
 		print_usage();
 
 	radix_tree_init();
 	cache_tree_init(&root_cache);
-	root = open_ctree(av[1], 0, 0);
+
+    for (i = 1; !strncmp("-", av[i], 1) && i < ac; ++i);
+    if (i >= ac)
+        print_usage();
+	root = open_ctree(av[i], 0, 0);
 
 	if (root == NULL)
 		return 1;

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

                 reply	other threads:[~2010-05-04  0:39 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=201005031939.47927.alunduil@alunduil.com \
    --to=alunduil@alunduil.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).