OSDN Git Service
(root)
/
sagit-ice-cold
/
kernel_xiaomi_msm8998.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sunrpc: use seconds since boot in expiry cache
[sagit-ice-cold/kernel_xiaomi_msm8998.git]
/
net
/
sunrpc
/
cache.c
diff --git
a/net/sunrpc/cache.c
b/net/sunrpc/cache.c
index
58de76c
..
8dc1219
100644
(file)
--- a/
net/sunrpc/cache.c
+++ b/
net/sunrpc/cache.c
@@
-34,7
+34,6
@@
#include <linux/sunrpc/cache.h>
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/sunrpc/cache.h>
#include <linux/sunrpc/stats.h>
#include <linux/sunrpc/rpc_pipe_fs.h>
-#include <linux/smp_lock.h>
#define RPCDBG_FACILITY RPCDBG_CACHE
#define RPCDBG_FACILITY RPCDBG_CACHE
@@
-43,7
+42,7
@@
static void cache_revisit_request(struct cache_head *item);
static void cache_init(struct cache_head *h)
{
static void cache_init(struct cache_head *h)
{
- time_t now =
get_seconds
();
+ time_t now =
seconds_since_boot
();
h->next = NULL;
h->flags = 0;
kref_init(&h->ref);
h->next = NULL;
h->flags = 0;
kref_init(&h->ref);
@@
-53,7
+52,7
@@
static void cache_init(struct cache_head *h)
static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
{
static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
{
- return (h->expiry_time <
get_seconds
()) ||
+ return (h->expiry_time <
seconds_since_boot
()) ||
(detail->flush_time > h->last_refresh);
}
(detail->flush_time > h->last_refresh);
}
@@
-128,7
+127,7
@@
static void cache_dequeue(struct cache_detail *detail, struct cache_head *ch);
static void cache_fresh_locked(struct cache_head *head, time_t expiry)
{
head->expiry_time = expiry;
static void cache_fresh_locked(struct cache_head *head, time_t expiry)
{
head->expiry_time = expiry;
- head->last_refresh =
get_seconds
();
+ head->last_refresh =
seconds_since_boot
();
set_bit(CACHE_VALID, &head->flags);
}
set_bit(CACHE_VALID, &head->flags);
}
@@
-239,7
+238,7
@@
int cache_check(struct cache_detail *detail,
/* now see if we want to start an upcall */
refresh_age = (h->expiry_time - h->last_refresh);
/* now see if we want to start an upcall */
refresh_age = (h->expiry_time - h->last_refresh);
- age =
get_seconds
() - h->last_refresh;
+ age =
seconds_since_boot
() - h->last_refresh;
if (rqstp == NULL) {
if (rv == -EAGAIN)
if (rqstp == NULL) {
if (rv == -EAGAIN)
@@
-254,7
+253,7
@@
int cache_check(struct cache_detail *detail,
cache_revisit_request(h);
if (rv == -EAGAIN) {
set_bit(CACHE_NEGATIVE, &h->flags);
cache_revisit_request(h);
if (rv == -EAGAIN) {
set_bit(CACHE_NEGATIVE, &h->flags);
- cache_fresh_locked(h,
get_seconds
()+CACHE_NEW_EXPIRY);
+ cache_fresh_locked(h,
seconds_since_boot
()+CACHE_NEW_EXPIRY);
cache_fresh_unlocked(h, detail);
rv = -ENOENT;
}
cache_fresh_unlocked(h, detail);
rv = -ENOENT;
}
@@
-320,7
+319,7
@@
static struct cache_detail *current_detail;
static int current_index;
static void do_cache_clean(struct work_struct *work);
static int current_index;
static void do_cache_clean(struct work_struct *work);
-static
DECLARE_DELAYED_WORK(cache_cleaner, do_cache_clean)
;
+static
struct delayed_work cache_cleaner
;
static void sunrpc_init_cache_detail(struct cache_detail *cd)
{
static void sunrpc_init_cache_detail(struct cache_detail *cd)
{
@@
-389,11
+388,11
@@
static int cache_clean(void)
return -1;
}
current_detail = list_entry(next, struct cache_detail, others);
return -1;
}
current_detail = list_entry(next, struct cache_detail, others);
- if (current_detail->nextcheck >
get_seconds
())
+ if (current_detail->nextcheck >
seconds_since_boot
())
current_index = current_detail->hash_size;
else {
current_index = 0;
current_index = current_detail->hash_size;
else {
current_index = 0;
- current_detail->nextcheck =
get_seconds
()+30*60;
+ current_detail->nextcheck =
seconds_since_boot
()+30*60;
}
}
}
}
@@
-478,7
+477,7
@@
EXPORT_SYMBOL_GPL(cache_flush);
void cache_purge(struct cache_detail *detail)
{
detail->flush_time = LONG_MAX;
void cache_purge(struct cache_detail *detail)
{
detail->flush_time = LONG_MAX;
- detail->nextcheck =
get_seconds
();
+ detail->nextcheck =
seconds_since_boot
();
cache_flush();
detail->flush_time = 1;
}
cache_flush();
detail->flush_time = 1;
}
@@
-903,7
+902,7
@@
static int cache_release(struct inode *inode, struct file *filp,
filp->private_data = NULL;
kfree(rp);
filp->private_data = NULL;
kfree(rp);
- cd->last_close =
get_seconds
();
+ cd->last_close =
seconds_since_boot
();
atomic_dec(&cd->readers);
}
module_put(cd->owner);
atomic_dec(&cd->readers);
}
module_put(cd->owner);
@@
-1035,7
+1034,7
@@
int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h,
int len;
if (atomic_read(&detail->readers) == 0 &&
int len;
if (atomic_read(&detail->readers) == 0 &&
- detail->last_close <
get_seconds
() - 30) {
+ detail->last_close <
seconds_since_boot
() - 30) {
warn_no_listener(detail);
return -EINVAL;
}
warn_no_listener(detail);
return -EINVAL;
}
@@
-1220,7
+1219,8
@@
static int c_show(struct seq_file *m, void *p)
ifdebug(CACHE)
seq_printf(m, "# expiry=%ld refcnt=%d flags=%lx\n",
ifdebug(CACHE)
seq_printf(m, "# expiry=%ld refcnt=%d flags=%lx\n",
- cp->expiry_time, atomic_read(&cp->ref.refcount), cp->flags);
+ convert_to_wallclock(cp->expiry_time),
+ atomic_read(&cp->ref.refcount), cp->flags);
cache_get(cp);
if (cache_check(cd, cp, NULL))
/* cache_check does a cache_put on failure */
cache_get(cp);
if (cache_check(cd, cp, NULL))
/* cache_check does a cache_put on failure */
@@
-1286,7
+1286,7
@@
static ssize_t read_flush(struct file *file, char __user *buf,
unsigned long p = *ppos;
size_t len;
unsigned long p = *ppos;
size_t len;
- sprintf(tbuf, "%lu\n", c
d->flush_time
);
+ sprintf(tbuf, "%lu\n", c
onvert_to_wallclock(cd->flush_time)
);
len = strlen(tbuf);
if (p >= len)
return 0;
len = strlen(tbuf);
if (p >= len)
return 0;
@@
-1304,19
+1304,20
@@
static ssize_t write_flush(struct file *file, const char __user *buf,
struct cache_detail *cd)
{
char tbuf[20];
struct cache_detail *cd)
{
char tbuf[20];
- char *ep;
- long flushtime;
+ char *
bp, *
ep;
+
if (*ppos || count > sizeof(tbuf)-1)
return -EINVAL;
if (copy_from_user(tbuf, buf, count))
return -EFAULT;
tbuf[count] = 0;
if (*ppos || count > sizeof(tbuf)-1)
return -EINVAL;
if (copy_from_user(tbuf, buf, count))
return -EFAULT;
tbuf[count] = 0;
-
flushtime =
simple_strtoul(tbuf, &ep, 0);
+ simple_strtoul(tbuf, &ep, 0);
if (*ep && *ep != '\n')
return -EINVAL;
if (*ep && *ep != '\n')
return -EINVAL;
- cd->flush_time = flushtime;
- cd->nextcheck = get_seconds();
+ bp = tbuf;
+ cd->flush_time = get_expiry(&bp);
+ cd->nextcheck = seconds_since_boot();
cache_flush();
*ppos += count;
cache_flush();
*ppos += count;
@@
-1504,6
+1505,11
@@
static int create_cache_proc_entries(struct cache_detail *cd)
}
#endif
}
#endif
+void __init cache_initialize(void)
+{
+ INIT_DELAYED_WORK_DEFERRABLE(&cache_cleaner, do_cache_clean);
+}
+
int cache_register(struct cache_detail *cd)
{
int ret;
int cache_register(struct cache_detail *cd)
{
int ret;