Skip to content

Commit

Permalink
btrfs: allow hole and data seeking to be interruptible
Browse files Browse the repository at this point in the history
Doing hole or data seeking on a file with a very large number of extents
can take a long time, and we have reports of it being too slow (such as
at LSFMM from 2017, see the Link below). So make it interruptible.

Link: https://lwn.net/Articles/718805/
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Filipe Manana authored and David Sterba committed Sep 26, 2022
1 parent bd64f62 commit aed0ca1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3652,6 +3652,10 @@ static loff_t find_desired_extent(struct btrfs_inode *inode, loff_t offset,
start = em->start + em->len;
free_extent_map(em);
em = NULL;
if (fatal_signal_pending(current)) {
ret = -EINTR;
break;
}
cond_resched();
}
free_extent_map(em);
Expand Down

0 comments on commit aed0ca1

Please sign in to comment.