From patchwork Mon Apr 16 18:50:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10343703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7E8860542 for ; Mon, 16 Apr 2018 18:48:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98373288AE for ; Mon, 16 Apr 2018 18:48:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C5B1288B5; Mon, 16 Apr 2018 18:48:54 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3809D288AE for ; Mon, 16 Apr 2018 18:48:53 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A08C12244E412; Mon, 16 Apr 2018 11:48:53 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=jrdr.linux@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CFC9D2244E408 for ; Mon, 16 Apr 2018 11:48:52 -0700 (PDT) Received: by mail-pf0-x244.google.com with SMTP id z9so4138743pfe.6 for ; Mon, 16 Apr 2018 11:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=acOviBb2g0OR8t+vbsKp1JdCKsgCISu2qaVAqidpUyI=; b=AaKLyyeSN3ALqbkzRYrRuZVYnJWCN5o3UIiAvdixFztwzVpC278Y7ElpupyQExkL8Q T8TUC505PGgJF2bA5w0Qg86S8Df5LwLM604tRE/AR4xkinyRfdPF3bSRa+JO8AKXq7UO /lwB+yKKjojbMyqgCKa8O16gp8Wm2ZDX1rT2TeHHorkAKCm0526kOvY+GytT6KSoZbUO 2EqpmrNZLH+ryNUFRaG6Vr+jZGdYLa7y43T9j8BmNl/4FSBI1W3XzBZX0EdOVSpZmFga qYPT1Q3kMLC4Sn1fi4T9oVDT/O8VLHYLtGE5DFweBFOkiUrorT8VsxeiPYKg8TxECzSX YT2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=acOviBb2g0OR8t+vbsKp1JdCKsgCISu2qaVAqidpUyI=; b=JlZTJPUQjClMfrcicV4t9cqNwOJtQivrT1bolgF+TMNeiQHfzcAzKUoCY0LLQD01cf GhSj0M3YjTOuP/0Oeqge95D0nkfuoI4UlO1LAJr7OkPTiwbIpya1yLvBnjAuJ7ZbF2lO Z/IhKQkl5/xiwv9E8R67880uOf7Nk1rDJNPY7yBbw22kwH+OtAuy3JXRGGnagpNtzmb+ oo9+L42W4utypTHXU19vDufpQyXgv9rCFvk44kluSu7hTTkR85qh9Ar8yeDqb62FhO9f 3Q69ClPFPsrKrAoJSSLROWHnwuE2z27Z0ZcE8vD6A/ujpz6Dl4PvC+RlfFM1N1kOL1ZS V3Qg== X-Gm-Message-State: ALQs6tAmxpq10WLz1ug3yuahdI4+EMyLxfk3Q0LIZ2z8iXvn+f91462K AhgBnrpTsXmc+1/Sp1e8Md4= X-Google-Smtp-Source: AIpwx4+7jO5lpNkKVUpZEt0odRoZScqVBZ8VOm6RlhMGOtYMipYkxXv0tgRYE2lEtD+4TCiYz6001A== X-Received: by 10.99.171.72 with SMTP id k8mr14243957pgp.355.1523904532144; Mon, 16 Apr 2018 11:48:52 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC ([49.205.217.195]) by smtp.gmail.com with ESMTPSA id b64sm29005564pfl.148.2018.04.16.11.48.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Apr 2018 11:48:50 -0700 (PDT) Date: Tue, 17 Apr 2018 00:20:44 +0530 From: Souptick Joarder To: dan.j.williams@intel.com, rdunlap@infradead.org Subject: [PATCH v2] dax: Change return type to vm_fault_t Message-ID: <20180416185044.GA29337@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: willy@infradead.org, linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Use new return type vm_fault_t for fault and huge_fault handler. For now, this is just documenting that the function returns a VM_FAULT value rather than an errno. Once all instances are converted, vm_fault_t will become a distinct type. Reference id -> 1c8f422059ae ("mm: change return type to vm_fault_t") Previously vm_insert_mixed() returns err which driver mapped into VM_FAULT_* type. The new function vmf_insert_mixed() will replace this inefficiency by returning VM_FAULT_* type. Signed-off-by: Souptick Joarder Reviewed-by: Matthew Wilcox Reviewed-by: Ross Zwisler --- v2: Modified the change log v3: Updated the change log drivers/dax/device.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/dax/device.c b/drivers/dax/device.c index 2137dbc..a122701 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -243,11 +243,11 @@ __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, return -1; } -static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) +static vm_fault_t __dev_dax_pte_fault(struct dev_dax *dev_dax, + struct vm_fault *vmf) { struct device *dev = &dev_dax->dev; struct dax_region *dax_region; - int rc = VM_FAULT_SIGBUS; phys_addr_t phys; pfn_t pfn; unsigned int fault_size = PAGE_SIZE; @@ -274,17 +274,11 @@ static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) pfn = phys_to_pfn_t(phys, dax_region->pfn_flags); - rc = vm_insert_mixed(vmf->vma, vmf->address, pfn); - - if (rc == -ENOMEM) - return VM_FAULT_OOM; - if (rc < 0 && rc != -EBUSY) - return VM_FAULT_SIGBUS; - - return VM_FAULT_NOPAGE; + return vmf_insert_mixed(vmf->vma, vmf->address, pfn); } -static int __dev_dax_pmd_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) +static vm_fault_t __dev_dax_pmd_fault(struct dev_dax *dev_dax, + struct vm_fault *vmf) { unsigned long pmd_addr = vmf->address & PMD_MASK; struct device *dev = &dev_dax->dev; @@ -335,7 +329,8 @@ static int __dev_dax_pmd_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) } #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD -static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) +static vm_fault_t __dev_dax_pud_fault(struct dev_dax *dev_dax, + struct vm_fault *vmf) { unsigned long pud_addr = vmf->address & PUD_MASK; struct device *dev = &dev_dax->dev; @@ -386,13 +381,14 @@ static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) vmf->flags & FAULT_FLAG_WRITE); } #else -static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) +static vm_fault_t __dev_dax_pud_fault(struct dev_dax *dev_dax, + struct vm_fault *vmf) { return VM_FAULT_FALLBACK; } #endif /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */ -static int dev_dax_huge_fault(struct vm_fault *vmf, +static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, enum page_entry_size pe_size) { int rc, id; @@ -423,7 +419,7 @@ static int dev_dax_huge_fault(struct vm_fault *vmf, return rc; } -static int dev_dax_fault(struct vm_fault *vmf) +static vm_fault_t dev_dax_fault(struct vm_fault *vmf) { return dev_dax_huge_fault(vmf, PE_SIZE_PTE); }