2020-11-20 22:41:16

by J. Bruce Fields

[permalink] [raw]
Subject: [PATCH 3/8] nfsd: minor nfsd4_change_attribute cleanup

From: "J. Bruce Fields" <[email protected]>

Minor cleanup, no change in behavior

Signed-off-by: J. Bruce Fields <[email protected]>
---
fs/nfsd/nfsfh.h | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
index 3faf5974fa4e..45bd776290d5 100644
--- a/fs/nfsd/nfsfh.h
+++ b/fs/nfsd/nfsfh.h
@@ -259,19 +259,16 @@ fh_clear_wcc(struct svc_fh *fhp)
static inline u64 nfsd4_change_attribute(struct kstat *stat,
struct inode *inode)
{
- u64 chattr;
-
if (IS_I_VERSION(inode)) {
+ u64 chattr;
+
chattr = stat->ctime.tv_sec;
chattr <<= 30;
chattr += stat->ctime.tv_nsec;
chattr += inode_query_iversion(inode);
- } else {
- chattr = cpu_to_be32(stat->ctime.tv_sec);
- chattr <<= 32;
- chattr += cpu_to_be32(stat->ctime.tv_nsec);
- }
- return chattr;
+ return chattr;
+ } else
+ return time_to_chattr(&stat->ctime);
}

extern void fill_pre_wcc(struct svc_fh *fhp);
--
2.28.0


2020-11-21 00:35:12

by Jeffrey Layton

[permalink] [raw]
Subject: Re: [PATCH 3/8] nfsd: minor nfsd4_change_attribute cleanup

On Fri, 2020-11-20 at 17:39 -0500, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <[email protected]>
>
> Minor cleanup, no change in behavior
>
> Signed-off-by: J. Bruce Fields <[email protected]>
> ---
>  fs/nfsd/nfsfh.h | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
> index 3faf5974fa4e..45bd776290d5 100644
> --- a/fs/nfsd/nfsfh.h
> +++ b/fs/nfsd/nfsfh.h
> @@ -259,19 +259,16 @@ fh_clear_wcc(struct svc_fh *fhp)
>  static inline u64 nfsd4_change_attribute(struct kstat *stat,
>   struct inode *inode)
>  {
> - u64 chattr;
> -
>   if (IS_I_VERSION(inode)) {
> + u64 chattr;
> +
>   chattr = stat->ctime.tv_sec;
>   chattr <<= 30;
>   chattr += stat->ctime.tv_nsec;
>   chattr += inode_query_iversion(inode);
> - } else {
> - chattr = cpu_to_be32(stat->ctime.tv_sec);
> - chattr <<= 32;
> - chattr += cpu_to_be32(stat->ctime.tv_nsec);
> - }
> - return chattr;
> + return chattr;
> + } else
> + return time_to_chattr(&stat->ctime);
>  }
>  
>
>  extern void fill_pre_wcc(struct svc_fh *fhp);

I'd just fold this one into 2/8.
--
Jeff Layton <[email protected]>