btrfs: remove set but not used variable 'num_pages'
[sfrench/cifs-2.6.git] / fs / btrfs / ioctl.c
index 9c8e1734429c7649721eeadd3dca941ff2ee490c..4b5619127435c128147f9deb3799e30aff93fae7 100644 (file)
@@ -3278,7 +3278,6 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
                             struct inode *dst, u64 dst_loff)
 {
        int ret;
-       int num_pages = PAGE_ALIGN(BTRFS_MAX_DEDUPE_LEN) >> PAGE_SHIFT;
        u64 i, tail_len, chunk_count;
 
        /* don't make the dst file partly checksummed */
@@ -3291,8 +3290,6 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
 
        tail_len = olen % BTRFS_MAX_DEDUPE_LEN;
        chunk_count = div_u64(olen, BTRFS_MAX_DEDUPE_LEN);
-       if (chunk_count == 0)
-               num_pages = PAGE_ALIGN(tail_len) >> PAGE_SHIFT;
 
        for (i = 0; i < chunk_count; i++) {
                ret = btrfs_extent_same_range(src, loff, BTRFS_MAX_DEDUPE_LEN,
@@ -4381,7 +4378,7 @@ static long btrfs_ioctl_scrub(struct file *file, void __user *arg)
                              &sa->progress, sa->flags & BTRFS_SCRUB_READONLY,
                              0);
 
-       if (copy_to_user(arg, sa, sizeof(*sa)))
+       if (ret == 0 && copy_to_user(arg, sa, sizeof(*sa)))
                ret = -EFAULT;
 
        if (!(sa->flags & BTRFS_SCRUB_READONLY))
@@ -4414,7 +4411,7 @@ static long btrfs_ioctl_scrub_progress(struct btrfs_fs_info *fs_info,
 
        ret = btrfs_scrub_progress(fs_info, sa->devid, &sa->progress);
 
-       if (copy_to_user(arg, sa, sizeof(*sa)))
+       if (ret == 0 && copy_to_user(arg, sa, sizeof(*sa)))
                ret = -EFAULT;
 
        kfree(sa);
@@ -4438,7 +4435,7 @@ static long btrfs_ioctl_get_dev_stats(struct btrfs_fs_info *fs_info,
 
        ret = btrfs_get_dev_stats(fs_info, sa);
 
-       if (copy_to_user(arg, sa, sizeof(*sa)))
+       if (ret == 0 && copy_to_user(arg, sa, sizeof(*sa)))
                ret = -EFAULT;
 
        kfree(sa);