diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2010-02-28 23:20:19 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2010-03-06 15:02:01 -0500 |
commit | cf07d2ea43e5c22149435ee9002cb737eac20eca (patch) | |
tree | be8af254331398b2be20090b2b61da432229f109 /fs | |
parent | 4ea41e2de5bba756858bb40f964e3490b6d1a25c (diff) |
nfsd4: simplify references to nfsd4 lease time
Instead of accessing the lease time directly, some users call
nfs4_lease_time(), and some a macro, NFSD_LEASE_TIME, defined as
nfs4_lease_time(). Neither layer of indirection serves any purpose.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4callback.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 22 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 5 | ||||
-rw-r--r-- | fs/nfsd/nfsd.h | 5 |
5 files changed, 13 insertions, 23 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 4bc22c763de7..ed12ad40828b 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -455,7 +455,7 @@ static struct rpc_program cb_program = { | |||
455 | 455 | ||
456 | static int max_cb_time(void) | 456 | static int max_cb_time(void) |
457 | { | 457 | { |
458 | return max(NFSD_LEASE_TIME/10, (time_t)1) * HZ; | 458 | return max(nfsd4_lease/10, (time_t)1) * HZ; |
459 | } | 459 | } |
460 | 460 | ||
461 | /* Reference counting, callback cleanup, etc., all look racy as heck. | 461 | /* Reference counting, callback cleanup, etc., all look racy as heck. |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 3a20c09353ed..cc9164a34bec 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 44 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
45 | 45 | ||
46 | /* Globals */ | 46 | /* Globals */ |
47 | static time_t lease_time = 90; /* default lease time */ | 47 | time_t nfsd4_lease = 90; /* default lease time */ |
48 | static time_t user_lease_time = 90; | 48 | static time_t user_lease_time = 90; |
49 | static time_t boot_time; | 49 | static time_t boot_time; |
50 | static u32 current_ownerid = 1; | 50 | static u32 current_ownerid = 1; |
@@ -2560,9 +2560,9 @@ nfs4_laundromat(void) | |||
2560 | struct nfs4_stateowner *sop; | 2560 | struct nfs4_stateowner *sop; |
2561 | struct nfs4_delegation *dp; | 2561 | struct nfs4_delegation *dp; |
2562 | struct list_head *pos, *next, reaplist; | 2562 | struct list_head *pos, *next, reaplist; |
2563 | time_t cutoff = get_seconds() - NFSD_LEASE_TIME; | 2563 | time_t cutoff = get_seconds() - nfsd4_lease; |
2564 | time_t t, clientid_val = NFSD_LEASE_TIME; | 2564 | time_t t, clientid_val = nfsd4_lease; |
2565 | time_t u, test_val = NFSD_LEASE_TIME; | 2565 | time_t u, test_val = nfsd4_lease; |
2566 | 2566 | ||
2567 | nfs4_lock_state(); | 2567 | nfs4_lock_state(); |
2568 | 2568 | ||
@@ -2602,7 +2602,7 @@ nfs4_laundromat(void) | |||
2602 | list_del_init(&dp->dl_recall_lru); | 2602 | list_del_init(&dp->dl_recall_lru); |
2603 | unhash_delegation(dp); | 2603 | unhash_delegation(dp); |
2604 | } | 2604 | } |
2605 | test_val = NFSD_LEASE_TIME; | 2605 | test_val = nfsd4_lease; |
2606 | list_for_each_safe(pos, next, &close_lru) { | 2606 | list_for_each_safe(pos, next, &close_lru) { |
2607 | sop = list_entry(pos, struct nfs4_stateowner, so_close_lru); | 2607 | sop = list_entry(pos, struct nfs4_stateowner, so_close_lru); |
2608 | if (time_after((unsigned long)sop->so_time, (unsigned long)cutoff)) { | 2608 | if (time_after((unsigned long)sop->so_time, (unsigned long)cutoff)) { |
@@ -2672,7 +2672,7 @@ EXPIRED_STATEID(stateid_t *stateid) | |||
2672 | { | 2672 | { |
2673 | if (time_before((unsigned long)boot_time, | 2673 | if (time_before((unsigned long)boot_time, |
2674 | ((unsigned long)stateid->si_boot)) && | 2674 | ((unsigned long)stateid->si_boot)) && |
2675 | time_before((unsigned long)(stateid->si_boot + lease_time), get_seconds())) { | 2675 | time_before((unsigned long)(stateid->si_boot + nfsd4_lease), get_seconds())) { |
2676 | dprintk("NFSD: expired stateid " STATEID_FMT "!\n", | 2676 | dprintk("NFSD: expired stateid " STATEID_FMT "!\n", |
2677 | STATEID_VAL(stateid)); | 2677 | STATEID_VAL(stateid)); |
2678 | return 1; | 2678 | return 1; |
@@ -3976,7 +3976,7 @@ nfsd4_load_reboot_recovery_data(void) | |||
3976 | unsigned long | 3976 | unsigned long |
3977 | get_nfs4_grace_period(void) | 3977 | get_nfs4_grace_period(void) |
3978 | { | 3978 | { |
3979 | return max(user_lease_time, lease_time) * HZ; | 3979 | return max(user_lease_time, nfsd4_lease) * HZ; |
3980 | } | 3980 | } |
3981 | 3981 | ||
3982 | /* | 3982 | /* |
@@ -4009,7 +4009,7 @@ __nfs4_state_start(void) | |||
4009 | 4009 | ||
4010 | boot_time = get_seconds(); | 4010 | boot_time = get_seconds(); |
4011 | grace_time = get_nfs4_grace_period(); | 4011 | grace_time = get_nfs4_grace_period(); |
4012 | lease_time = user_lease_time; | 4012 | nfsd4_lease = user_lease_time; |
4013 | locks_start_grace(&nfsd4_manager); | 4013 | locks_start_grace(&nfsd4_manager); |
4014 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", | 4014 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", |
4015 | grace_time/HZ); | 4015 | grace_time/HZ); |
@@ -4036,12 +4036,6 @@ nfs4_state_start(void) | |||
4036 | return 0; | 4036 | return 0; |
4037 | } | 4037 | } |
4038 | 4038 | ||
4039 | time_t | ||
4040 | nfs4_lease_time(void) | ||
4041 | { | ||
4042 | return lease_time; | ||
4043 | } | ||
4044 | |||
4045 | static void | 4039 | static void |
4046 | __nfs4_state_shutdown(void) | 4040 | __nfs4_state_shutdown(void) |
4047 | { | 4041 | { |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index c458fb11c957..f61bd736152b 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1899,7 +1899,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
1899 | if (bmval0 & FATTR4_WORD0_LEASE_TIME) { | 1899 | if (bmval0 & FATTR4_WORD0_LEASE_TIME) { |
1900 | if ((buflen -= 4) < 0) | 1900 | if ((buflen -= 4) < 0) |
1901 | goto out_resource; | 1901 | goto out_resource; |
1902 | WRITE32(NFSD_LEASE_TIME); | 1902 | WRITE32(nfsd4_lease); |
1903 | } | 1903 | } |
1904 | if (bmval0 & FATTR4_WORD0_RDATTR_ERROR) { | 1904 | if (bmval0 & FATTR4_WORD0_RDATTR_ERROR) { |
1905 | if ((buflen -= 4) < 0) | 1905 | if ((buflen -= 4) < 0) |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 0f0e77f2012f..8bff6741b1e6 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -1203,8 +1203,6 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size) | |||
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | #ifdef CONFIG_NFSD_V4 | 1205 | #ifdef CONFIG_NFSD_V4 |
1206 | extern time_t nfs4_leasetime(void); | ||
1207 | |||
1208 | static ssize_t __write_leasetime(struct file *file, char *buf, size_t size) | 1206 | static ssize_t __write_leasetime(struct file *file, char *buf, size_t size) |
1209 | { | 1207 | { |
1210 | /* if size > 10 seconds, call | 1208 | /* if size > 10 seconds, call |
@@ -1224,8 +1222,7 @@ static ssize_t __write_leasetime(struct file *file, char *buf, size_t size) | |||
1224 | nfs4_reset_lease(lease); | 1222 | nfs4_reset_lease(lease); |
1225 | } | 1223 | } |
1226 | 1224 | ||
1227 | return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", | 1225 | return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", nfsd4_lease); |
1228 | nfs4_lease_time()); | ||
1229 | } | 1226 | } |
1230 | 1227 | ||
1231 | /** | 1228 | /** |
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index e942a1aaac92..b463093af255 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h | |||
@@ -82,7 +82,6 @@ int nfs4_state_init(void); | |||
82 | void nfsd4_free_slabs(void); | 82 | void nfsd4_free_slabs(void); |
83 | int nfs4_state_start(void); | 83 | int nfs4_state_start(void); |
84 | void nfs4_state_shutdown(void); | 84 | void nfs4_state_shutdown(void); |
85 | time_t nfs4_lease_time(void); | ||
86 | void nfs4_reset_lease(time_t leasetime); | 85 | void nfs4_reset_lease(time_t leasetime); |
87 | int nfs4_reset_recoverydir(char *recdir); | 86 | int nfs4_reset_recoverydir(char *recdir); |
88 | #else | 87 | #else |
@@ -90,7 +89,6 @@ static inline int nfs4_state_init(void) { return 0; } | |||
90 | static inline void nfsd4_free_slabs(void) { } | 89 | static inline void nfsd4_free_slabs(void) { } |
91 | static inline int nfs4_state_start(void) { return 0; } | 90 | static inline int nfs4_state_start(void) { return 0; } |
92 | static inline void nfs4_state_shutdown(void) { } | 91 | static inline void nfs4_state_shutdown(void) { } |
93 | static inline time_t nfs4_lease_time(void) { return 0; } | ||
94 | static inline void nfs4_reset_lease(time_t leasetime) { } | 92 | static inline void nfs4_reset_lease(time_t leasetime) { } |
95 | static inline int nfs4_reset_recoverydir(char *recdir) { return 0; } | 93 | static inline int nfs4_reset_recoverydir(char *recdir) { return 0; } |
96 | #endif | 94 | #endif |
@@ -229,6 +227,8 @@ extern struct timeval nfssvc_boot; | |||
229 | 227 | ||
230 | #ifdef CONFIG_NFSD_V4 | 228 | #ifdef CONFIG_NFSD_V4 |
231 | 229 | ||
230 | extern time_t nfsd4_lease; | ||
231 | |||
232 | /* before processing a COMPOUND operation, we have to check that there | 232 | /* before processing a COMPOUND operation, we have to check that there |
233 | * is enough space in the buffer for XDR encode to succeed. otherwise, | 233 | * is enough space in the buffer for XDR encode to succeed. otherwise, |
234 | * we might process an operation with side effects, and be unable to | 234 | * we might process an operation with side effects, and be unable to |
@@ -247,7 +247,6 @@ extern struct timeval nfssvc_boot; | |||
247 | #define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */ | 247 | #define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */ |
248 | #define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */ | 248 | #define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */ |
249 | 249 | ||
250 | #define NFSD_LEASE_TIME (nfs4_lease_time()) | ||
251 | #define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */ | 250 | #define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */ |
252 | 251 | ||
253 | /* | 252 | /* |