Btrfs: do not defrag a file partially
[firefly-linux-kernel-4.4.55.git] / fs / btrfs / ioctl.c
index 6834be4c8709568e1f44fa8d42584a10228cdc07..0b06a5ca8afc5826ea87257024d35f1ae2e8aa32 100644 (file)
@@ -1066,7 +1066,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
                i = range->start >> PAGE_CACHE_SHIFT;
        }
        if (!max_to_defrag)
-               max_to_defrag = last_index;
+               max_to_defrag = last_index + 1;
 
        /*
         * make writeback starts from i, so the defrag range can be