aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeff.liu <jeff.liu@oracle.com>2012-10-27 08:06:39 -0400
committerJosef Bacik <jbacik@fusionio.com>2012-12-12 17:15:16 -0500
commit0253f40ef9a709a1af39ce38b1d998af090f8127 (patch)
tree87803116f56aad5771c94ab78e1c01649b9a4919
parent9afab8820bb8b55af669b199597d6716e04d1ba8 (diff)
Btrfs: Remove the invalid shrink size check up from btrfs_shrink_dev()
Remove an invalid size check up from btrfs_shrink_dev(). The new size should not larger than the device->total_bytes as it was already verified before coming to here(i.e. new_size < old_size). Remove invalid check up for btrfs_shrink_dev(). Signed-off-by: Jie Liu <jeff.liu@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/btrfs/volumes.c3
2 files changed, 1 insertions, 4 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 8fcf9a59c28d..14c0d2e0790c 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1409,7 +1409,7 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
1409 btrfs_commit_transaction(trans, root); 1409 btrfs_commit_transaction(trans, root);
1410 } else if (new_size < old_size) { 1410 } else if (new_size < old_size) {
1411 ret = btrfs_shrink_device(device, new_size); 1411 ret = btrfs_shrink_device(device, new_size);
1412 } 1412 } /* equal, nothing need to do */
1413 1413
1414out_free: 1414out_free:
1415 kfree(vol_args); 1415 kfree(vol_args);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index eaaf0bf52791..32a88428f6da 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3059,9 +3059,6 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
3059 u64 old_size = device->total_bytes; 3059 u64 old_size = device->total_bytes;
3060 u64 diff = device->total_bytes - new_size; 3060 u64 diff = device->total_bytes - new_size;
3061 3061
3062 if (new_size >= device->total_bytes)
3063 return -EINVAL;
3064
3065 path = btrfs_alloc_path(); 3062 path = btrfs_alloc_path();
3066 if (!path) 3063 if (!path)
3067 return -ENOMEM; 3064 return -ENOMEM;