summaryrefslogtreecommitdiffstats
path: root/fs/ext4/move_extent.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-09-01 14:39:09 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-09-01 14:39:09 -0400
commitb7ea89ad0a6b855172158a999d3f5008403f4011 (patch)
treef5e4df616627e426bdebef94042c286fbdff0360 /fs/ext4/move_extent.c
parent523f431ccfffd3022e80e13befb9594f54b5607e (diff)
downloadop-kernel-dev-b7ea89ad0a6b855172158a999d3f5008403f4011.zip
op-kernel-dev-b7ea89ad0a6b855172158a999d3f5008403f4011.tar.gz
ext4: allow a NULL argument to ext4_ext_drop_refs()
Teach ext4_ext_drop_refs() to accept a NULL argument, much like kfree(). This allows us to drop a lot of checks to make sure path is non-NULL before calling ext4_ext_drop_refs(). Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/move_extent.c')
-rw-r--r--fs/ext4/move_extent.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 5e2465a..a34c076 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -113,10 +113,8 @@ mext_check_coverage(struct inode *inode, ext4_lblk_t from, ext4_lblk_t count,
}
ret = 1;
out:
- if (path) {
- ext4_ext_drop_refs(path);
- kfree(path);
- }
+ ext4_ext_drop_refs(path);
+ kfree(path);
return ret;
}
@@ -711,11 +709,9 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
o_start += cur_len;
d_start += cur_len;
repeat:
- if (path) {
- ext4_ext_drop_refs(path);
- kfree(path);
- path = NULL;
- }
+ ext4_ext_drop_refs(path);
+ kfree(path);
+ path = NULL;
}
*moved_len = o_start - orig_blk;
if (*moved_len > len)
@@ -727,10 +723,8 @@ out:
ext4_discard_preallocations(donor_inode);
}
- if (path) {
- ext4_ext_drop_refs(path);
- kfree(path);
- }
+ ext4_ext_drop_refs(path);
+ kfree(path);
ext4_double_up_write_data_sem(orig_inode, donor_inode);
ext4_inode_resume_unlocked_dio(orig_inode);
ext4_inode_resume_unlocked_dio(donor_inode);
OpenPOWER on IntegriCloud