boot fsck of btrfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
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: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux