summaryrefslogtreecommitdiff
path: root/quick-test.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-28 16:48:16 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit448999d84ddc2eaf36938176fb5091d2c2029e2f (patch)
tree4e90505605420f6d3467639d2899e93c893596dd /quick-test.c
parent4ef5a112c9d2fe9d6f03ac2ea3aa5b1af0f37254 (diff)
btrfs-progs: add crude error handling when transaction start fails
Currently transaction bugs out insided btrfs_start_transaction in case of error, we want to lift the error handling to the callers. This patch adds the BUG_ON anywhere it's been missing so far. This is not the best way of course. Transforming BUG_ON to a proper error handling highly depends on the caller and should be dealt with case by case. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'quick-test.c')
-rw-r--r--quick-test.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/quick-test.c b/quick-test.c
index f99ecc38..b1e7999d 100644
--- a/quick-test.c
+++ b/quick-test.c
@@ -56,6 +56,7 @@ int main(int ac, char **av) {
exit(1);
}
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
srand(55);
ins.type = BTRFS_STRING_ITEM_KEY;
for (i = 0; i < run_size; i++) {
@@ -72,6 +73,7 @@ int main(int ac, char **av) {
if (i == run_size - 5) {
btrfs_commit_transaction(trans, root);
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
}
}
btrfs_commit_transaction(trans, root);
@@ -114,6 +116,7 @@ int main(int ac, char **av) {
i = 0;
srand(55);
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
for (i = 0 ; i < run_size/4; i++) {
num = next_key(i, max_key);
ins.objectid = num;
@@ -138,6 +141,7 @@ int main(int ac, char **av) {
exit(1);
}
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
srand(128);
for (i = 0; i < run_size; i++) {
num = next_key(i, max_key);
@@ -175,6 +179,7 @@ int main(int ac, char **av) {
}
printf("starting big long delete run\n");
trans = btrfs_start_transaction(root, 1);
+ BUG_ON(IS_ERR(trans));
while(root->node && btrfs_header_nritems(root->node) > 0) {
struct extent_buffer *leaf;
int slot;