diff mbox series

[01/10] btrfs: allow hole and data seeking to be interruptible

Message ID 29ac2c59860774abb16bfb2660e0dd831d793cf5.1662022922.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: make lseek and fiemap much more efficient | expand

Commit Message

Filipe Manana Sept. 1, 2022, 1:18 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

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/
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/file.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Josef Bacik Sept. 1, 2022, 1:58 p.m. UTC | #1
On Thu, Sep 01, 2022 at 02:18:21PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> 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/
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
Qu Wenruo Sept. 1, 2022, 9:49 p.m. UTC | #2
On 2022/9/1 21:18, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> 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/
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/file.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> 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);
diff mbox series

Patch

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);