summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index d6e10d60f8ad..8eecfcce56ed 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1335,8 +1335,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
1335 inode->i_mapping->writeback_index = i; 1335 inode->i_mapping->writeback_index = i;
1336 1336
1337 while (i <= last_index && defrag_count < max_to_defrag && 1337 while (i <= last_index && defrag_count < max_to_defrag &&
1338 (i < (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> 1338 (i < DIV_ROUND_UP(i_size_read(inode), PAGE_CACHE_SIZE))) {
1339 PAGE_CACHE_SHIFT)) {
1340 /* 1339 /*
1341 * make sure we stop running if someone unmounts 1340 * make sure we stop running if someone unmounts
1342 * the FS 1341 * the FS
@@ -1359,7 +1358,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
1359 * the should_defrag function tells us how much to skip 1358 * the should_defrag function tells us how much to skip
1360 * bump our counter by the suggested amount 1359 * bump our counter by the suggested amount
1361 */ 1360 */
1362 next = (skip + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 1361 next = DIV_ROUND_UP(skip, PAGE_CACHE_SIZE);
1363 i = max(i + 1, next); 1362 i = max(i + 1, next);
1364 continue; 1363 continue;
1365 } 1364 }