Skip to content

Commit e4826a5

Browse files
chandanmasoncl
authored andcommitted
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 <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent 4617ea3 commit e4826a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
13681368
ra_index = max(i, ra_index);
13691369
btrfs_force_ra(inode->i_mapping, ra, file, ra_index,
13701370
cluster);
1371-
ra_index += max_cluster;
1371+
ra_index += cluster;
13721372
}
13731373

13741374
mutex_lock(&inode->i_mutex);

0 commit comments

Comments
 (0)