Btrfs: avoid visiting all extent items when cloning a range
authorFilipe Manana <fdmanana@gmail.com>
Sat, 31 May 2014 01:31:05 +0000 (02:31 +0100)
committerChris Mason <clm@fb.com>
Tue, 10 Jun 2014 00:21:04 +0000 (17:21 -0700)
commit2c463823cb897a8e1758518c911646f5605cdd82
tree65f95634ccd85b562325e1134ce16180cb179c32
parentc55bfa67e94e22ec0449fe7c55b3ef20fbe13348
Btrfs: avoid visiting all extent items when cloning a range

When cloning a range of a file, we were visiting all the extent items in
the btree that belong to our source inode. We don't need to visit those
extent items that don't overlap the range we are cloning, as doing so only
makes us waste time and do unnecessary btree navigations (btrfs_next_leaf)
for inodes that have a large number of file extent items in the btree.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ioctl.c