@@ -42,7 +42,7 @@ static void cache_revisit_request(struct cache_head *item);
4242
4343static void cache_init (struct cache_head * h )
4444{
45- time_t now = get_seconds ();
45+ time_t now = seconds_since_boot ();
4646 h -> next = NULL ;
4747 h -> flags = 0 ;
4848 kref_init (& h -> ref );
@@ -52,7 +52,7 @@ static void cache_init(struct cache_head *h)
5252
5353static inline int cache_is_expired (struct cache_detail * detail , struct cache_head * h )
5454{
55- return (h -> expiry_time < get_seconds ()) ||
55+ return (h -> expiry_time < seconds_since_boot ()) ||
5656 (detail -> flush_time > h -> last_refresh );
5757}
5858
@@ -127,7 +127,7 @@ static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch);
127127static void cache_fresh_locked (struct cache_head * head , time_t expiry )
128128{
129129 head -> expiry_time = expiry ;
130- head -> last_refresh = get_seconds ();
130+ head -> last_refresh = seconds_since_boot ();
131131 set_bit (CACHE_VALID , & head -> flags );
132132}
133133
@@ -238,7 +238,7 @@ int cache_check(struct cache_detail *detail,
238238
239239 /* now see if we want to start an upcall */
240240 refresh_age = (h -> expiry_time - h -> last_refresh );
241- age = get_seconds () - h -> last_refresh ;
241+ age = seconds_since_boot () - h -> last_refresh ;
242242
243243 if (rqstp == NULL ) {
244244 if (rv == - EAGAIN )
@@ -253,7 +253,7 @@ int cache_check(struct cache_detail *detail,
253253 cache_revisit_request (h );
254254 if (rv == - EAGAIN ) {
255255 set_bit (CACHE_NEGATIVE , & h -> flags );
256- cache_fresh_locked (h , get_seconds ()+ CACHE_NEW_EXPIRY );
256+ cache_fresh_locked (h , seconds_since_boot ()+ CACHE_NEW_EXPIRY );
257257 cache_fresh_unlocked (h , detail );
258258 rv = - ENOENT ;
259259 }
@@ -388,11 +388,11 @@ static int cache_clean(void)
388388 return -1 ;
389389 }
390390 current_detail = list_entry (next , struct cache_detail , others );
391- if (current_detail -> nextcheck > get_seconds ())
391+ if (current_detail -> nextcheck > seconds_since_boot ())
392392 current_index = current_detail -> hash_size ;
393393 else {
394394 current_index = 0 ;
395- current_detail -> nextcheck = get_seconds ()+ 30 * 60 ;
395+ current_detail -> nextcheck = seconds_since_boot ()+ 30 * 60 ;
396396 }
397397 }
398398
@@ -477,7 +477,7 @@ EXPORT_SYMBOL_GPL(cache_flush);
477477void cache_purge (struct cache_detail * detail )
478478{
479479 detail -> flush_time = LONG_MAX ;
480- detail -> nextcheck = get_seconds ();
480+ detail -> nextcheck = seconds_since_boot ();
481481 cache_flush ();
482482 detail -> flush_time = 1 ;
483483}
@@ -902,7 +902,7 @@ static int cache_release(struct inode *inode, struct file *filp,
902902 filp -> private_data = NULL ;
903903 kfree (rp );
904904
905- cd -> last_close = get_seconds ();
905+ cd -> last_close = seconds_since_boot ();
906906 atomic_dec (& cd -> readers );
907907 }
908908 module_put (cd -> owner );
@@ -1034,7 +1034,7 @@ int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h,
10341034 int len ;
10351035
10361036 if (atomic_read (& detail -> readers ) == 0 &&
1037- detail -> last_close < get_seconds () - 30 ) {
1037+ detail -> last_close < seconds_since_boot () - 30 ) {
10381038 warn_no_listener (detail );
10391039 return - EINVAL ;
10401040 }
@@ -1219,7 +1219,8 @@ static int c_show(struct seq_file *m, void *p)
12191219
12201220 ifdebug (CACHE )
12211221 seq_printf (m , "# expiry=%ld refcnt=%d flags=%lx\n" ,
1222- cp -> expiry_time , atomic_read (& cp -> ref .refcount ), cp -> flags );
1222+ convert_to_wallclock (cp -> expiry_time ),
1223+ atomic_read (& cp -> ref .refcount ), cp -> flags );
12231224 cache_get (cp );
12241225 if (cache_check (cd , cp , NULL ))
12251226 /* cache_check does a cache_put on failure */
@@ -1285,7 +1286,7 @@ static ssize_t read_flush(struct file *file, char __user *buf,
12851286 unsigned long p = * ppos ;
12861287 size_t len ;
12871288
1288- sprintf (tbuf , "%lu\n" , cd -> flush_time );
1289+ sprintf (tbuf , "%lu\n" , convert_to_wallclock ( cd -> flush_time ) );
12891290 len = strlen (tbuf );
12901291 if (p >= len )
12911292 return 0 ;
@@ -1303,19 +1304,20 @@ static ssize_t write_flush(struct file *file, const char __user *buf,
13031304 struct cache_detail * cd )
13041305{
13051306 char tbuf [20 ];
1306- char * ep ;
1307- long flushtime ;
1307+ char * bp , * ep ;
1308+
13081309 if (* ppos || count > sizeof (tbuf )- 1 )
13091310 return - EINVAL ;
13101311 if (copy_from_user (tbuf , buf , count ))
13111312 return - EFAULT ;
13121313 tbuf [count ] = 0 ;
1313- flushtime = simple_strtoul (tbuf , & ep , 0 );
1314+ simple_strtoul (tbuf , & ep , 0 );
13141315 if (* ep && * ep != '\n' )
13151316 return - EINVAL ;
13161317
1317- cd -> flush_time = flushtime ;
1318- cd -> nextcheck = get_seconds ();
1318+ bp = tbuf ;
1319+ cd -> flush_time = get_expiry (& bp );
1320+ cd -> nextcheck = seconds_since_boot ();
13191321 cache_flush ();
13201322
13211323 * ppos += count ;
0 commit comments