diff mbox

Btrfs: reset ret in record_one_backref

Message ID 1374511955-1830-1-git-send-email-jbacik@fusionio.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Josef Bacik July 22, 2013, 4:52 p.m. UTC
I was getting warnings when running find ./ -type f -exec btrfs fi defrag -f {}
\; from record_one_backref because ret was set.  Turns out it was because it was
set to 1 because the search slot didn't come out exact and we never reset it.
So reset it to 0 right after the search so we don't leak this and get
uneccessary warnings.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 fs/btrfs/inode.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Miao Xie July 23, 2013, 1:53 a.m. UTC | #1
On mon, 22 Jul 2013 12:52:35 -0400, Josef Bacik wrote:
> I was getting warnings when running find ./ -type f -exec btrfs fi defrag -f {}
> \; from record_one_backref because ret was set.  Turns out it was because it was
> set to 1 because the search slot didn't come out exact and we never reset it.
> So reset it to 0 right after the search so we don't leak this and get
> uneccessary warnings.  Thanks,
> 
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>

Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>

> ---
>  fs/btrfs/inode.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index dd05238..a3a6155 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -2132,6 +2132,7 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
>  		WARN_ON(1);
>  		return ret;
>  	}
> +	ret = 0;
>  
>  	while (1) {
>  		cond_resched();
> @@ -2181,8 +2182,6 @@ static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
>  		    old->len || extent_offset + num_bytes <=
>  		    old->extent_offset + old->offset)
>  			continue;
> -
> -		ret = 0;
>  		break;
>  	}
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index dd05238..a3a6155 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2132,6 +2132,7 @@  static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
 		WARN_ON(1);
 		return ret;
 	}
+	ret = 0;
 
 	while (1) {
 		cond_resched();
@@ -2181,8 +2182,6 @@  static noinline int record_one_backref(u64 inum, u64 offset, u64 root_id,
 		    old->len || extent_offset + num_bytes <=
 		    old->extent_offset + old->offset)
 			continue;
-
-		ret = 0;
 		break;
 	}