From patchwork Wed May 16 05:43:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10402665 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 3A6C86037D for ; Wed, 16 May 2018 05:45:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AD6928733 for ; Wed, 16 May 2018 05:45:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F84D28762; Wed, 16 May 2018 05:45:23 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 0DB7928761 for ; Wed, 16 May 2018 05:45:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 56EB06E2EF; Wed, 16 May 2018 05:45:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by gabe.freedesktop.org (Postfix) with ESMTPS id 354F16E32D for ; Wed, 16 May 2018 05:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HJIbFVL9Dcsydlgs2QtrsHEEM3Xyibuk+Bko5951718=; b=BVL/DpqtbqyAC6UO1c8QgrtXB PuCLgSi3tDy0qwL5dwrxJJOHOsHk31Kh1fPvgUBFaO9o6okuDkcy6t5he60upYYR3cMbisJbKti5A R3enT+G/Q0Lq5DTfpoHwKS/rv1jQWM3GyxvRz8bCYlmdWDgvpL93yOVaEAFwHk013lUpu0Y7bgdz6 n6P6mDGE2MQnuUHo31F7K1Kut1AbbeibUGUxm4MPwRpIxiH19nQSunfb2ttf6sQbpWv7lJInKjXPZ a7+/D2aaF/umAnioTgMdc7CyVlaE8v5/c6yXz1nvj8xio79K7kMkzVhiq3L3VoALSvi2xA10AY/06 h7KmrTzug==; Received: from [93.83.86.253] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIpEm-0008FK-Qy; Wed, 16 May 2018 05:44:33 +0000 From: Christoph Hellwig To: Souptick Joarder , Matthew Wilcox Subject: [PATCH 12/14] lustre: separate errno from VM_FAULT_* values Date: Wed, 16 May 2018 07:43:46 +0200 Message-Id: <20180516054348.15950-13-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516054348.15950-1-hch@lst.de> References: <20180516054348.15950-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, ocfs2-devel@oss.oracle.com, devel@lists.orangefs.org, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, lustre-devel@lists.lustre.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Christoph Hellwig --- .../staging/lustre/lustre/llite/llite_mmap.c | 37 +++++++------------ .../lustre/lustre/llite/vvp_internal.h | 2 +- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index 214b07554e62..061d98871959 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -231,23 +231,18 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, return result; } -static inline int to_fault_error(int result) +static inline vm_fault_t to_fault_error(int result) { switch (result) { case 0: - result = VM_FAULT_LOCKED; - break; + return VM_FAULT_LOCKED; case -EFAULT: - result = VM_FAULT_NOPAGE; - break; + return VM_FAULT_NOPAGE; case -ENOMEM: - result = VM_FAULT_OOM; - break; + return VM_FAULT_OOM; default: - result = VM_FAULT_SIGBUS; - break; + return VM_FAULT_SIGBUS; } - return result; } /** @@ -261,7 +256,7 @@ static inline int to_fault_error(int result) * \retval VM_FAULT_ERROR on general error * \retval NOPAGE_OOM not have memory for allocate new page */ -static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) +static vm_fault_t ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) { struct lu_env *env; struct cl_io *io; @@ -269,7 +264,7 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) struct page *vmpage; unsigned long ra_flags; int result = 0; - int fault_ret = 0; + vm_fault_t fault_ret = 0; u16 refcheck; env = cl_env_get(&refcheck); @@ -323,7 +318,7 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) return fault_ret; } -static int ll_fault(struct vm_fault *vmf) +static vm_fault_t ll_fault(struct vm_fault *vmf) { int count = 0; bool printed = false; @@ -364,7 +359,7 @@ static int ll_fault(struct vm_fault *vmf) return result; } -static int ll_page_mkwrite(struct vm_fault *vmf) +static vm_fault_t ll_page_mkwrite(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; int count = 0; @@ -390,22 +385,16 @@ static int ll_page_mkwrite(struct vm_fault *vmf) switch (result) { case 0: LASSERT(PageLocked(vmf->page)); - result = VM_FAULT_LOCKED; - break; + return VM_FAULT_LOCKED; case -ENODATA: case -EAGAIN: case -EFAULT: - result = VM_FAULT_NOPAGE; - break; + return VM_FAULT_NOPAGE; case -ENOMEM: - result = VM_FAULT_OOM; - break; + return VM_FAULT_OOM; default: - result = VM_FAULT_SIGBUS; - break; + return VM_FAULT_SIGBUS; } - - return result; } /** diff --git a/drivers/staging/lustre/lustre/llite/vvp_internal.h b/drivers/staging/lustre/lustre/llite/vvp_internal.h index 7d3abb43584a..c194966a3d82 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_internal.h +++ b/drivers/staging/lustre/lustre/llite/vvp_internal.h @@ -83,7 +83,7 @@ struct vvp_io { /** * fault API used bitflags for return code. */ - unsigned int ft_flags; + vm_fault_t ft_flags; /** * check that flags are from filemap_fault */