Btrfs: Remove the invalid shrink size check up from btrfs_shrink_dev()
authorjeff.liu <jeff.liu@oracle.com>
Sat, 27 Oct 2012 12:06:39 +0000 (12:06 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Wed, 12 Dec 2012 22:15:16 +0000 (17:15 -0500)
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>
fs/btrfs/ioctl.c
fs/btrfs/volumes.c

index 8fcf9a59c28d08c5c8a6c65e34844e321ca2b66c..14c0d2e0790c95a8c2814fdfb4506939b5f2f765 100644 (file)
@@ -1409,7 +1409,7 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
                btrfs_commit_transaction(trans, root);
        } else if (new_size < old_size) {
                ret = btrfs_shrink_device(device, new_size);
-       }
+       } /* equal, nothing need to do */
 
 out_free:
        kfree(vol_args);
index eaaf0bf52791afdb3c8d951a598b02f4efe10c09..32a88428f6da230e8a297dbee69a24adf8e7f530 100644 (file)
@@ -3059,9 +3059,6 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
        u64 old_size = device->total_bytes;
        u64 diff = device->total_bytes - new_size;
 
-       if (new_size >= device->total_bytes)
-               return -EINVAL;
-
        path = btrfs_alloc_path();
        if (!path)
                return -ENOMEM;