From patchwork Wed May 16 05:43:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10402629 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 CF05B601F9 for ; Wed, 16 May 2018 05:44:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BECE228733 for ; Wed, 16 May 2018 05:44:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B36D628761; Wed, 16 May 2018 05:44:45 +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 439B628733 for ; Wed, 16 May 2018 05:44:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE1FE6B02F0; Wed, 16 May 2018 01:44:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A67786B02F2; Wed, 16 May 2018 01:44:43 -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 86F4E6B02F1; Wed, 16 May 2018 01:44:43 -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 3F7896B02EF for ; Wed, 16 May 2018 01:44:43 -0400 (EDT) Received: by mail-pg0-f69.google.com with SMTP id t11-v6so1312957pgn.9 for ; Tue, 15 May 2018 22:44:43 -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=lT7PS+g3P2buXCZhlm4Z0oPc3mLSEcv98rwfKuSxvw4=; b=P7TODunYBcvjJ2cCYgfXDKtW+wdngg/UAMojBy/bd1OYBmgo4Fx1K7q4PYlLmQVfV3 4AhBpQICvs6/6Q72E/I/zkG/MpffzNlOPnRmFuqaecSodSLn5Qll3YYJ19A0dKSaoT7M l8zK2YytUsWxoWxWe3N2GE/gafhjOFuSQoun2StjrskQGG3XK8nd3Ae0ktZidNeAClz3 VeAhMvSTDsqYox/eWimYpBVKChHBGXVKGwSDjRc+mOdEUaGGTM9xTnA8MQTi5srriglJ VxoT0MSSpIojuS8sDiBbCm66MU9fR0Yw/XUCyU5MsuWAQnjf7Kzz7iiRlj81jVtfIm5s U5ew== X-Gm-Message-State: ALKqPwe8f778aiO3gtuFwTT14xTeZA/NxW7oVrZjEdKKAx19b/HyoSwI j02PFHDtkbCEOmL/OIB7/BWF7ej0Ih3OhReWK9oUZt16KGs0lJ/cDVTDb9CP6krztVLrlI4b4oB kSHjPmHDN0/L70UfcEtFfFf1k45TtFwoAnSOwnhT2xPUaOlsmhIhkhMdxi2AynsU= X-Received: by 2002:a63:741d:: with SMTP id p29-v6mr14783798pgc.451.1526449482924; Tue, 15 May 2018 22:44:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrvqnP/sRBo1HEfZlcTC5nNYUgReIYuZ/QWJcK8GA4/JekYznT/xrbPE31tVo3ZPHjYsMg/ X-Received: by 2002:a63:741d:: with SMTP id p29-v6mr14783766pgc.451.1526449482161; Tue, 15 May 2018 22:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526449482; cv=none; d=google.com; s=arc-20160816; b=g1SsYwI6D8sBAv1qgNlzPBv/9xcovdf0pV9HwCHTQnCyVzEVFRAQzxJ6Fg8JkNBAdm IcoD/6Dck8WK5QRY5Y7esfemCFiiMyqEyRSWdGdRUkdAhuW4CSTnKfh5EFxON55jDJXP NXvE28ZBlXF5DeWPktwNYUN5+VKQr5owsVNbK7ob1xt8tZjjzx6Bo6z2NU+/u6soV3Fp b9FhEmt2kqP3nFglCSeM5YngZ1NLtgT3r/L4eazzLj+OPrYxb7zTWZJyIUySCdkC8hJy FzFNGuT6Snq9vabvzYs0dHfu8oiUR4AhzGB47suqRuYvLMoeZaqpm1TtZJyzyxSWejdX YYpA== 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=lT7PS+g3P2buXCZhlm4Z0oPc3mLSEcv98rwfKuSxvw4=; b=A7hnaHiyRiuQ7+jcIkDx15VwPga3YubaYgnc8t4fvOcmAno3C5jiYiu2HM61V8zuUY 1gyvPrHWuxSXvUGvhOccIJx7zSCYYTF62kWnC9FPFOcm8nMN9xB/wkjTMEi3n4BHCcmE VQtLWHe8QuWA94CuWO1kam9nsUiyziI06iQ7igiwAzwqSBCCH8fQ8qIncsDZlgT/+bt9 arAfLukDBnFeWrv0BueuVNl9YN5rer7yThyCaxOVgp8FMzroJE7gBZxjExJ6pQDPUOdd w0TJ+OzJZ4BtBKwJfSsN3Kc3aINbHEm4bPv3IXmY6dcjeQsN5uX9F0vZ3fwCBU/29fFD Qy9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=knLlaJKu; 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 j7-v6si1913197plk.506.2018.05.15.22.44.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 22:44:42 -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=knLlaJKu; 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=lT7PS+g3P2buXCZhlm4Z0oPc3mLSEcv98rwfKuSxvw4=; b=knLlaJKu0rjYiVIz+/RDOScXv 2mUpEMK5rFC8dY9lnvVsWOcbOHSKKvlIyC7bx/rf8gvs+2CiYDhHx+dy/SdpIYJY07W3YXWr7vOPF mUiyiMlFkiNEcH3h8fZv6aOzalC10Mjc1W5cMIa9OxfWijcvPNGoC9tfLs1oFYpmrDNB6MJPVndRo UzWHqyMKmKvvvsu6EDkLOCPkTOEdcCwf+j3KiFl3D/gjHH7Ux8Zb8+jB/nh4nJ5vqVjpuadFlmXII XDXrDLQR2SqENMtFh99qEtOgXtbuoktpNqLJ0mOHNsv8317+hQSqNZuslMPKFPXyJQIKt/NkEje1X Uc2czw6OQ==; Received: from [93.83.86.253] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIpER-00084t-Rx; Wed, 16 May 2018 05:44:12 +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 06/14] btrfs: separate errno from VM_FAULT_* values Date: Wed, 16 May 2018 07:43:40 +0200 Message-Id: <20180516054348.15950-7-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 Reviewed-by: David Sterba --- fs/btrfs/ctree.h | 2 +- fs/btrfs/inode.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1485cd130e2b..02a0de73c1d1 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3203,7 +3203,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset, size_t size, struct bio *bio, unsigned long bio_flags); void btrfs_set_range_writeback(void *private_data, u64 start, u64 end); -int btrfs_page_mkwrite(struct vm_fault *vmf); +vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf); int btrfs_readpage(struct file *file, struct page *page); void btrfs_evict_inode(struct inode *inode); int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ec9db248c499..f4f03f0f4556 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8824,7 +8824,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned int offset, * beyond EOF, then the page is guaranteed safe against truncation until we * unlock the page. */ -int btrfs_page_mkwrite(struct vm_fault *vmf) +vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf) { struct page *page = vmf->page; struct inode *inode = file_inode(vmf->vma->vm_file); @@ -8836,7 +8836,8 @@ int btrfs_page_mkwrite(struct vm_fault *vmf) char *kaddr; unsigned long zero_start; loff_t size; - int ret; + vm_fault_t ret; + int err; int reserved = 0; u64 reserved_space; u64 page_start; @@ -8858,14 +8859,14 @@ int btrfs_page_mkwrite(struct vm_fault *vmf) * end up waiting indefinitely to get a lock on the page currently * being processed by btrfs_page_mkwrite() function. */ - ret = btrfs_delalloc_reserve_space(inode, &data_reserved, page_start, + err = btrfs_delalloc_reserve_space(inode, &data_reserved, page_start, reserved_space); - if (!ret) { - ret = file_update_time(vmf->vma->vm_file); + if (!err) { + err = file_update_time(vmf->vma->vm_file); reserved = 1; } - if (ret) { - if (ret == -ENOMEM) + if (err) { + if (err == -ENOMEM) ret = VM_FAULT_OOM; else /* -ENOSPC, -EIO, etc */ ret = VM_FAULT_SIGBUS; @@ -8927,9 +8928,9 @@ int btrfs_page_mkwrite(struct vm_fault *vmf) EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, 0, 0, &cached_state); - ret = btrfs_set_extent_delalloc(inode, page_start, end, 0, + err = btrfs_set_extent_delalloc(inode, page_start, end, 0, &cached_state, 0); - if (ret) { + if (err) { unlock_extent_cached(io_tree, page_start, page_end, &cached_state); ret = VM_FAULT_SIGBUS;