From patchwork Wed May 16 05:43:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10402639 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 6FA61601F9 for ; Wed, 16 May 2018 05:44:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EDB428733 for ; Wed, 16 May 2018 05:44:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5306A28761; Wed, 16 May 2018 05:44:55 +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_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID 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 B383F28733 for ; Wed, 16 May 2018 05:44:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB9E06B02F7; Wed, 16 May 2018 01:44:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C3D376B02F5; Wed, 16 May 2018 01:44:52 -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 AE0C26B02F6; Wed, 16 May 2018 01:44:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f69.google.com (mail-pg0-f69.google.com [74.125.83.69]) by kanga.kvack.org (Postfix) with ESMTP id 618926B02F2 for ; Wed, 16 May 2018 01:44:52 -0400 (EDT) Received: by mail-pg0-f69.google.com with SMTP id m4-v6so1318227pgu.5 for ; Tue, 15 May 2018 22:44:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=R+65/pMEqAXHO6uDdE7otNX/mbVsdRpZW6wpzhYj0eA=; b=nyw5qtCrSY9qB4JHX12GwLLImzbC/K5a4vb2phqQsdXRwATfuxj78Gy//MFAuOpHpf YR/ZLljYBi/JBCSM9WawLFijtUTRCXaDbJ2XCZvCftL5qgL7nQH6bsjN83pR8mvdypuK clDOfGRrI8FIijeU627ONhsjEdgjGVUW8uU81P4C3OdwJFxqiOdev49TSE7v0xqtzMlg yHFea2qVw6oj6m5xHEiUHY7hkGP3jUASMxfWqJLsJqCc10YddBwsBp8ny/VjAUmuXbGh rjVmHc2pmV44l0z4lrBAplSokGy7nfLk1ieBS58b6GdMmQXHWKNpCRpOLfTZ3hcLErUy hfvg== X-Gm-Message-State: ALKqPwe9YDw2g8EEjG2ygtzrwp9FQdwAFWToMCoYei1nrA3q8gJ8+9KT Y+d0CWIyS71eWipdP7Wr7TOQ7+P+vShah9az6SFUoSytb8L5CowifFVMg9Ajf5zuU8AVnYP73bb m4Elwy8qQa0o656pC0DneXNL1IEP7eNRJy/gct+xxvmqerDPe1zowf4VOhKBaVyc= X-Received: by 2002:a17:902:778a:: with SMTP id o10-v6mr17673411pll.214.1526449492097; Tue, 15 May 2018 22:44:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrH6HHEkr3MP6Olohi3sWOiViuq6zE8lGDm4+fblN7fOoRki7tnUH7ndAn2zvjlM4FDpK2Y X-Received: by 2002:a17:902:778a:: with SMTP id o10-v6mr17673385pll.214.1526449491409; Tue, 15 May 2018 22:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526449491; cv=none; d=google.com; s=arc-20160816; b=Albb9p/Yu1gcfLF5yYs2moUWk6IwNSoEMC0wZMHBcxOnry9w8J1fI1FO6xyh1APx4l dQ+CUBcnV/PscPlsc6uNlsuBuFXFnACrmvXspe+VCF6TDz7tmscP616ZAnwDBnFCDcsZ d6qh9jh5DUYarnj/DBNMU0WuC0mRFx2TJn/QuJnbNjRgsTKNlVgF7CEEjIsYb6Cn7rAf Gibx9qj++sO5zHgybfqEaKMPPykZhAgGB+LJf9NT9JdUXk96/R32+cfQAmqy6GC3tsOm fX1V1xPpNlC9IDpcuxkK/oKuxNJdLu/0DgKHcJsh+okBjDbY87H91WJWbwsXq/1a/SmI LY7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=R+65/pMEqAXHO6uDdE7otNX/mbVsdRpZW6wpzhYj0eA=; b=hO/dcG4iiFAjvGIwyRcjbZ3o7uk1v0ZIaBnZjvETOYfqcl+dYGumsca6O8IvfD+E5A MYSeNm6JshYyC4XS8ttBC5iZSvHibUJQANES67CQIpLZxNFFKIwtSBbyEAqls8vsTiiZ Eo5u/ws5EpcQR7HLwYwdnGNAYgKQ5CqtFhXnxrIpF3O3yu/pRx9sp2hTG+Hoi8yzK0Kz S64Xpw1QU/1+favi5UjSHagmY6mgMxP6oeVvgbAzod/g0ne4IQjDGAB+XT/wRfLwXre6 bg0hTmjjm3pQ+FttjE+IVeYAVCVKan8vpTaHJGQ9vjEUeCTHJHEoRT9fLtgwiTZSXpC0 Cnjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=LSldQqm7; spf=pass (google.com: best guess record for domain of batv+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id 4-v6si1880400pfb.204.2018.05.15.22.44.51 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 22:44:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=LSldQqm7; spf=pass (google.com: best guess record for domain of batv+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org 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=R+65/pMEqAXHO6uDdE7otNX/mbVsdRpZW6wpzhYj0eA=; b=LSldQqm7rQytqlN3xR4pfYxyZ VFVOinw2y0YpPgf0BvaZter55mo5qtvQ3pUUmuiESKvvJ6aTmzlLMFDXNeyW97ownzRqz3KVO05S9 WhqAnRjc+CiZiQXdoKiiZ6fV3PZtMO0/IBHaz6e3wyAfx9cmD1L8ZZgKJgNV+iDZS00vj4jO4eNXP SrCvjS3GNGpMguheSJAMMsx4HQF49waQF9FMLjIS97/MbEQ4Zqsm+tdoq9QKrMZN2Jt8mnZb33QM+ 9Cr8e/sLxsq16dNnZx7z3uWGQdSWytSn0IPwSP8/1OjwYXY7mng44Dj8my8DPRuGNBl1bBSaMv3sQ dFsITWmww==; Received: from [93.83.86.253] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIpEY-00088O-JA; Wed, 16 May 2018 05:44:19 +0000 From: Christoph Hellwig To: Souptick Joarder , Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, devel@lists.orangefs.org, ceph-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-mtd@lists.infradead.org, dri-devel@lists.freedesktop.org, lustre-devel@lists.lustre.org, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org Subject: [PATCH 08/14] ocfs2: separate errno from VM_FAULT_* values Date: Wed, 16 May 2018 07:43:42 +0200 Message-Id: <20180516054348.15950-9-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-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 Signed-off-by: Christoph Hellwig --- fs/ocfs2/mmap.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index fb9a20e3d608..e75c1fc5333e 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c @@ -44,11 +44,11 @@ #include "ocfs2_trace.h" -static int ocfs2_fault(struct vm_fault *vmf) +static vm_fault_t ocfs2_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; sigset_t oldset; - int ret; + vm_fault_t ret; ocfs2_block_signals(&oldset); ret = filemap_fault(vmf); @@ -59,10 +59,10 @@ static int ocfs2_fault(struct vm_fault *vmf) return ret; } -static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, - struct page *page) +static vm_fault_t __ocfs2_page_mkwrite(struct file *file, + struct buffer_head *di_bh, struct page *page) { - int ret = VM_FAULT_NOPAGE; + vm_fault_t ret = VM_FAULT_NOPAGE; struct inode *inode = file_inode(file); struct address_space *mapping = inode->i_mapping; loff_t pos = page_offset(page); @@ -71,6 +71,7 @@ static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, struct page *locked_page = NULL; void *fsdata; loff_t size = i_size_read(inode); + int err; last_index = (size - 1) >> PAGE_SHIFT; @@ -105,12 +106,12 @@ static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, if (page->index == last_index) len = ((size - 1) & ~PAGE_MASK) + 1; - ret = ocfs2_write_begin_nolock(mapping, pos, len, OCFS2_WRITE_MMAP, + err = ocfs2_write_begin_nolock(mapping, pos, len, OCFS2_WRITE_MMAP, &locked_page, &fsdata, di_bh, page); - if (ret) { - if (ret != -ENOSPC) - mlog_errno(ret); - if (ret == -ENOMEM) + if (err) { + if (err != -ENOSPC) + mlog_errno(err); + if (err == -ENOMEM) ret = VM_FAULT_OOM; else ret = VM_FAULT_SIGBUS; @@ -121,20 +122,21 @@ static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, ret = VM_FAULT_NOPAGE; goto out; } - ret = ocfs2_write_end_nolock(mapping, pos, len, len, fsdata); - BUG_ON(ret != len); + err = ocfs2_write_end_nolock(mapping, pos, len, len, fsdata); + BUG_ON(err != len); ret = VM_FAULT_LOCKED; out: return ret; } -static int ocfs2_page_mkwrite(struct vm_fault *vmf) +static vm_fault_t ocfs2_page_mkwrite(struct vm_fault *vmf) { struct page *page = vmf->page; struct inode *inode = file_inode(vmf->vma->vm_file); struct buffer_head *di_bh = NULL; sigset_t oldset; - int ret; + vm_fault_t ret = 0; + int err; sb_start_pagefault(inode->i_sb); ocfs2_block_signals(&oldset); @@ -144,10 +146,10 @@ static int ocfs2_page_mkwrite(struct vm_fault *vmf) * node. Taking the data lock will also ensure that we don't * attempt page truncation as part of a downconvert. */ - ret = ocfs2_inode_lock(inode, &di_bh, 1); - if (ret < 0) { + err = ocfs2_inode_lock(inode, &di_bh, 1); + if (err < 0) { mlog_errno(ret); - if (ret == -ENOMEM) + if (err == -ENOMEM) ret = VM_FAULT_OOM; else ret = VM_FAULT_SIGBUS;