linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* boot fsck of btrfs
@ 2010-05-04  0:39 Alex Brandt
  0 siblings, 0 replies; only message in thread
From: Alex Brandt @ 2010-05-04  0:39 UTC (permalink / raw)
  To: linux-btrfs


[-- 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 --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-04  0:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-04  0:39 boot fsck of btrfs Alex Brandt

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