Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364124
b: refs/heads/master
c: 9a5c596
h: refs/heads/master
v: v3
  • Loading branch information
Wanpeng Li authored and Greg Kroah-Hartman committed Apr 11, 2013
1 parent 6202118 commit d812ba6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 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: 93cc39b64c492cede5b45232387344f745c61686
refs/heads/master: 9a5c59687ad8fc6a84d97fd9cb3bbf15279793ac
32 changes: 19 additions & 13 deletions trunk/drivers/staging/zcache/ramster/ramster.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ static inline void inc_ramster_flnodes(void)
if (ramster_flnodes > ramster_flnodes_max)
ramster_flnodes_max = ramster_flnodes;
}
static inline void dec_ramster_flnodes(void)
{
ramster_flnodes = atomic_dec_return(&ramster_flnodes_atomic);
}
static ssize_t ramster_foreign_eph_pages;
static atomic_t ramster_foreign_eph_pages_atomic = ATOMIC_INIT(0);
static ssize_t ramster_foreign_eph_pages_max;
Expand All @@ -83,6 +87,11 @@ static inline void inc_ramster_foreign_eph_pages(void)
if (ramster_foreign_eph_pages > ramster_foreign_eph_pages_max)
ramster_foreign_eph_pages_max = ramster_foreign_eph_pages;
}
static inline void dec_ramster_foreign_eph_pages(void)
{
ramster_foreign_eph_pages = atomic_dec_return(
&ramster_foreign_eph_pages_atomic);
}
static ssize_t ramster_foreign_pers_pages;
static atomic_t ramster_foreign_pers_pages_atomic = ATOMIC_INIT(0);
static ssize_t ramster_foreign_pers_pages_max;
Expand All @@ -93,6 +102,11 @@ static inline void inc_ramster_foreign_pers_pages(void)
if (ramster_foreign_pers_pages > ramster_foreign_pers_pages_max)
ramster_foreign_pers_pages_max = ramster_foreign_pers_pages;
}
static inline void dec_ramster_foreign_pers_pages(void)
{
ramster_foreign_pers_pages = atomic_dec_return(
&ramster_foreign_pers_pages_atomic);
}
static ssize_t ramster_eph_pages_remoted;
static ssize_t ramster_pers_pages_remoted;
static ssize_t ramster_eph_pages_remote_failed;
Expand Down Expand Up @@ -188,10 +202,8 @@ static struct flushlist_node *ramster_flnode_alloc(struct tmem_pool *pool)
static void ramster_flnode_free(struct flushlist_node *flnode,
struct tmem_pool *pool)
{
int flnodes;

flnodes = atomic_dec_return(&ramster_flnodes_atomic);
BUG_ON(flnodes < 0);
dec_ramster_flnodes();
BUG_ON(ramster_flnodes < 0);
kmem_cache_free(ramster_flnode_cache, flnode);
}

Expand Down Expand Up @@ -484,26 +496,20 @@ void *ramster_pampd_free(void *pampd, struct tmem_pool *pool,

void ramster_count_foreign_pages(bool eph, int count)
{
int c;

BUG_ON(count != 1 && count != -1);
if (eph) {
if (count > 0) {
inc_ramster_foreign_eph_pages();
} else {
c = atomic_dec_return(&ramster_foreign_eph_pages_atomic);
WARN_ON_ONCE(c < 0);
dec_ramster_foreign_eph_pages();
WARN_ON_ONCE(ramster_foreign_eph_pages < 0);
}
ramster_foreign_eph_pages = c;
} else {
if (count > 0) {
inc_ramster_foreign_pers_pages();
} else {
c = atomic_dec_return(
&ramster_foreign_pers_pages_atomic);
WARN_ON_ONCE(c < 0);
WARN_ON_ONCE(ramster_foreign_pers_pages < 0);
}
ramster_foreign_pers_pages = c;
}
}

Expand Down

0 comments on commit d812ba6

Please sign in to comment.