From patchwork Mon Nov 12 15:44:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Battersby X-Patchwork-Id: 10678871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1B0414E2 for ; Mon, 12 Nov 2018 15:44:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF02A2929B for ; Mon, 12 Nov 2018 15:44:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D305929857; Mon, 12 Nov 2018 15:44:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54C602929B for ; Mon, 12 Nov 2018 15:44:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7326D6B029A; Mon, 12 Nov 2018 10:44:05 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6E0876B029C; Mon, 12 Nov 2018 10:44:05 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D0586B029D; Mon, 12 Nov 2018 10:44:05 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 350C86B029A for ; Mon, 12 Nov 2018 10:44:05 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id f22so24037888qkm.11 for ; Mon, 12 Nov 2018 07:44:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:subject :to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=gisvINFkS/iGnzT4KigfhtklRZpszQjoE1eqkyrTQiY=; b=MLstLXz3elgUqaE7jxw4aUPdvH5QRIdTXUYRCpfHNMYc6Rb/r5gdrYQR8ef/Q8WfH+ eXk6J3Dlifng+8vZ+2D9BfEd7GUi77sSRs+Ej5eXbBac+k4Qyrr2LE7yB1X4iXS93AoL 25PsXQSegFRanym8naF/P+2XEyJXa04QTpWtWiDlHmekUcSjHerivDpCeWx0EquDpULO wX/MdKPEZ1IlkrMr0MxB+ds8DwQgMiG4xfEGcM5RP6Ho4biTkRBOVp0YP1oPeuGjLxuF GvwgMYPe/EtDwKjshkPKUZv9tnDYjkBG73GLUZmwV4UvUyyPRS1VAnfnh34OHdVMHm58 0lsA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of btv1==854ac0a7dab==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==854ac0a7dab==tonyb@cybernetics.com" X-Gm-Message-State: AGRZ1gKysEaV/DnpXbocOAhYCHHe4yuaqoUSo2K1l5rgjcKvS2gC7BoN ww1o78hddPV1POMuwJuSAgLGIX1gB2/k5nu00RYZNBVIoko83ORWkC5WN/eEswfVn9y6Lw5ALOs hDXH2dbpqnt1G1NZ0/tSqUZ6N5pFK9bSI6vYULO0PbH9Qggsm7v9D0paFaDesGEhttQ== X-Received: by 2002:a37:77c5:: with SMTP id s188mr1319846qkc.174.1542037444953; Mon, 12 Nov 2018 07:44:04 -0800 (PST) X-Google-Smtp-Source: AJdET5eN0OcNLOr4rr2SgZkullx6UsVwfExOYLRnna5im9tNdmiOr08sWKyMJy3rtGOkNM+0yd0M X-Received: by 2002:a37:77c5:: with SMTP id s188mr1319806qkc.174.1542037444259; Mon, 12 Nov 2018 07:44:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542037444; cv=none; d=google.com; s=arc-20160816; b=T9nmvWLEAJUqjp7PUu3boL/C3a6Rlp28ygqbz+T7E21yrx78MyOb8bTeIVln5qH+M9 PTNU9laLqWFyqqblDn5nzB2dc4DkkIdbtKtOtVobIMjoqxxq5e/d718eesDzmpUB/Qbv jTl6FgRmleaTCMQkCAJZYvoGJ08r0bOVUkARK6kSUjecGRsIjUojHJ9orud/iBMXEYMq bMO7Y9XqqvYmWwTjTGE71+IEdGag320uJmXHpvUpApy0nRWhyye5sk0CQMjpjZFLdYw0 JJoR4kJYB/6Mp1fMqdh+8ffPl/sglsZUAM+grAyMAbcGYZ3MU12+AfEVsQ4UpaBHRLgS zBaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:content-transfer-encoding:mime-version:user-agent :date:message-id:cc:to:subject:from; bh=gisvINFkS/iGnzT4KigfhtklRZpszQjoE1eqkyrTQiY=; b=VHHDfiP5gI4LFj74o7giU9J18JMBSGnRvqVlpSRD2bMJqmzhbI6/PwFdbUbT1AG9wb w0J0TgE/AaGrmTGggsD4NhdisvcZJqeP7auNgDVeBtQiAF+GRTAQfo3Ygi75nI70rLYY ieztshn+jDOZEiV6iSjHq0aSj/oT/UMS13sOch4mo5qLtDd+hGDDQThIITHmfQ1i2wZ3 Hz/erxWDrTpK3/FPNRh/mmmpTE9Ryl03m+Ea6b/iVOaT79z8zEuAg52glSlYHG5T8hCg YZ4ieQa1tvImr1IqipDyothvozhDosv7jnvq8yuMGzAUfyDD52tDOIvx1oRaHF7lC2/2 j+ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of btv1==854ac0a7dab==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==854ac0a7dab==tonyb@cybernetics.com" Received: from mail.cybernetics.com (mail.cybernetics.com. [173.71.130.66]) by mx.google.com with ESMTPS id i21si2088384qtp.305.2018.11.12.07.44.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 07:44:04 -0800 (PST) Received-SPF: pass (google.com: domain of btv1==854ac0a7dab==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) client-ip=173.71.130.66; Authentication-Results: mx.google.com; spf=pass (google.com: domain of btv1==854ac0a7dab==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==854ac0a7dab==tonyb@cybernetics.com" X-ASG-Debug-ID: 1542037442-0fb3b01fb3add560001-v9ZeMO Received: from cybernetics.com ([10.157.1.126]) by mail.cybernetics.com with ESMTP id ue3TjEock6lPxDAA (version=SSLv3 cipher=DES-CBC3-SHA bits=112 verify=NO); Mon, 12 Nov 2018 10:44:02 -0500 (EST) X-Barracuda-Envelope-From: tonyb@cybernetics.com X-ASG-Whitelist: Client Received: from [10.157.2.224] (account tonyb HELO [192.168.200.1]) by cybernetics.com (CommuniGate Pro SMTP 5.1.14) with ESMTPSA id 8529355; Mon, 12 Nov 2018 10:44:02 -0500 From: Tony Battersby Subject: [PATCH v4 5/9] dmapool: rename fields in dma_page To: Matthew Wilcox , Christoph Hellwig , Marek Szyprowski , iommu@lists.linux-foundation.org, linux-mm@kvack.org X-ASG-Orig-Subj: [PATCH v4 5/9] dmapool: rename fields in dma_page Cc: "linux-scsi@vger.kernel.org" Message-ID: <4ac76051-74fc-0a70-4d17-7618823d24c3@cybernetics.com> Date: Mon, 12 Nov 2018 10:44:02 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-US X-Barracuda-Connect: UNKNOWN[10.157.1.126] X-Barracuda-Start-Time: 1542037442 X-Barracuda-Encrypted: DES-CBC3-SHA X-Barracuda-URL: https://10.157.1.122:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 3346 X-Virus-Scanned: by bsmtpd at cybernetics.com X-Barracuda-BRTS-Status: 1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Rename fields in 'struct dma_page' in preparation for moving them into 'struct page'. No functional changes. in_use -> dma_in_use offset -> dma_free_off Signed-off-by: Tony Battersby Acked-by: Matthew Wilcox --- linux/mm/dmapool.c.orig 2018-08-03 17:46:13.000000000 -0400 +++ linux/mm/dmapool.c 2018-08-03 17:46:24.000000000 -0400 @@ -65,8 +65,8 @@ struct dma_page { /* cacheable header f struct list_head dma_list; void *vaddr; dma_addr_t dma; - unsigned int in_use; - unsigned int offset; + unsigned int dma_in_use; + unsigned int dma_free_off; }; static DEFINE_MUTEX(pools_lock); @@ -101,7 +101,7 @@ show_pools(struct device *dev, struct de &pool->page_list[list_idx], dma_list) { pages++; - blocks += page->in_use; + blocks += page->dma_in_use; } } spin_unlock_irq(&pool->lock); @@ -248,8 +248,8 @@ static struct dma_page *pool_alloc_page( memset(page->vaddr, POOL_POISON_FREED, pool->allocation); #endif pool_initialise_page(pool, page); - page->in_use = 0; - page->offset = 0; + page->dma_in_use = 0; + page->dma_free_off = 0; } else { kfree(page); page = NULL; @@ -259,7 +259,7 @@ static struct dma_page *pool_alloc_page( static inline bool is_page_busy(struct dma_page *page) { - return page->in_use != 0; + return page->dma_in_use != 0; } static void pool_free_page(struct dma_pool *pool, struct dma_page *page) @@ -362,10 +362,10 @@ void *dma_pool_alloc(struct dma_pool *po list_add(&page->dma_list, &pool->page_list[POOL_AVAIL_IDX]); ready: - page->in_use++; - offset = page->offset; - page->offset = *(int *)(page->vaddr + offset); - if (page->offset >= pool->allocation) + page->dma_in_use++; + offset = page->dma_free_off; + page->dma_free_off = *(int *)(page->vaddr + offset); + if (page->dma_free_off >= pool->allocation) /* Move page from the "available" list to the "full" list. */ list_move_tail(&page->dma_list, &pool->page_list[POOL_FULL_IDX]); @@ -375,8 +375,8 @@ void *dma_pool_alloc(struct dma_pool *po { int i; u8 *data = retval; - /* page->offset is stored in first 4 bytes */ - for (i = sizeof(page->offset); i < pool->size; i++) { + /* page->dma_free_off is stored in first 4 bytes */ + for (i = sizeof(page->dma_free_off); i < pool->size; i++) { if (data[i] == POOL_POISON_FREED) continue; dev_err(pool->dev, @@ -458,7 +458,7 @@ void dma_pool_free(struct dma_pool *pool return; } { - unsigned int chain = page->offset; + unsigned int chain = page->dma_free_off; while (chain < pool->allocation) { if (chain != offset) { chain = *(int *)(page->vaddr + chain); @@ -474,12 +474,12 @@ void dma_pool_free(struct dma_pool *pool memset(vaddr, POOL_POISON_FREED, pool->size); #endif - page->in_use--; - if (page->offset >= pool->allocation) + page->dma_in_use--; + if (page->dma_free_off >= pool->allocation) /* Move page from the "full" list to the "available" list. */ list_move(&page->dma_list, &pool->page_list[POOL_AVAIL_IDX]); - *(int *)vaddr = page->offset; - page->offset = offset; + *(int *)vaddr = page->dma_free_off; + page->dma_free_off = offset; /* * Resist a temptation to do * if (!is_page_busy(page)) pool_free_page(pool, page);