From patchwork Tue Apr 17 13:28:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10345037 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 6E61760216 for ; Tue, 17 Apr 2018 13:26:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5417F2239C for ; Tue, 17 Apr 2018 13:26:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48B05223A7; Tue, 17 Apr 2018 13:26:53 +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 E02182239C for ; Tue, 17 Apr 2018 13:26:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8EE662263DD6A; Tue, 17 Apr 2018 06:26:52 -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:c05::244; helo=mail-pg0-x244.google.com; envelope-from=jrdr.linux@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::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 308AE22590E3F for ; Tue, 17 Apr 2018 06:26:50 -0700 (PDT) Received: by mail-pg0-x244.google.com with SMTP id i194so5409926pgd.0 for ; Tue, 17 Apr 2018 06:26:50 -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=z8VKRLxJSshosaFumVw7QPMAZAGaRhD5Laxd5cusXqQ=; b=GEiwqppc415d6AGeZZJ+jQDNoChX6j5uLWYVMdRdSfAMm0vX7/YoqjAqWKR5Nm1uZw hlRRgdTTFpV3gFHFkxFxwsA1ozsF4pAhVCg0YOIGAIuFv2187Gk1WRfb8XLHgvMMf9yt Mfce60TKRWZNHNcwvxLB4ecQyiyKcvw+LjyLpkIEHtRtaqHhHKW35ER+hm3TKecxWjKz rFzMnux2YdUBxUWuuu7RtvrBBSodW6OMr6pOlwJ9Z2mun21v9fRLOvQEdrzel64C3aOK DygkKuk32hqU+H7h/Nv4ARW02FRSxEvyitXV2dLZ/YbkLnVoDZ7Iy8kVnposS6fuXnp9 ElUw== 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=z8VKRLxJSshosaFumVw7QPMAZAGaRhD5Laxd5cusXqQ=; b=djdKJ38qMbI528Au9+a5t377hOmdZm2JTiezCw1E/Bowfygx/4XavoZL7A2YDlzGSa Z0w05+J7pBAhsWe3NLr1Dgfdj3xn8DK1MPd7ZqEZzqpwxPRI0eOPBPbGjUPfV0KUjWAW RkVujGM6dZC9KVq+/PMmbjqUTmBQucSHGnISR3TfrSG+G4wpaOPdel+QM7iAwJK3ICmy wL6ZBjBGW+0z7juhhWwYxqjRM/U5oUCnzBWPJRVOXdx5qtTjVwYvJnZ7uwBOpNxbEkzv iAvl3UWSYNxJNEGvS/64DV9yURrSYGhGi/06rOfRB2aCcSoyh72gEkSGZ3tpUfGfkfxx VGOg== X-Gm-Message-State: ALQs6tBEO3QkP3XXsk1RrGfgPa9KpWWfkKoRjOAr4siate+Y3ZQO5QQ4 RF+rsKNin9RXzJEYNmYwaczOBgsb X-Google-Smtp-Source: AIpwx49bcrk1DlrgUNHLzxxJWDEsBgIU1kYVIh7UlTzpVoE528GjwKTmqad8MLt2PUtEDEpoZrqAPw== X-Received: by 10.98.208.195 with SMTP id p186mr1075371pfg.250.1523971609975; Tue, 17 Apr 2018 06:26:49 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC ([183.82.18.42]) by smtp.gmail.com with ESMTPSA id b187sm27178231pfg.164.2018.04.17.06.26.47 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Apr 2018 06:26:47 -0700 (PDT) Date: Tue, 17 Apr 2018 18:58:42 +0530 From: Souptick Joarder To: dan.j.williams@intel.com, ross.zwisler@linux.intel.com, rdunlap@infradead.org Subject: [PATCH v3] dax: Change return type to vm_fault_t Message-ID: <20180417132842.GA30189@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 and added Ross in review list 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); }