Re: [PATCH] nfsd: helper for laundromat expiry calculations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 03, 2021 at 09:59:48PM +0000, Chuck Lever wrote:
> 
> 
> > On Mar 3, 2021, at 4:55 PM, Bruce Fields <bfields@xxxxxxxxxxxx> wrote:
> > 
> > On Wed, Mar 03, 2021 at 09:35:18PM +0000, Chuck Lever wrote:
> >> 
> >> 
> >>> On Mar 2, 2021, at 10:46 AM, Bruce Fields <bfields@xxxxxxxxxxxx> wrote:
> >>> 
> >>> From: "J. Bruce Fields" <bfields@xxxxxxxxxx>
> >>> 
> >>> We do this same logic repeatedly, and it's easy to get the sense of the
> >>> comparison wrong.
> >>> 
> >>> Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx>
> >>> ---
> >>> fs/nfsd/nfs4state.c | 49 +++++++++++++++++++++++++--------------------
> >>> 1 file changed, 27 insertions(+), 22 deletions(-)
> >>> 
> >>> My original version of this patch... actually got the sense of the
> >>> comparison wrong!
> >>> 
> >>> Now actually tested.
> >>> 
> >>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> >>> index 61552e89bd89..8e6938902b49 100644
> >>> --- a/fs/nfsd/nfs4state.c
> >>> +++ b/fs/nfsd/nfs4state.c
> >>> @@ -5363,6 +5363,22 @@ static bool clients_still_reclaiming(struct nfsd_net *nn)
> >>> 	return true;
> >>> }
> >>> 
> >>> +struct laundry_time {
> >>> +	time64_t cutoff;
> >>> +	time64_t new_timeo;
> >>> +};
> >>> +
> >>> +bool state_expired(struct laundry_time *lt, time64_t last_refresh)
> >>> +{
> >>> +	time64_t time_remaining;
> >>> +
> >>> +	if (last_refresh < lt->cutoff)
> >>> +		return true;
> >>> +	time_remaining = last_refresh - lt->cutoff;
> >>> +	lt->new_timeo = min(lt->new_timeo, time_remaining);
> >>> +	return false;
> >>> +}
> >>> +
> >> 
> >> /home/cel/src/linux/linux/fs/nfsd/nfs4state.c:5371:6: warning: no previous prototype for ‘state_expired’ [-Wmissing-prototypes]
> >> 5371 | bool state_expired(struct laundry_time *lt, time64_t last_refresh)
> >>      |      ^~~~~~~~~~~~~
> >> 
> >> Should this new helper be static, or instead perhaps these items
> >> should be defined in a header file.
> > 
> > Whoops, should have been static, yes, do you want to fix it up or should
> > I resend?
> 
> I've corrected it in the for-next topic branch in
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git

Thank you!

--b.



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux