From: Bob Liu <lliubbo@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: keir@xen.org, ian.campbell@citrix.com, JBeulich@suse.com
Subject: [PATCH 07/16] tmem: drop unneeded is_ephemeral() and is_private()
Date: Wed, 20 Nov 2013 16:46:16 +0800 [thread overview]
Message-ID: <1384937185-24749-7-git-send-email-bob.liu@oracle.com> (raw)
In-Reply-To: <1384937185-24749-1-git-send-email-bob.liu@oracle.com>
Can use !is_persistent() and !is_shared() to replace them directly.
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
xen/common/tmem.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 1c9dd5a..f37e054 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -126,9 +126,7 @@ struct tmem_pool {
};
#define is_persistent(_p) (_p->persistent)
-#define is_ephemeral(_p) (!(_p->persistent))
#define is_shared(_p) (_p->shared)
-#define is_private(_p) (!(_p->shared))
struct oid {
uint64_t oid[3];
@@ -604,7 +602,7 @@ static void pgp_free(struct tmem_page_descriptor *pgp, int from_delete)
ASSERT(pgp_lookup_in_obj(pgp->us.obj,pgp->index) == NULL);
ASSERT(pgp->us.obj->pool != NULL);
pool = pgp->us.obj->pool;
- if ( is_ephemeral(pool) )
+ if ( !is_persistent(pool) )
{
ASSERT(list_empty(&pgp->global_eph_pages));
ASSERT(list_empty(&pgp->us.client_eph_pages));
@@ -643,7 +641,7 @@ static void pgp_delist(struct tmem_page_descriptor *pgp, bool_t no_eph_lock)
ASSERT(pgp->us.obj->pool != NULL);
client = pgp->us.obj->pool->client;
ASSERT(client != NULL);
- if ( is_ephemeral(pgp->us.obj->pool) )
+ if ( !is_persistent(pgp->us.obj->pool) )
{
if ( !no_eph_lock )
tmem_spin_lock(&eph_lists_spinlock);
@@ -1596,7 +1594,7 @@ copy_uncompressed:
}
insert_page:
- if ( is_ephemeral(pool) )
+ if ( !is_persistent(pool) )
{
tmem_spin_lock(&eph_lists_spinlock);
list_add_tail(&pgp->global_eph_pages,
@@ -1696,9 +1694,9 @@ static int do_tmem_get(struct tmem_pool *pool, struct oid *oidp, uint32_t index,
if ( rc <= 0 )
goto bad_copy;
- if ( is_ephemeral(pool) )
+ if ( !is_persistent(pool) )
{
- if ( is_private(pool) )
+ if ( !is_shared(pool) )
{
pgp_delete(pgp,0);
if ( obj->pgp_count == 0 )
@@ -1724,10 +1722,10 @@ static int do_tmem_get(struct tmem_pool *pool, struct oid *oidp, uint32_t index,
tmem_spin_unlock(&obj->obj_spinlock);
}
pool->found_gets++;
- if ( is_ephemeral(pool) )
- client->succ_eph_gets++;
- else
+ if ( is_persistent(pool) )
client->succ_pers_gets++;
+ else
+ client->succ_eph_gets++;
return 1;
bad_copy:
@@ -2348,7 +2346,7 @@ static int tmemc_save_get_next_page(int cli_id, uint32_t pool_id,
struct tmem_handle h;
unsigned int pagesize;
- if ( pool == NULL || is_ephemeral(pool) )
+ if ( pool == NULL || !is_persistent(pool) )
return -1;
pagesize = 1 << (pool->pageshift + 12);
--
1.7.10.4
next prev parent reply other threads:[~2013-11-20 8:48 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 8:46 [PATCH 01/16] tmem: cleanup: drop some debug code Bob Liu
2013-11-20 8:46 ` [PATCH 02/16] tmem: cleanup: drop useless function 'tmem_copy_page' Bob Liu
2013-11-20 8:46 ` [PATCH 03/16] tmem: cleanup: rm unused tmem_op Bob Liu
2013-11-22 17:38 ` Konrad Rzeszutek Wilk
2013-11-25 9:43 ` Jan Beulich
2013-11-25 9:52 ` Ian Campbell
2013-11-25 9:58 ` Jan Beulich
2013-11-25 16:37 ` Konrad Rzeszutek Wilk
2013-11-25 16:40 ` Ian Campbell
2013-11-25 17:09 ` Konrad Rzeszutek Wilk
2013-11-25 17:12 ` Ian Campbell
2013-11-25 19:56 ` Konrad Rzeszutek Wilk
2013-11-26 8:56 ` Bob Liu
2013-11-20 8:46 ` [PATCH 04/16] tmem: cleanup: rm unneeded parameters from put path Bob Liu
2013-11-22 17:54 ` Konrad Rzeszutek Wilk
2013-11-26 8:22 ` Bob Liu
2013-11-20 8:46 ` [PATCH 05/16] tmem: cleanup: rm unneeded parameters from get path Bob Liu
2013-11-22 17:55 ` Konrad Rzeszutek Wilk
2013-11-20 8:46 ` [PATCH 06/16] tmem: cleanup: reorg do_tmem_put() Bob Liu
2013-11-22 18:04 ` Konrad Rzeszutek Wilk
2013-11-20 8:46 ` Bob Liu [this message]
2013-11-20 8:46 ` [PATCH 08/16] tmem: cleanup: rm useless EXPORT/FORWARD define Bob Liu
2013-11-22 18:05 ` Konrad Rzeszutek Wilk
2013-11-20 8:46 ` [PATCH 09/16] tmem: cleanup: drop tmemc_list() temporary Bob Liu
2013-11-22 18:07 ` Konrad Rzeszutek Wilk
2013-11-26 8:28 ` Bob Liu
2013-11-22 21:00 ` Konrad Rzeszutek Wilk
2013-11-20 8:46 ` [PATCH 10/16] tmem: cleanup: drop runtime statistics Bob Liu
2013-11-22 18:08 ` Konrad Rzeszutek Wilk
2013-11-20 8:46 ` [PATCH 11/16] tmem: cleanup: drop tmem_lock_all Bob Liu
2013-11-20 8:46 ` [PATCH 12/16] tmem: cleanup: refactor the alloc/free path Bob Liu
2013-11-20 8:46 ` [PATCH 13/16] tmem: cleanup: __tmem_alloc_page: drop unneed parameters Bob Liu
2013-11-22 18:17 ` Konrad Rzeszutek Wilk
2013-11-26 8:41 ` Bob Liu
2013-11-26 17:38 ` Konrad Rzeszutek Wilk
2013-11-20 8:46 ` [PATCH 14/16] tmem: cleanup: drop useless functions from head file Bob Liu
2013-11-27 14:38 ` Andrew Cooper
2013-11-27 14:52 ` Konrad Rzeszutek Wilk
2013-11-27 14:59 ` Andrew Cooper
2013-11-27 15:55 ` Jan Beulich
2013-11-20 8:46 ` [PATCH 15/16] tmem: refator function tmem_ensure_avail_pages() Bob Liu
2013-11-22 18:22 ` Konrad Rzeszutek Wilk
2013-11-20 8:46 ` [PATCH 16/16] tmem: cleanup: rename tmem_relinquish_npages() Bob Liu
2013-11-20 9:08 ` [PATCH 01/16] tmem: cleanup: drop some debug code Jan Beulich
2013-11-20 9:19 ` Bob Liu
2013-11-20 9:25 ` Jan Beulich
2013-11-20 13:51 ` Konrad Rzeszutek Wilk
2013-11-20 14:21 ` Jan Beulich
2013-11-20 18:46 ` Konrad Rzeszutek Wilk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384937185-24749-7-git-send-email-bob.liu@oracle.com \
--to=lliubbo@gmail.com \
--cc=JBeulich@suse.com \
--cc=ian.campbell@citrix.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).