Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192350
b: refs/heads/master
c: 2f50d8b
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown authored and J. Bruce Fields committed Mar 14, 2010
1 parent 61375ee commit 41f97ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3af4974eb2c7867d6e160977195dfde586d0e564
refs/heads/master: 2f50d8b63dd6e5320a9d223298df19df3502da29
13 changes: 8 additions & 5 deletions trunk/net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ static void cache_init(struct cache_head *h)
h->last_refresh = now;
}

static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
{
return (h->expiry_time < get_seconds()) ||
(detail->flush_time > h->last_refresh);
}

struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail,
struct cache_head *key, int hash)
{
Expand Down Expand Up @@ -184,9 +190,7 @@ static int cache_make_upcall(struct cache_detail *cd, struct cache_head *h)
static inline int cache_is_valid(struct cache_detail *detail, struct cache_head *h)
{
if (!test_bit(CACHE_VALID, &h->flags) ||
h->expiry_time < get_seconds())
return -EAGAIN;
else if (detail->flush_time > h->last_refresh)
cache_is_expired(detail, h))
return -EAGAIN;
else {
/* entry is valid */
Expand Down Expand Up @@ -400,8 +404,7 @@ static int cache_clean(void)
for (ch = *cp ; ch ; cp = & ch->next, ch = *cp) {
if (current_detail->nextcheck > ch->expiry_time)
current_detail->nextcheck = ch->expiry_time+1;
if (ch->expiry_time >= get_seconds() &&
ch->last_refresh >= current_detail->flush_time)
if (!cache_is_expired(current_detail, ch))
continue;

*cp = ch->next;
Expand Down

0 comments on commit 41f97ad

Please sign in to comment.