From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Liu Subject: [PATCH 01/14] tmem: cleanup: drop pageshift from struct tmem_pool Date: Wed, 18 Dec 2013 14:52:28 +0800 Message-ID: <1387349561-27923-2-git-send-email-bob.liu@oracle.com> References: <1387349561-27923-1-git-send-email-bob.liu@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VtB0X-0006Gl-0f for xen-devel@lists.xenproject.org; Wed, 18 Dec 2013 06:53:25 +0000 Received: by mail-pa0-f50.google.com with SMTP id kl14so5583224pab.9 for ; Tue, 17 Dec 2013 22:53:21 -0800 (PST) In-Reply-To: <1387349561-27923-1-git-send-email-bob.liu@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org 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 List-Id: xen-devel@lists.xenproject.org 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 --- 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