Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324982
b: refs/heads/master
c: 7892e56
h: refs/heads/master
v: v3
  • Loading branch information
Dan Magenheimer authored and Greg Kroah-Hartman committed Sep 8, 2012
1 parent 9f065fe commit 199c5e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 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: 20659455402fca01a92de7a70a45f43785804fa7
refs/heads/master: 7892e560d463a556664f82188602ab3425533049
12 changes: 9 additions & 3 deletions trunk/drivers/staging/ramster/zcache-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,18 @@ static struct page *zcache_alloc_page(void)
return page;
}

#ifdef FRONTSWAP_HAS_UNUSE
static void zcache_unacct_page(void)
{
zcache_pageframes_freed =
atomic_inc_return(&zcache_pageframes_freed_atomic);
}
#endif

static void zcache_free_page(struct page *page)
{
long curr_pageframes;
static long max_pageframes, min_pageframes, total_freed;
static long max_pageframes, min_pageframes;

if (page == NULL)
BUG();
Expand Down Expand Up @@ -965,9 +967,10 @@ static struct page *zcache_evict_eph_pageframe(void)
return page;
}

#ifdef FRONTSWAP_HAS_UNUSE
static void unswiz(struct tmem_oid oid, u32 index,
unsigned *type, pgoff_t *offset);
#ifdef FRONTSWAP_HAS_UNUSE

/*
* Choose an LRU persistent pageframe and attempt to "unuse" it by
* calling frontswap_unuse on both zpages.
Expand Down Expand Up @@ -1060,7 +1063,9 @@ static int shrink_zcache_memory(struct shrinker *shrink,
int nr_evict = 0;
int nr_unuse = 0;
struct page *page;
#ifdef FRONTSWAP_HAS_UNUSE
int unuse_ret;
#endif

if (nr <= 0)
goto skip_evict;
Expand Down Expand Up @@ -1519,13 +1524,15 @@ static inline struct tmem_oid oswiz(unsigned type, u32 ind)
return oid;
}

#ifdef FRONTSWAP_HAS_UNUSE
static void unswiz(struct tmem_oid oid, u32 index,
unsigned *type, pgoff_t *offset)
{
*type = (unsigned)(oid.oid[0] >> SWIZ_BITS);
*offset = (pgoff_t)((index << SWIZ_BITS) |
(oid.oid[0] & SWIZ_MASK));
}
#endif

static int zcache_frontswap_put_page(unsigned type, pgoff_t offset,
struct page *page)
Expand All @@ -1535,7 +1542,6 @@ static int zcache_frontswap_put_page(unsigned type, pgoff_t offset,
struct tmem_oid oid = oswiz(type, ind);
int ret = -1;
unsigned long flags;
int unuse_ret;

BUG_ON(!PageLocked(page));
if (!disable_frontswap_ignore_nonactive && !PageWasActive(page)) {
Expand Down

0 comments on commit 199c5e8

Please sign in to comment.