Commit aa5d6bed authored by Chris Mason's avatar Chris Mason Committed by David Woodhouse
Browse files

Btrfs: return code checking

parent af86d07e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line

CC=gcc
CFLAGS = -g -Wall
headers = radix-tree.h ctree.h disk-io.h kerncompat.h print-tree.h
objects = ctree.o disk-io.o radix-tree.o mkfs.o extent-tree.o print-tree.o

# if you don't have sparse installed, use ls instead
check=sparse
CHECKFLAGS=-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise \
		-Wcontext -Wcast-truncate -Wuninitialized -Wshadow -Wundef
check=sparse $(CHECKFLAGS)
#check=ls

.c.o:
+254 −226

File changed.

Preview size limit exceeded, changes collapsed.

+5 −0
Original line number Diff line number Diff line
@@ -125,6 +125,11 @@ int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
	ins->flags = 0;
	start_found = 0;
	ret = search_slot(root, ins, &path, 0);
	if (ret < 0) {
		release_path(root, &path);
		return ret;
	}

	while (1) {
		l = &path.nodes[0]->leaf;
		slot = path.slots[0];
+6 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ static int lookup_enoent(struct ctree_root *root, struct radix_tree_root *radix)
		return ret;
	ret = search_slot(root, &key, &path, 0);
	release_path(root, &path);
	if (ret == 0)
	if (ret <= 0)
		goto error;
	return 0;
error:
@@ -153,12 +153,17 @@ static int fill_radix(struct ctree_root *root, struct radix_tree_root *radix)
	int ret;
	int slot;
	int i;

	key.offset = 0;
	key.flags = 0;
	key.objectid = (unsigned long)-1;
	while(1) {
		init_path(&path);
		ret = search_slot(root, &key, &path, 0);
		if (ret < 0) {
			release_path(root, &path);
			return ret;
		}
		slot = path.slots[0];
		if (ret != 0) {
			if (slot == 0) {