if (IS_ERR(*path)) {
ret = PTR_ERR(*path);
*path = NULL;
- }
+ } else if ((*path)[ext_depth(inode)].p_ext == NULL)
+ ret = -ENODATA;
+
return ret;
}
if (new_flag) {
err = get_ext_path(orig_inode, eblock, &orig_path);
- if (orig_path == NULL)
+ if (err)
goto out;
if (ext4_ext_insert_extent(handle, orig_inode,
if (end_flag) {
err = get_ext_path(orig_inode,
le32_to_cpu(end_ext->ee_block) - 1, &orig_path);
- if (orig_path == NULL)
+ if (err)
goto out;
if (ext4_ext_insert_extent(handle, orig_inode,
/* Get the original extent for the block "orig_off" */
err = get_ext_path(orig_inode, orig_off, &orig_path);
- if (orig_path == NULL)
+ if (err)
goto out;
/* Get the donor extent for the head */
err = get_ext_path(donor_inode, donor_off, &donor_path);
- if (donor_path == NULL)
+ if (err)
goto out;
depth = ext_depth(orig_inode);
oext = orig_path[depth].p_ext;
if (orig_path)
ext4_ext_drop_refs(orig_path);
err = get_ext_path(orig_inode, orig_off, &orig_path);
- if (orig_path == NULL)
+ if (err)
goto out;
depth = ext_depth(orig_inode);
oext = orig_path[depth].p_ext;
if (donor_path)
ext4_ext_drop_refs(donor_path);
err = get_ext_path(donor_inode, donor_off, &donor_path);
- if (donor_path == NULL)
+ if (err)
goto out;
depth = ext_depth(donor_inode);
dext = donor_path[depth].p_ext;
donor_start, &len, *moved_len);
mext_double_up_read(orig_inode, donor_inode);
if (ret1)
- goto out2;
+ goto out;
file_end = (i_size_read(orig_inode) - 1) >> orig_inode->i_blkbits;
block_end = block_start + len - 1;
len -= block_end - file_end;
ret1 = get_ext_path(orig_inode, block_start, &orig_path);
- if (orig_path == NULL)
- goto out2;
+ if (ret1)
+ goto out;
/* Get path structure to check the hole */
ret1 = get_ext_path(orig_inode, block_start, &holecheck_path);
- if (holecheck_path == NULL)
+ if (ret1)
goto out;
depth = ext_depth(orig_inode);
ext_cur = holecheck_path[depth].p_ext;
- if (ext_cur == NULL) {
- ret1 = -EINVAL;
- goto out;
- }
/*
* Get proper extent whose ee_block is beyond block_start
if (holecheck_path)
ext4_ext_drop_refs(holecheck_path);
ret1 = get_ext_path(orig_inode, seq_start, &holecheck_path);
- if (holecheck_path == NULL)
+ if (ret1)
break;
depth = holecheck_path->p_depth;
if (orig_path)
ext4_ext_drop_refs(orig_path);
ret1 = get_ext_path(orig_inode, seq_start, &orig_path);
- if (orig_path == NULL)
+ if (ret1)
break;
ext_cur = holecheck_path[depth].p_ext;
ext4_ext_drop_refs(holecheck_path);
kfree(holecheck_path);
}
-out2:
+
ret2 = mext_inode_double_unlock(orig_inode, donor_inode);
if (ret1)