Linux-BTRFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] btrfs: Opencode ordered_data_tree_panic
@ 2019-11-29  9:38 Nikolay Borisov
  2019-11-29  9:49 ` Nikolay Borisov
  2019-12-03 19:25 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Nikolay Borisov @ 2019-11-29  9:38 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

It's a simple wrapper over btrfs_panic and is called only once. Just
open code it.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/extent-tree.c  |  5 +----
 fs/btrfs/ordered-data.c | 10 +---------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index f68b38f44f0b..ab99ec6e188b 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4172,11 +4172,8 @@ int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
 	struct btrfs_block_group *cache;
 
 	cache = btrfs_lookup_block_group(fs_info, start);
-	if (!cache) {
-		btrfs_err(fs_info, "Unable to find block group for %llu",
-			  start);
+	if (!cache)
 		return -ENOSPC;
-	}
 
 	btrfs_add_free_space(cache, start, len);
 	btrfs_free_reserved_bytes(cache, len, delalloc);
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index fb09bc2f8e4d..ddba2dc34b5a 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -52,14 +52,6 @@ static struct rb_node *tree_insert(struct rb_root *root, u64 file_offset,
 	return NULL;
 }
 
-static void ordered_data_tree_panic(struct inode *inode, int errno,
-					       u64 offset)
-{
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-	btrfs_panic(fs_info, errno,
-		    "Inconsistency in ordered tree at offset %llu", offset);
-}
-
 /*
  * look for a given offset in the tree, and if it can't be found return the
  * first lesser offset
@@ -219,7 +211,7 @@ static int __btrfs_add_ordered_extent(struct inode *inode, u64 file_offset,
 	node = tree_insert(&tree->tree, file_offset,
 			   &entry->rb_node);
 	if (node)
-		ordered_data_tree_panic(inode, -EEXIST, file_offset);
+		btrfs_panic(fs_info, -EEXIST, "Inconsistency in ordered tree at offset %llu",offset);
 	spin_unlock_irq(&tree->lock);
 
 	spin_lock(&root->ordered_extent_lock);
-- 
2.17.1


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

* Re: [PATCH] btrfs: Opencode ordered_data_tree_panic
  2019-11-29  9:38 [PATCH] btrfs: Opencode ordered_data_tree_panic Nikolay Borisov
@ 2019-11-29  9:49 ` Nikolay Borisov
  2019-11-29 14:18   ` David Sterba
  2019-12-03 19:25 ` David Sterba
  1 sibling, 1 reply; 4+ messages in thread
From: Nikolay Borisov @ 2019-11-29  9:49 UTC (permalink / raw)
  To: linux-btrfs



On 29.11.19 г. 11:38 ч., Nikolay Borisov wrote:
> It's a simple wrapper over btrfs_panic and is called only once. Just
> open code it.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/extent-tree.c  |  5 +----
>  fs/btrfs/ordered-data.c | 10 +---------
>  2 files changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index f68b38f44f0b..ab99ec6e188b 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -4172,11 +4172,8 @@ int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
>  	struct btrfs_block_group *cache;
>  
>  	cache = btrfs_lookup_block_group(fs_info, start);
> -	if (!cache) {
> -		btrfs_err(fs_info, "Unable to find block group for %llu",
> -			  start);
> +	if (!cache)
>  		return -ENOSPC;
> -	}
>  
>  	btrfs_add_free_space(cache, start, len);
>  	btrfs_free_reserved_bytes(cache, len, delalloc);

Grrr this hunk should be dropped.... Shall I resend ?

> diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
> index fb09bc2f8e4d..ddba2dc34b5a 100644
> --- a/fs/btrfs/ordered-data.c
> +++ b/fs/btrfs/ordered-data.c
> @@ -52,14 +52,6 @@ static struct rb_node *tree_insert(struct rb_root *root, u64 file_offset,
>  	return NULL;
>  }
>  
> -static void ordered_data_tree_panic(struct inode *inode, int errno,
> -					       u64 offset)
> -{
> -	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
> -	btrfs_panic(fs_info, errno,
> -		    "Inconsistency in ordered tree at offset %llu", offset);
> -}
> -
>  /*
>   * look for a given offset in the tree, and if it can't be found return the
>   * first lesser offset
> @@ -219,7 +211,7 @@ static int __btrfs_add_ordered_extent(struct inode *inode, u64 file_offset,
>  	node = tree_insert(&tree->tree, file_offset,
>  			   &entry->rb_node);
>  	if (node)
> -		ordered_data_tree_panic(inode, -EEXIST, file_offset);
> +		btrfs_panic(fs_info, -EEXIST, "Inconsistency in ordered tree at offset %llu",offset);
>  	spin_unlock_irq(&tree->lock);
>  
>  	spin_lock(&root->ordered_extent_lock);
> 

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

* Re: [PATCH] btrfs: Opencode ordered_data_tree_panic
  2019-11-29  9:49 ` Nikolay Borisov
@ 2019-11-29 14:18   ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2019-11-29 14:18 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Fri, Nov 29, 2019 at 11:49:23AM +0200, Nikolay Borisov wrote:
> 
> 
> On 29.11.19 г. 11:38 ч., Nikolay Borisov wrote:
> > It's a simple wrapper over btrfs_panic and is called only once. Just
> > open code it.
> > 
> > Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> > ---
> >  fs/btrfs/extent-tree.c  |  5 +----
> >  fs/btrfs/ordered-data.c | 10 +---------
> >  2 files changed, 2 insertions(+), 13 deletions(-)
> > 
> > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> > index f68b38f44f0b..ab99ec6e188b 100644
> > --- a/fs/btrfs/extent-tree.c
> > +++ b/fs/btrfs/extent-tree.c
> > @@ -4172,11 +4172,8 @@ int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
> >  	struct btrfs_block_group *cache;
> >  
> >  	cache = btrfs_lookup_block_group(fs_info, start);
> > -	if (!cache) {
> > -		btrfs_err(fs_info, "Unable to find block group for %llu",
> > -			  start);
> > +	if (!cache)
> >  		return -ENOSPC;
> > -	}
> >  
> >  	btrfs_add_free_space(cache, start, len);
> >  	btrfs_free_reserved_bytes(cache, len, delalloc);
> 
> Grrr this hunk should be dropped.... Shall I resend ?

No, i'll drop it

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

* Re: [PATCH] btrfs: Opencode ordered_data_tree_panic
  2019-11-29  9:38 [PATCH] btrfs: Opencode ordered_data_tree_panic Nikolay Borisov
  2019-11-29  9:49 ` Nikolay Borisov
@ 2019-12-03 19:25 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2019-12-03 19:25 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Fri, Nov 29, 2019 at 11:38:13AM +0200, Nikolay Borisov wrote:
> It's a simple wrapper over btrfs_panic and is called only once. Just
> open code it.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Added to misc-next with 1st hunk dropped and fixed coding style, thanks.

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-29  9:38 [PATCH] btrfs: Opencode ordered_data_tree_panic Nikolay Borisov
2019-11-29  9:49 ` Nikolay Borisov
2019-11-29 14:18   ` David Sterba
2019-12-03 19:25 ` David Sterba

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org
	public-inbox-index linux-btrfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git