xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bob Liu <lliubbo@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: james.harper@bendigoit.com.au, keir@xen.org,
	ian.campbell@citrix.com, andrew.cooper3@citrix.com,
	JBeulich@suse.com
Subject: [PATCH 01/14] tmem: cleanup: drop pageshift from struct tmem_pool
Date: Wed, 18 Dec 2013 14:52:28 +0800	[thread overview]
Message-ID: <1387349561-27923-2-git-send-email-bob.liu@oracle.com> (raw)
In-Reply-To: <1387349561-27923-1-git-send-email-bob.liu@oracle.com>

pool->pageshift is used to calculate the pagesize, it can be dropped because
the pagesize is always the same as PAGE_SIZE.
This patch remove pageshift from struct tmem_pool and use POOL_PAGESHIFT and
PAGE_SIZE instead.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
 xen/common/tmem.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index d9e912b..aa8e6f5 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -88,6 +88,7 @@ struct share_list {
     struct client *client;
 };
 
+#define POOL_PAGESHIFT (PAGE_SHIFT - 12)
 #define OBJ_HASH_BUCKETS 256 /* must be power of two */
 #define OBJ_HASH_BUCKETS_MASK (OBJ_HASH_BUCKETS-1)
 
@@ -95,7 +96,6 @@ struct tmem_pool {
     bool_t shared;
     bool_t persistent;
     bool_t is_dying;
-    int pageshift; /* 0 == 2**12 */
     struct list_head pool_list;
     struct client *client;
     uint64_t uuid[2]; /* 0 for private, non-zero for shared */
@@ -1042,7 +1042,6 @@ static struct tmem_pool * pool_alloc(void)
     pool->objnode_count = pool->objnode_count_max = 0;
     atomic_set(&pool->pgp_count,0);
     pool->obj_count = 0; pool->shared_count = 0;
-    pool->pageshift = PAGE_SHIFT - 12;
     pool->good_puts = pool->puts = pool->dup_puts_flushed = 0;
     pool->dup_puts_replaced = pool->no_mem_puts = 0;
     pool->found_gets = pool->gets = 0;
@@ -2355,7 +2354,7 @@ static int tmemc_save_subop(int cli_id, uint32_t pool_id,
              break;
          rc = (pool->persistent ? TMEM_POOL_PERSIST : 0) |
               (pool->shared ? TMEM_POOL_SHARED : 0) |
-              (pool->pageshift << TMEM_POOL_PAGESIZE_SHIFT) |
+              (POOL_PAGESHIFT << TMEM_POOL_PAGESIZE_SHIFT) |
               (TMEM_SPEC_VERSION << TMEM_POOL_VERSION_SHIFT);
         break;
     case TMEMC_SAVE_GET_POOL_NPAGES:
@@ -2395,13 +2394,11 @@ static int tmemc_save_get_next_page(int cli_id, uint32_t pool_id,
     struct oid oid;
     int ret = 0;
     struct tmem_handle h;
-    unsigned int pagesize;
 
     if ( pool == NULL || !is_persistent(pool) )
         return -1;
 
-    pagesize = 1 << (pool->pageshift + 12);
-    if ( bufsize < pagesize + sizeof(struct tmem_handle) )
+    if ( bufsize < PAGE_SIZE + sizeof(struct tmem_handle) )
         return -ENOMEM;
 
     spin_lock(&pers_lists_spinlock);
-- 
1.7.10.4

  reply	other threads:[~2013-12-18  6:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18  6:52 [PATCH 00/14] xen: new patches for tmem cleanup Bob Liu
2013-12-18  6:52 ` Bob Liu [this message]
2013-12-18  6:52 ` [PATCH 02/14] tmem: refactor function do_tmem_op() Bob Liu
2013-12-18  6:52 ` [PATCH 03/14] tmem: cleanup: drop unneeded client/pool initialization Bob Liu
2013-12-18  6:52 ` [PATCH 04/14] tmem: bugfix in obj allocate path Bob Liu
2013-12-18  6:52 ` [PATCH 05/14] tmem: cleanup: remove unneed parameter for pgp_delist() Bob Liu
2013-12-18  6:52 ` [PATCH 06/14] tmem: cleanup: remove unneed parameter for pgp_free() Bob Liu
2013-12-18  6:52 ` [PATCH 07/14] tmem: cleanup the pgp free path Bob Liu
2013-12-18  6:52 ` [PATCH 08/14] tmem: drop oneline function client_freeze() Bob Liu
2013-12-18  6:52 ` [PATCH 09/14] tmem: remove unneeded parameters for obj destroy Bob Liu
2013-12-18  6:52 ` [PATCH 10/14] tmem: cleanup: drop global_pool_list Bob Liu
2013-12-18  6:52 ` [PATCH 11/14] tmem: fix the return value of tmemc_set_var() Bob Liu
2013-12-18  6:52 ` [PATCH 12/14] tmem: cleanup: refactor function tmemc_shared_pool_auth() Bob Liu
2013-12-18  6:52 ` [PATCH 13/14] tmem: reorg the shared pool allocate path Bob Liu
2013-12-18  6:52 ` [PATCH 14/14] tmem: remove useless parameter from client and pool flush Bob Liu

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=1387349561-27923-2-git-send-email-bob.liu@oracle.com \
    --to=lliubbo@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=james.harper@bendigoit.com.au \
    --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).