diff options
author | Kazuya Mio <k-mio@sx.jp.nec.com> | 2009-11-24 10:28:48 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-11-24 10:28:48 -0500 |
commit | 446aaa6e7e993b38a6f21c6acfa68f3f1af3dbe3 (patch) | |
tree | dedc46c0d80a20061c0df463dcc6260aef394e2d /fs/ext4/move_extent.c | |
parent | 94d7c16cbbbd0e03841fcf272bcaf0620ad39618 (diff) |
ext4: initialize moved_len before calling ext4_move_extents()
The move_extent.moved_len is used to pass back the number of exchanged
blocks count to user space. Currently the caller must clear this
field; but we spend more code space checking for this requirement than
simply zeroing the field ourselves, so let's just make life easier for
everyone all around.
Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/move_extent.c')
-rw-r--r-- | fs/ext4/move_extent.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 3478889e00b3..445ecd7616a6 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -947,7 +947,6 @@ out2: | |||
947 | * @orig_start: logical start offset in block for orig | 947 | * @orig_start: logical start offset in block for orig |
948 | * @donor_start: logical start offset in block for donor | 948 | * @donor_start: logical start offset in block for donor |
949 | * @len: the number of blocks to be moved | 949 | * @len: the number of blocks to be moved |
950 | * @moved_len: moved block length | ||
951 | * | 950 | * |
952 | * Check the arguments of ext4_move_extents() whether the files can be | 951 | * Check the arguments of ext4_move_extents() whether the files can be |
953 | * exchanged with each other. | 952 | * exchanged with each other. |
@@ -955,8 +954,8 @@ out2: | |||
955 | */ | 954 | */ |
956 | static int | 955 | static int |
957 | mext_check_arguments(struct inode *orig_inode, | 956 | mext_check_arguments(struct inode *orig_inode, |
958 | struct inode *donor_inode, __u64 orig_start, | 957 | struct inode *donor_inode, __u64 orig_start, |
959 | __u64 donor_start, __u64 *len, __u64 moved_len) | 958 | __u64 donor_start, __u64 *len) |
960 | { | 959 | { |
961 | ext4_lblk_t orig_blocks, donor_blocks; | 960 | ext4_lblk_t orig_blocks, donor_blocks; |
962 | unsigned int blkbits = orig_inode->i_blkbits; | 961 | unsigned int blkbits = orig_inode->i_blkbits; |
@@ -1010,13 +1009,6 @@ mext_check_arguments(struct inode *orig_inode, | |||
1010 | return -EINVAL; | 1009 | return -EINVAL; |
1011 | } | 1010 | } |
1012 | 1011 | ||
1013 | if (moved_len) { | ||
1014 | ext4_debug("ext4 move extent: moved_len should be 0 " | ||
1015 | "[ino:orig %lu, donor %lu]\n", orig_inode->i_ino, | ||
1016 | donor_inode->i_ino); | ||
1017 | return -EINVAL; | ||
1018 | } | ||
1019 | |||
1020 | if ((orig_start > EXT_MAX_BLOCK) || | 1012 | if ((orig_start > EXT_MAX_BLOCK) || |
1021 | (donor_start > EXT_MAX_BLOCK) || | 1013 | (donor_start > EXT_MAX_BLOCK) || |
1022 | (*len > EXT_MAX_BLOCK) || | 1014 | (*len > EXT_MAX_BLOCK) || |
@@ -1226,7 +1218,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
1226 | double_down_write_data_sem(orig_inode, donor_inode); | 1218 | double_down_write_data_sem(orig_inode, donor_inode); |
1227 | /* Check the filesystem environment whether move_extent can be done */ | 1219 | /* Check the filesystem environment whether move_extent can be done */ |
1228 | ret1 = mext_check_arguments(orig_inode, donor_inode, orig_start, | 1220 | ret1 = mext_check_arguments(orig_inode, donor_inode, orig_start, |
1229 | donor_start, &len, *moved_len); | 1221 | donor_start, &len); |
1230 | if (ret1) | 1222 | if (ret1) |
1231 | goto out; | 1223 | goto out; |
1232 | 1224 | ||