summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorchandan <chandan@linux.vnet.ibm.com>2015-06-09 17:38:32 +0530
committerChris Mason <clm@fb.com>2015-06-10 07:02:47 -0700
commite4826a5b2430f23ad4ec7823efcd413fce9f2d64 (patch)
tree63004d5009b0e7a178758264511202dcf6a1d3dc /fs/btrfs/ioctl.c
parent4617ea3a52cfe8ae407ef406ab999f40a558c369 (diff)
downloadop-kernel-dev-e4826a5b2430f23ad4ec7823efcd413fce9f2d64.zip
op-kernel-dev-e4826a5b2430f23ad4ec7823efcd413fce9f2d64.tar.gz
Btrfs: btrfs_defrag_file: Fix ra_index computation.
Read-ahead is done for the pages in the range [ra_index, ra_index + cluster - 1]. So the next read-ahead should be starting from the page at index 'ra_index + cluster' (unless we deemed that the extent at 'ra_index + cluster' as non-defraggable) rather than from the page at index 'ra_index + max_cluster'. This patch fixes this. I did run the xfstests suite to make sure that the code does not regress. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index f7c65ca..25c422b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1368,7 +1368,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
ra_index = max(i, ra_index);
btrfs_force_ra(inode->i_mapping, ra, file, ra_index,
cluster);
- ra_index += max_cluster;
+ ra_index += cluster;
}
mutex_lock(&inode->i_mutex);
OpenPOWER on IntegriCloud