提交 aa5d6bed 编写于 作者: C Chris Mason 提交者: David Woodhouse

Btrfs: return code checking

Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 af86d07e
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:
......
此差异已折叠。
......@@ -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];
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册