All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: stop checking for NULL return from btrfs_get_extent_fiemap()
@ 2022-02-04 12:06 Johannes Thumshirn
  2022-02-04 12:14 ` Filipe Manana
  2022-02-04 16:15 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2022-02-04 12:06 UTC (permalink / raw)
  To: David Sterba; +Cc: Johannes Thumshirn, linux-btrfs, Filipe Manana

In get_extent_skip_holes() we're checking the return of
btrfs_get_extent_fiemap() for an error-pointer or NULL, but
btrfs_get_extent_fiemap() will never return NULL, only error-pointers or a
valid extent_map.

The other caller of btrfs_get_extent_fiemap(), find_desired_extent(),
correctly only checks for error-pointers.

Cc: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 409bad3928db..ad3d8e53a75a 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -5390,7 +5390,7 @@ static struct extent_map *get_extent_skip_holes(struct btrfs_inode *inode,
 			break;
 		len = ALIGN(len, sectorsize);
 		em = btrfs_get_extent_fiemap(inode, offset, len);
-		if (IS_ERR_OR_NULL(em))
+		if (IS_ERR(em))
 			return em;
 
 		/* if this isn't a hole return it */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: stop checking for NULL return from btrfs_get_extent_fiemap()
  2022-02-04 12:06 [PATCH] btrfs: stop checking for NULL return from btrfs_get_extent_fiemap() Johannes Thumshirn
@ 2022-02-04 12:14 ` Filipe Manana
  2022-02-04 16:15 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Filipe Manana @ 2022-02-04 12:14 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs, Filipe Manana

On Fri, Feb 04, 2022 at 04:06:27AM -0800, Johannes Thumshirn wrote:
> In get_extent_skip_holes() we're checking the return of
> btrfs_get_extent_fiemap() for an error-pointer or NULL, but
> btrfs_get_extent_fiemap() will never return NULL, only error-pointers or a
> valid extent_map.
> 
> The other caller of btrfs_get_extent_fiemap(), find_desired_extent(),
> correctly only checks for error-pointers.
> 
> Cc: Filipe Manana <fdmanana@suse.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Looks good, thanks.

> ---
>  fs/btrfs/extent_io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 409bad3928db..ad3d8e53a75a 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -5390,7 +5390,7 @@ static struct extent_map *get_extent_skip_holes(struct btrfs_inode *inode,
>  			break;
>  		len = ALIGN(len, sectorsize);
>  		em = btrfs_get_extent_fiemap(inode, offset, len);
> -		if (IS_ERR_OR_NULL(em))
> +		if (IS_ERR(em))
>  			return em;
>  
>  		/* if this isn't a hole return it */
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: stop checking for NULL return from btrfs_get_extent_fiemap()
  2022-02-04 12:06 [PATCH] btrfs: stop checking for NULL return from btrfs_get_extent_fiemap() Johannes Thumshirn
  2022-02-04 12:14 ` Filipe Manana
@ 2022-02-04 16:15 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-02-04 16:15 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs, Filipe Manana

On Fri, Feb 04, 2022 at 04:06:27AM -0800, Johannes Thumshirn wrote:
> In get_extent_skip_holes() we're checking the return of
> btrfs_get_extent_fiemap() for an error-pointer or NULL, but
> btrfs_get_extent_fiemap() will never return NULL, only error-pointers or a
> valid extent_map.
> 
> The other caller of btrfs_get_extent_fiemap(), find_desired_extent(),
> correctly only checks for error-pointers.
> 
> Cc: Filipe Manana <fdmanana@suse.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Added to misc-next, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-04 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04 12:06 [PATCH] btrfs: stop checking for NULL return from btrfs_get_extent_fiemap() Johannes Thumshirn
2022-02-04 12:14 ` Filipe Manana
2022-02-04 16:15 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.