From patchwork Tue Aug 7 16:47:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Battersby X-Patchwork-Id: 10558917 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 1C91814E5 for ; Tue, 7 Aug 2018 16:47:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C3372A621 for ; Tue, 7 Aug 2018 16:47:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 002572A692; Tue, 7 Aug 2018 16:47:32 +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=unavailable 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 93ACB2A621 for ; Tue, 7 Aug 2018 16:47:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF1636B000E; Tue, 7 Aug 2018 12:47:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AA15C6B0010; Tue, 7 Aug 2018 12:47:31 -0400 (EDT) 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 991D96B0266; Tue, 7 Aug 2018 12:47:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f199.google.com (mail-qt0-f199.google.com [209.85.216.199]) by kanga.kvack.org (Postfix) with ESMTP id 714836B000E for ; Tue, 7 Aug 2018 12:47:31 -0400 (EDT) Received: by mail-qt0-f199.google.com with SMTP id e14-v6so13745466qtp.17 for ; Tue, 07 Aug 2018 09:47:31 -0700 (PDT) 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:to:from :subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=sKpmnAcRyha5G2We6zNr26W0mYYtlt+pU+AiMoJ/JwM=; b=hL1iv3iBCOiTQ+gbsdWAIh4jQDz9PluFhbb3uOKH0Kkr2L8c2/qY+XhupaKoQlrJmL nIhI6zrQyTCLHEJBbi0stxgz8KqGJn2nQ8rRLQX1hZoch/TeMzc/PrqV1QkxMv88+nDb 7KT++ocbGotjvXjmgd7wTXTP7HQiTDZdnJQUS9popdfCF1uOcy+AlH8fMzmKR9/7qEsi 4mP0KnSrwgwCxQ2zhuNt/THoLaSCP7EUyNaYy1tmnU7TBapYzsOj9SaJmiagItjhHonP mUZKRf1ARf85LuvavwU5hKFIvmJC1UZAZyBahU4K8/StCPplEpCt77Vp+CgxKR9wRSP4 CCaA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of btv1==757ef7a2255==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==757ef7a2255==tonyb@cybernetics.com" X-Gm-Message-State: AOUpUlGmdJGFfRFORG5v7H+G8txFxeI6bTppDo0aBY08+fgRr7SSq7Dl E/tan5nNJ+iJmh4HS2tM3f/WDCWo1oc6wS2qeKZpgenLYylXk4peNzuD8BYUhkMQ4sTUmxV4ecB hn2dFTeuSqLR91mkHMNGedEt+nRRKrzOvEd8avk8oh+PN7fbY2MDRT5LSJHY2kRM8eA== X-Received: by 2002:a37:cf43:: with SMTP id e64-v6mr17281253qkj.68.1533660451238; Tue, 07 Aug 2018 09:47:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeT3wTaNaSMW1zlSQkWMgXzLVsJDq23IG2afZKNN8sWEomof0ZcTGuvgKkvPy5dshTz6z0o X-Received: by 2002:a37:cf43:: with SMTP id e64-v6mr17281193qkj.68.1533660450235; Tue, 07 Aug 2018 09:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533660450; cv=none; d=google.com; s=arc-20160816; b=XgwKSrR4DwmudcGYpoIFMKpGtI9PuOVoid4WrRvjI8bh8i2yJOz5+89jbyzkrMObxp gqeC4aVWXbtN4lNU5Sbc3Ga+F9qOMmPTsNQLpeB0x6jBc6wy0bX+Jh58zDOD687fMGWF /Ux9ely/wNPNnrTRLsPhs5S6UHYjhMGGCumHXmo2K+ArqBbWX0zC4kSacs0riAc2WUIK YNaxAEOHnzPEKTN7SRdyiG2xieY7X7Q0r3/KFwB12zxNX1N9L317HeHZyjzhfLPV/5Fy NsPh+YCAK1ZtSF7x0EhoRDpo4TXz2ptPxtT5iciYe4M4nPpcjGI/SI8PCFlnDlmrJ9RE S08w== 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:subject:from:to:arc-authentication-results; bh=sKpmnAcRyha5G2We6zNr26W0mYYtlt+pU+AiMoJ/JwM=; b=U0QwRuD2833oJgCeDCooQl1Aw5LByWLdnxdMGbjvMXCMbiTEQZqdKAFH6B5GLrhnPA O1yMj6sh7XpW5cPMPBMajccYZ1wtrx84ru4YFNv9JGjDNR90PYi5BmdvCJvey1Cs+OkA GqvMPeQ/Qnmtma+C/vatSUgp8DLiIJWCrxFGSjJMTzZjIdqkOfvup2fexCj0R6uTag2D OS4VsM1/WHt39+F3zywKbXchbZXE2Ide2xdlg93qdVzslYQ+BAjFQ3GC134GMUgFcmze v6P9/2UG7N2HeIc7LbgKHH4RBvkdzxX3tjSPqQgaj9l0dGj4y2Zs1v6OBNgdxW0eTUbJ fXig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of btv1==757ef7a2255==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==757ef7a2255==tonyb@cybernetics.com" Received: from mail.cybernetics.com (mail.cybernetics.com. [173.71.130.66]) by mx.google.com with ESMTPS id f20-v6si1334366qtp.48.2018.08.07.09.47.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 09:47:30 -0700 (PDT) Received-SPF: pass (google.com: domain of btv1==757ef7a2255==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==757ef7a2255==tonyb@cybernetics.com designates 173.71.130.66 as permitted sender) smtp.mailfrom="btv1==757ef7a2255==tonyb@cybernetics.com" X-ASG-Debug-ID: 1533660448-0fb3b01fb342b8c0001-v9ZeMO Received: from cybernetics.com ([10.157.1.126]) by mail.cybernetics.com with ESMTP id aoLRbHEitRbZoBdk (version=SSLv3 cipher=DES-CBC3-SHA bits=112 verify=NO); Tue, 07 Aug 2018 12:47:28 -0400 (EDT) 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 8324865; Tue, 07 Aug 2018 12:47:28 -0400 To: Matthew Wilcox , Christoph Hellwig , Marek Szyprowski , Sathya Prakash , Chaitra P B , Suganath Prabu Subramani , "iommu@lists.linux-foundation.org" , "linux-mm@kvack.org" , "linux-scsi@vger.kernel.org" , "MPT-FusionLinux.pdl@broadcom.com" From: Tony Battersby Subject: [PATCH v3 05/10] dmapool: rename fields in dma_page Message-ID: X-ASG-Orig-Subj: [PATCH v3 05/10] dmapool: rename fields in dma_page Date: Tue, 7 Aug 2018 12:47:28 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Language: en-US X-Barracuda-Connect: UNKNOWN[10.157.1.126] X-Barracuda-Start-Time: 1533660448 X-Barracuda-Encrypted: DES-CBC3-SHA X-Barracuda-URL: https://10.157.1.122:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 3410 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 --- Changes since v2: Use dma_free_off instead of dma_free_o. --- 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);