diff mbox series

[2/5] xfs: remove unnecessary parameter from scrub_scan_estimate_blocks

Message ID 160375512596.879169.13683347692314634844.stgit@magnolia (mailing list archive)
State Superseded, archived
Headers show
Series xfsprogs: fixes for 5.10 | expand

Commit Message

Darrick J. Wong Oct. 26, 2020, 11:32 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

The only caller that cares about the file counts uses it to compute the
number of files used, so return that and save a parameter.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/fscounters.c |    8 +++-----
 scrub/fscounters.h |    2 +-
 scrub/phase6.c     |    7 +++----
 scrub/phase7.c     |    5 +----
 4 files changed, 8 insertions(+), 14 deletions(-)

Comments

Allison Henderson Oct. 27, 2020, 5:35 a.m. UTC | #1
On 10/26/20 4:32 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The only caller that cares about the file counts uses it to compute the
> number of files used, so return that and save a parameter.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>   scrub/fscounters.c |    8 +++-----
>   scrub/fscounters.h |    2 +-
>   scrub/phase6.c     |    7 +++----
>   scrub/phase7.c     |    5 +----
>   4 files changed, 8 insertions(+), 14 deletions(-)
> 
> 
> diff --git a/scrub/fscounters.c b/scrub/fscounters.c
> index e9901fcdf6df..9a240d49477b 100644
> --- a/scrub/fscounters.c
> +++ b/scrub/fscounters.c
> @@ -116,7 +116,7 @@ scrub_count_all_inodes(
>   }
>   
>   /*
> - * Estimate the number of blocks and inodes in the filesystem.  Returns 0
> + * Estimate the number of blocks and used inodes in the filesystem.  Returns 0
>    * or a positive error number.
>    */
>   int
> @@ -126,8 +126,7 @@ scrub_scan_estimate_blocks(
>   	unsigned long long		*d_bfree,
>   	unsigned long long		*r_blocks,
>   	unsigned long long		*r_bfree,
> -	unsigned long long		*f_files,
> -	unsigned long long		*f_free)
> +	unsigned long long		*f_files_used)
>   {
>   	struct xfs_fsop_counts		fc;
>   	int				error;
> @@ -141,8 +140,7 @@ scrub_scan_estimate_blocks(
>   	*d_bfree = fc.freedata;
>   	*r_blocks = ctx->mnt.fsgeom.rtblocks;
>   	*r_bfree = fc.freertx;
> -	*f_files = fc.allocino;
> -	*f_free = fc.freeino;
> +	*f_files_used = fc.allocino - fc.freeino;
Just a nit, I think I might have put in:
	if(f_files_used)
		*f_files_used = fc.allocino - fc.freeino;

That way calling functions that don't care can just pass NULL, instead 
of declaring a "dontcare" variable that has no other use.  Though I 
suppose none of the other variables do that.

Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Allison
>   
>   	return 0;
>   }
> diff --git a/scrub/fscounters.h b/scrub/fscounters.h
> index 1fae58a6b287..13bd9967f004 100644
> --- a/scrub/fscounters.h
> +++ b/scrub/fscounters.h
> @@ -9,7 +9,7 @@
>   int scrub_scan_estimate_blocks(struct scrub_ctx *ctx,
>   		unsigned long long *d_blocks, unsigned long long *d_bfree,
>   		unsigned long long *r_blocks, unsigned long long *r_bfree,
> -		unsigned long long *f_files, unsigned long long *f_free);
> +		unsigned long long *f_files_used);
>   int scrub_count_all_inodes(struct scrub_ctx *ctx, uint64_t *count);
>   
>   #endif /* XFS_SCRUB_FSCOUNTERS_H_ */
> diff --git a/scrub/phase6.c b/scrub/phase6.c
> index 8d976732d8e1..87828b60fbed 100644
> --- a/scrub/phase6.c
> +++ b/scrub/phase6.c
> @@ -719,12 +719,11 @@ phase6_estimate(
>   	unsigned long long	d_bfree;
>   	unsigned long long	r_blocks;
>   	unsigned long long	r_bfree;
> -	unsigned long long	f_files;
> -	unsigned long long	f_free;
> +	unsigned long long	dontcare;
>   	int			ret;
>   
> -	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree,
> -				&r_blocks, &r_bfree, &f_files, &f_free);
> +	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
> +			&r_bfree, &dontcare);
>   	if (ret) {
>   		str_liberror(ctx, ret, _("estimating verify work"));
>   		return ret;
> diff --git a/scrub/phase7.c b/scrub/phase7.c
> index 96876f7c0596..bc652ab6f44a 100644
> --- a/scrub/phase7.c
> +++ b/scrub/phase7.c
> @@ -111,8 +111,6 @@ phase7_func(
>   	unsigned long long	d_bfree;
>   	unsigned long long	r_blocks;
>   	unsigned long long	r_bfree;
> -	unsigned long long	f_files;
> -	unsigned long long	f_free;
>   	bool			complain;
>   	int			ip;
>   	int			error;
> @@ -160,7 +158,7 @@ phase7_func(
>   	}
>   
>   	error = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
> -			&r_bfree, &f_files, &f_free);
> +			&r_bfree, &used_files);
>   	if (error) {
>   		str_liberror(ctx, error, _("estimating verify work"));
>   		return error;
> @@ -177,7 +175,6 @@ phase7_func(
>   	/* Report on what we found. */
>   	used_data = cvt_off_fsb_to_b(&ctx->mnt, d_blocks - d_bfree);
>   	used_rt = cvt_off_fsb_to_b(&ctx->mnt, r_blocks - r_bfree);
> -	used_files = f_files - f_free;
>   	stat_data = totalcount.dbytes;
>   	stat_rt = totalcount.rbytes;
>   
>
Darrick J. Wong Oct. 27, 2020, 3:33 p.m. UTC | #2
On Mon, Oct 26, 2020 at 10:35:46PM -0700, Allison Henderson wrote:
> 
> 
> On 10/26/20 4:32 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > The only caller that cares about the file counts uses it to compute the
> > number of files used, so return that and save a parameter.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >   scrub/fscounters.c |    8 +++-----
> >   scrub/fscounters.h |    2 +-
> >   scrub/phase6.c     |    7 +++----
> >   scrub/phase7.c     |    5 +----
> >   4 files changed, 8 insertions(+), 14 deletions(-)
> > 
> > 
> > diff --git a/scrub/fscounters.c b/scrub/fscounters.c
> > index e9901fcdf6df..9a240d49477b 100644
> > --- a/scrub/fscounters.c
> > +++ b/scrub/fscounters.c
> > @@ -116,7 +116,7 @@ scrub_count_all_inodes(
> >   }
> >   /*
> > - * Estimate the number of blocks and inodes in the filesystem.  Returns 0
> > + * Estimate the number of blocks and used inodes in the filesystem.  Returns 0
> >    * or a positive error number.
> >    */
> >   int
> > @@ -126,8 +126,7 @@ scrub_scan_estimate_blocks(
> >   	unsigned long long		*d_bfree,
> >   	unsigned long long		*r_blocks,
> >   	unsigned long long		*r_bfree,
> > -	unsigned long long		*f_files,
> > -	unsigned long long		*f_free)
> > +	unsigned long long		*f_files_used)
> >   {
> >   	struct xfs_fsop_counts		fc;
> >   	int				error;
> > @@ -141,8 +140,7 @@ scrub_scan_estimate_blocks(
> >   	*d_bfree = fc.freedata;
> >   	*r_blocks = ctx->mnt.fsgeom.rtblocks;
> >   	*r_bfree = fc.freertx;
> > -	*f_files = fc.allocino;
> > -	*f_free = fc.freeino;
> > +	*f_files_used = fc.allocino - fc.freeino;
> Just a nit, I think I might have put in:
> 	if(f_files_used)
> 		*f_files_used = fc.allocino - fc.freeino;
> 
> That way calling functions that don't care can just pass NULL, instead of
> declaring a "dontcare" variable that has no other use.  Though I suppose
> none of the other variables do that.

<shrug> There's only two callers, and they both pass a pointer, so I
didn't bother...

--D

> Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
> Allison
> >   	return 0;
> >   }
> > diff --git a/scrub/fscounters.h b/scrub/fscounters.h
> > index 1fae58a6b287..13bd9967f004 100644
> > --- a/scrub/fscounters.h
> > +++ b/scrub/fscounters.h
> > @@ -9,7 +9,7 @@
> >   int scrub_scan_estimate_blocks(struct scrub_ctx *ctx,
> >   		unsigned long long *d_blocks, unsigned long long *d_bfree,
> >   		unsigned long long *r_blocks, unsigned long long *r_bfree,
> > -		unsigned long long *f_files, unsigned long long *f_free);
> > +		unsigned long long *f_files_used);
> >   int scrub_count_all_inodes(struct scrub_ctx *ctx, uint64_t *count);
> >   #endif /* XFS_SCRUB_FSCOUNTERS_H_ */
> > diff --git a/scrub/phase6.c b/scrub/phase6.c
> > index 8d976732d8e1..87828b60fbed 100644
> > --- a/scrub/phase6.c
> > +++ b/scrub/phase6.c
> > @@ -719,12 +719,11 @@ phase6_estimate(
> >   	unsigned long long	d_bfree;
> >   	unsigned long long	r_blocks;
> >   	unsigned long long	r_bfree;
> > -	unsigned long long	f_files;
> > -	unsigned long long	f_free;
> > +	unsigned long long	dontcare;
> >   	int			ret;
> > -	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree,
> > -				&r_blocks, &r_bfree, &f_files, &f_free);
> > +	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
> > +			&r_bfree, &dontcare);
> >   	if (ret) {
> >   		str_liberror(ctx, ret, _("estimating verify work"));
> >   		return ret;
> > diff --git a/scrub/phase7.c b/scrub/phase7.c
> > index 96876f7c0596..bc652ab6f44a 100644
> > --- a/scrub/phase7.c
> > +++ b/scrub/phase7.c
> > @@ -111,8 +111,6 @@ phase7_func(
> >   	unsigned long long	d_bfree;
> >   	unsigned long long	r_blocks;
> >   	unsigned long long	r_bfree;
> > -	unsigned long long	f_files;
> > -	unsigned long long	f_free;
> >   	bool			complain;
> >   	int			ip;
> >   	int			error;
> > @@ -160,7 +158,7 @@ phase7_func(
> >   	}
> >   	error = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
> > -			&r_bfree, &f_files, &f_free);
> > +			&r_bfree, &used_files);
> >   	if (error) {
> >   		str_liberror(ctx, error, _("estimating verify work"));
> >   		return error;
> > @@ -177,7 +175,6 @@ phase7_func(
> >   	/* Report on what we found. */
> >   	used_data = cvt_off_fsb_to_b(&ctx->mnt, d_blocks - d_bfree);
> >   	used_rt = cvt_off_fsb_to_b(&ctx->mnt, r_blocks - r_bfree);
> > -	used_files = f_files - f_free;
> >   	stat_data = totalcount.dbytes;
> >   	stat_rt = totalcount.rbytes;
> >
Christoph Hellwig Oct. 28, 2020, 7:33 a.m. UTC | #3
On Mon, Oct 26, 2020 at 04:32:05PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The only caller that cares about the file counts uses it to compute the
> number of files used, so return that and save a parameter.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Darrick J. Wong Oct. 29, 2020, 6:33 p.m. UTC | #4
On Tue, Oct 27, 2020 at 08:33:50AM -0700, Darrick J. Wong wrote:
> On Mon, Oct 26, 2020 at 10:35:46PM -0700, Allison Henderson wrote:
> > 
> > 
> > On 10/26/20 4:32 PM, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <darrick.wong@oracle.com>
> > > 
> > > The only caller that cares about the file counts uses it to compute the
> > > number of files used, so return that and save a parameter.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> > >   scrub/fscounters.c |    8 +++-----
> > >   scrub/fscounters.h |    2 +-
> > >   scrub/phase6.c     |    7 +++----
> > >   scrub/phase7.c     |    5 +----
> > >   4 files changed, 8 insertions(+), 14 deletions(-)
> > > 
> > > 
> > > diff --git a/scrub/fscounters.c b/scrub/fscounters.c
> > > index e9901fcdf6df..9a240d49477b 100644
> > > --- a/scrub/fscounters.c
> > > +++ b/scrub/fscounters.c
> > > @@ -116,7 +116,7 @@ scrub_count_all_inodes(
> > >   }
> > >   /*
> > > - * Estimate the number of blocks and inodes in the filesystem.  Returns 0
> > > + * Estimate the number of blocks and used inodes in the filesystem.  Returns 0
> > >    * or a positive error number.
> > >    */
> > >   int
> > > @@ -126,8 +126,7 @@ scrub_scan_estimate_blocks(
> > >   	unsigned long long		*d_bfree,
> > >   	unsigned long long		*r_blocks,
> > >   	unsigned long long		*r_bfree,
> > > -	unsigned long long		*f_files,
> > > -	unsigned long long		*f_free)
> > > +	unsigned long long		*f_files_used)
> > >   {
> > >   	struct xfs_fsop_counts		fc;
> > >   	int				error;
> > > @@ -141,8 +140,7 @@ scrub_scan_estimate_blocks(
> > >   	*d_bfree = fc.freedata;
> > >   	*r_blocks = ctx->mnt.fsgeom.rtblocks;
> > >   	*r_bfree = fc.freertx;
> > > -	*f_files = fc.allocino;
> > > -	*f_free = fc.freeino;
> > > +	*f_files_used = fc.allocino - fc.freeino;
> > Just a nit, I think I might have put in:
> > 	if(f_files_used)
> > 		*f_files_used = fc.allocino - fc.freeino;
> > 
> > That way calling functions that don't care can just pass NULL, instead of
> > declaring a "dontcare" variable that has no other use.  Though I suppose
> > none of the other variables do that.
> 
> <shrug> There's only two callers, and they both pass a pointer, so I
> didn't bother...

...and one of those callers is to a dontcare variable; and that's what
you were talking about.

Er... I don't mind changing it, but I'll leave that to Eric's
discretion.

--D

> --D
> 
> > Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
> > Allison
> > >   	return 0;
> > >   }
> > > diff --git a/scrub/fscounters.h b/scrub/fscounters.h
> > > index 1fae58a6b287..13bd9967f004 100644
> > > --- a/scrub/fscounters.h
> > > +++ b/scrub/fscounters.h
> > > @@ -9,7 +9,7 @@
> > >   int scrub_scan_estimate_blocks(struct scrub_ctx *ctx,
> > >   		unsigned long long *d_blocks, unsigned long long *d_bfree,
> > >   		unsigned long long *r_blocks, unsigned long long *r_bfree,
> > > -		unsigned long long *f_files, unsigned long long *f_free);
> > > +		unsigned long long *f_files_used);
> > >   int scrub_count_all_inodes(struct scrub_ctx *ctx, uint64_t *count);
> > >   #endif /* XFS_SCRUB_FSCOUNTERS_H_ */
> > > diff --git a/scrub/phase6.c b/scrub/phase6.c
> > > index 8d976732d8e1..87828b60fbed 100644
> > > --- a/scrub/phase6.c
> > > +++ b/scrub/phase6.c
> > > @@ -719,12 +719,11 @@ phase6_estimate(
> > >   	unsigned long long	d_bfree;
> > >   	unsigned long long	r_blocks;
> > >   	unsigned long long	r_bfree;
> > > -	unsigned long long	f_files;
> > > -	unsigned long long	f_free;
> > > +	unsigned long long	dontcare;
> > >   	int			ret;
> > > -	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree,
> > > -				&r_blocks, &r_bfree, &f_files, &f_free);
> > > +	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
> > > +			&r_bfree, &dontcare);
> > >   	if (ret) {
> > >   		str_liberror(ctx, ret, _("estimating verify work"));
> > >   		return ret;
> > > diff --git a/scrub/phase7.c b/scrub/phase7.c
> > > index 96876f7c0596..bc652ab6f44a 100644
> > > --- a/scrub/phase7.c
> > > +++ b/scrub/phase7.c
> > > @@ -111,8 +111,6 @@ phase7_func(
> > >   	unsigned long long	d_bfree;
> > >   	unsigned long long	r_blocks;
> > >   	unsigned long long	r_bfree;
> > > -	unsigned long long	f_files;
> > > -	unsigned long long	f_free;
> > >   	bool			complain;
> > >   	int			ip;
> > >   	int			error;
> > > @@ -160,7 +158,7 @@ phase7_func(
> > >   	}
> > >   	error = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
> > > -			&r_bfree, &f_files, &f_free);
> > > +			&r_bfree, &used_files);
> > >   	if (error) {
> > >   		str_liberror(ctx, error, _("estimating verify work"));
> > >   		return error;
> > > @@ -177,7 +175,6 @@ phase7_func(
> > >   	/* Report on what we found. */
> > >   	used_data = cvt_off_fsb_to_b(&ctx->mnt, d_blocks - d_bfree);
> > >   	used_rt = cvt_off_fsb_to_b(&ctx->mnt, r_blocks - r_bfree);
> > > -	used_files = f_files - f_free;
> > >   	stat_data = totalcount.dbytes;
> > >   	stat_rt = totalcount.rbytes;
> > >
Allison Henderson Oct. 29, 2020, 6:38 p.m. UTC | #5
On 10/29/20 11:33 AM, Darrick J. Wong wrote:
> On Tue, Oct 27, 2020 at 08:33:50AM -0700, Darrick J. Wong wrote:
>> On Mon, Oct 26, 2020 at 10:35:46PM -0700, Allison Henderson wrote:
>>>
>>>
>>> On 10/26/20 4:32 PM, Darrick J. Wong wrote:
>>>> From: Darrick J. Wong <darrick.wong@oracle.com>
>>>>
>>>> The only caller that cares about the file counts uses it to compute the
>>>> number of files used, so return that and save a parameter.
>>>>
>>>> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
>>>> ---
>>>>    scrub/fscounters.c |    8 +++-----
>>>>    scrub/fscounters.h |    2 +-
>>>>    scrub/phase6.c     |    7 +++----
>>>>    scrub/phase7.c     |    5 +----
>>>>    4 files changed, 8 insertions(+), 14 deletions(-)
>>>>
>>>>
>>>> diff --git a/scrub/fscounters.c b/scrub/fscounters.c
>>>> index e9901fcdf6df..9a240d49477b 100644
>>>> --- a/scrub/fscounters.c
>>>> +++ b/scrub/fscounters.c
>>>> @@ -116,7 +116,7 @@ scrub_count_all_inodes(
>>>>    }
>>>>    /*
>>>> - * Estimate the number of blocks and inodes in the filesystem.  Returns 0
>>>> + * Estimate the number of blocks and used inodes in the filesystem.  Returns 0
>>>>     * or a positive error number.
>>>>     */
>>>>    int
>>>> @@ -126,8 +126,7 @@ scrub_scan_estimate_blocks(
>>>>    	unsigned long long		*d_bfree,
>>>>    	unsigned long long		*r_blocks,
>>>>    	unsigned long long		*r_bfree,
>>>> -	unsigned long long		*f_files,
>>>> -	unsigned long long		*f_free)
>>>> +	unsigned long long		*f_files_used)
>>>>    {
>>>>    	struct xfs_fsop_counts		fc;
>>>>    	int				error;
>>>> @@ -141,8 +140,7 @@ scrub_scan_estimate_blocks(
>>>>    	*d_bfree = fc.freedata;
>>>>    	*r_blocks = ctx->mnt.fsgeom.rtblocks;
>>>>    	*r_bfree = fc.freertx;
>>>> -	*f_files = fc.allocino;
>>>> -	*f_free = fc.freeino;
>>>> +	*f_files_used = fc.allocino - fc.freeino;
>>> Just a nit, I think I might have put in:
>>> 	if(f_files_used)
>>> 		*f_files_used = fc.allocino - fc.freeino;
>>>
>>> That way calling functions that don't care can just pass NULL, instead of
>>> declaring a "dontcare" variable that has no other use.  Though I suppose
>>> none of the other variables do that.
>>
>> <shrug> There's only two callers, and they both pass a pointer, so I
>> didn't bother...
> 
> ...and one of those callers is to a dontcare variable; and that's what
> you were talking about.
> 
> Er... I don't mind changing it, but I'll leave that to Eric's
> discretion.
> 
> --D
No worries, it's not a huge detail, I just thought I'd throw the 
suggestion out is all :-)

Allison

> 
>> --D
>>
>>> Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
>>> Allison
>>>>    	return 0;
>>>>    }
>>>> diff --git a/scrub/fscounters.h b/scrub/fscounters.h
>>>> index 1fae58a6b287..13bd9967f004 100644
>>>> --- a/scrub/fscounters.h
>>>> +++ b/scrub/fscounters.h
>>>> @@ -9,7 +9,7 @@
>>>>    int scrub_scan_estimate_blocks(struct scrub_ctx *ctx,
>>>>    		unsigned long long *d_blocks, unsigned long long *d_bfree,
>>>>    		unsigned long long *r_blocks, unsigned long long *r_bfree,
>>>> -		unsigned long long *f_files, unsigned long long *f_free);
>>>> +		unsigned long long *f_files_used);
>>>>    int scrub_count_all_inodes(struct scrub_ctx *ctx, uint64_t *count);
>>>>    #endif /* XFS_SCRUB_FSCOUNTERS_H_ */
>>>> diff --git a/scrub/phase6.c b/scrub/phase6.c
>>>> index 8d976732d8e1..87828b60fbed 100644
>>>> --- a/scrub/phase6.c
>>>> +++ b/scrub/phase6.c
>>>> @@ -719,12 +719,11 @@ phase6_estimate(
>>>>    	unsigned long long	d_bfree;
>>>>    	unsigned long long	r_blocks;
>>>>    	unsigned long long	r_bfree;
>>>> -	unsigned long long	f_files;
>>>> -	unsigned long long	f_free;
>>>> +	unsigned long long	dontcare;
>>>>    	int			ret;
>>>> -	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree,
>>>> -				&r_blocks, &r_bfree, &f_files, &f_free);
>>>> +	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
>>>> +			&r_bfree, &dontcare);
>>>>    	if (ret) {
>>>>    		str_liberror(ctx, ret, _("estimating verify work"));
>>>>    		return ret;
>>>> diff --git a/scrub/phase7.c b/scrub/phase7.c
>>>> index 96876f7c0596..bc652ab6f44a 100644
>>>> --- a/scrub/phase7.c
>>>> +++ b/scrub/phase7.c
>>>> @@ -111,8 +111,6 @@ phase7_func(
>>>>    	unsigned long long	d_bfree;
>>>>    	unsigned long long	r_blocks;
>>>>    	unsigned long long	r_bfree;
>>>> -	unsigned long long	f_files;
>>>> -	unsigned long long	f_free;
>>>>    	bool			complain;
>>>>    	int			ip;
>>>>    	int			error;
>>>> @@ -160,7 +158,7 @@ phase7_func(
>>>>    	}
>>>>    	error = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
>>>> -			&r_bfree, &f_files, &f_free);
>>>> +			&r_bfree, &used_files);
>>>>    	if (error) {
>>>>    		str_liberror(ctx, error, _("estimating verify work"));
>>>>    		return error;
>>>> @@ -177,7 +175,6 @@ phase7_func(
>>>>    	/* Report on what we found. */
>>>>    	used_data = cvt_off_fsb_to_b(&ctx->mnt, d_blocks - d_bfree);
>>>>    	used_rt = cvt_off_fsb_to_b(&ctx->mnt, r_blocks - r_bfree);
>>>> -	used_files = f_files - f_free;
>>>>    	stat_data = totalcount.dbytes;
>>>>    	stat_rt = totalcount.rbytes;
>>>>
diff mbox series

Patch

diff --git a/scrub/fscounters.c b/scrub/fscounters.c
index e9901fcdf6df..9a240d49477b 100644
--- a/scrub/fscounters.c
+++ b/scrub/fscounters.c
@@ -116,7 +116,7 @@  scrub_count_all_inodes(
 }
 
 /*
- * Estimate the number of blocks and inodes in the filesystem.  Returns 0
+ * Estimate the number of blocks and used inodes in the filesystem.  Returns 0
  * or a positive error number.
  */
 int
@@ -126,8 +126,7 @@  scrub_scan_estimate_blocks(
 	unsigned long long		*d_bfree,
 	unsigned long long		*r_blocks,
 	unsigned long long		*r_bfree,
-	unsigned long long		*f_files,
-	unsigned long long		*f_free)
+	unsigned long long		*f_files_used)
 {
 	struct xfs_fsop_counts		fc;
 	int				error;
@@ -141,8 +140,7 @@  scrub_scan_estimate_blocks(
 	*d_bfree = fc.freedata;
 	*r_blocks = ctx->mnt.fsgeom.rtblocks;
 	*r_bfree = fc.freertx;
-	*f_files = fc.allocino;
-	*f_free = fc.freeino;
+	*f_files_used = fc.allocino - fc.freeino;
 
 	return 0;
 }
diff --git a/scrub/fscounters.h b/scrub/fscounters.h
index 1fae58a6b287..13bd9967f004 100644
--- a/scrub/fscounters.h
+++ b/scrub/fscounters.h
@@ -9,7 +9,7 @@ 
 int scrub_scan_estimate_blocks(struct scrub_ctx *ctx,
 		unsigned long long *d_blocks, unsigned long long *d_bfree,
 		unsigned long long *r_blocks, unsigned long long *r_bfree,
-		unsigned long long *f_files, unsigned long long *f_free);
+		unsigned long long *f_files_used);
 int scrub_count_all_inodes(struct scrub_ctx *ctx, uint64_t *count);
 
 #endif /* XFS_SCRUB_FSCOUNTERS_H_ */
diff --git a/scrub/phase6.c b/scrub/phase6.c
index 8d976732d8e1..87828b60fbed 100644
--- a/scrub/phase6.c
+++ b/scrub/phase6.c
@@ -719,12 +719,11 @@  phase6_estimate(
 	unsigned long long	d_bfree;
 	unsigned long long	r_blocks;
 	unsigned long long	r_bfree;
-	unsigned long long	f_files;
-	unsigned long long	f_free;
+	unsigned long long	dontcare;
 	int			ret;
 
-	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree,
-				&r_blocks, &r_bfree, &f_files, &f_free);
+	ret = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
+			&r_bfree, &dontcare);
 	if (ret) {
 		str_liberror(ctx, ret, _("estimating verify work"));
 		return ret;
diff --git a/scrub/phase7.c b/scrub/phase7.c
index 96876f7c0596..bc652ab6f44a 100644
--- a/scrub/phase7.c
+++ b/scrub/phase7.c
@@ -111,8 +111,6 @@  phase7_func(
 	unsigned long long	d_bfree;
 	unsigned long long	r_blocks;
 	unsigned long long	r_bfree;
-	unsigned long long	f_files;
-	unsigned long long	f_free;
 	bool			complain;
 	int			ip;
 	int			error;
@@ -160,7 +158,7 @@  phase7_func(
 	}
 
 	error = scrub_scan_estimate_blocks(ctx, &d_blocks, &d_bfree, &r_blocks,
-			&r_bfree, &f_files, &f_free);
+			&r_bfree, &used_files);
 	if (error) {
 		str_liberror(ctx, error, _("estimating verify work"));
 		return error;
@@ -177,7 +175,6 @@  phase7_func(
 	/* Report on what we found. */
 	used_data = cvt_off_fsb_to_b(&ctx->mnt, d_blocks - d_bfree);
 	used_rt = cvt_off_fsb_to_b(&ctx->mnt, r_blocks - r_bfree);
-	used_files = f_files - f_free;
 	stat_data = totalcount.dbytes;
 	stat_rt = totalcount.rbytes;