diff options
author | Filipe Manana <fdmanana@suse.com> | 2022-09-01 14:18:21 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-09-26 12:28:00 +0200 |
commit | aed0ca180b45e145046b235cb61982a6292e756c (patch) | |
tree | 21a9812fc72c7cac199c9457eb1fbecc9bb91793 /fs/btrfs | |
parent | bd64f6221a98fb1857485c63fd3d8da8d47406c6 (diff) |
btrfs: allow hole and data seeking to be interruptible
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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 0a76ae8b8e96..96f444ad0951 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -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); |