ref: 91d3934d13b81f5edd3811af364bd412ba1d880d
parent: 8c076831b6439c820fb206df07fc9721fe80165e
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sat Feb 13 12:25:25 EST 2016
ext4_extent: cosmetic fixes on error code handling. Do not detect flaws by seeing whether routines return non-zero value, instead this should be done by seeing whether return value is not being EOK.
--- a/src/ext4_extent.c
+++ b/src/ext4_extent.c
@@ -693,7 +693,7 @@
/* FIXME: currently we split at the point after the current extent. */
newblock = ext4_ext_new_meta_block(inode_ref, path,
newext, &ret, 0);
- if (ret)
+ if (ret != EOK)
goto cleanup;
/* For write access.*/
@@ -714,7 +714,7 @@
neh->entries_count = to_le16(to_le16(neh->entries_count) + m);
path[i].header->entries_count = to_le16(to_le16(path[i].header->entries_count) - m);
ret = ext4_ext_dirty(inode_ref, path + i);
- if (ret)
+ if (ret != EOK)
goto cleanup;
npath[npath_at].p_block = ext4_ext_pblock(ex);
@@ -747,7 +747,7 @@
neh->entries_count = to_le16(to_le16(neh->entries_count) + m);
path[i].header->entries_count = to_le16(to_le16(path[i].header->entries_count) - m);
ret = ext4_ext_dirty(inode_ref, path + i);
- if (ret)
+ if (ret != EOK)
goto cleanup;
}
@@ -780,7 +780,7 @@
*ins_right_leaf);
cleanup:
- if (ret) {
+ if (ret != EOK) {
if (newblock)
ext4_ext_free_blocks(inode_ref, newblock, 1, 0);
@@ -981,7 +981,7 @@
}
err = ext4_ext_correct_indexes(inode_ref, path);
- if (err)
+ if (err != EOK)
goto out;
err = ext4_ext_dirty(inode_ref, curp);
@@ -1099,11 +1099,11 @@
/* Do we need to grow the tree? */
if (i < 0) {
ret = ext4_ext_grow_indepth(inode_ref, 0);
- if (ret)
+ if (ret != EOK)
goto out;
ret = ext4_find_extent(inode_ref, to_le32(newext->first_block), ppath, 0);
- if (ret)
+ if (ret != EOK)
goto out;
path = *ppath;
@@ -1126,7 +1126,7 @@
ret = ext4_ext_split_node(inode_ref, path, i,
newext, npath,
&ins_right_leaf);
- if (ret)
+ if (ret != EOK)
goto out;
while (--level >= 0) {
@@ -1144,7 +1144,7 @@
}
out:
- if (ret) {
+ if (ret != EOK) {
if (path)
ext4_ext_drop_refs(inode_ref, path, 0);
@@ -1321,7 +1321,7 @@
int32_t i;
ret = ext4_find_extent(inode_ref, from, &path, 0);
- if (ret)
+ if (ret != EOK)
goto out;
if (!path[depth].extent) {
@@ -1401,7 +1401,7 @@
ret = read_extent_tree_block(inode_ref,
ext4_idx_pblock(path[i].index),
depth - i - 1, &bh, 0);
- if (ret)
+ if (ret != EOK)
goto out;
path[i].p_block =