From patchwork Fri Sep 16 12:19:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 9335663 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 88E936089F for ; Fri, 16 Sep 2016 12:21:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A71F29F10 for ; Fri, 16 Sep 2016 12:21:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DCE829F6F; Fri, 16 Sep 2016 12:21:39 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50E3929F10 for ; Fri, 16 Sep 2016 12:21:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935053AbcIPMUg (ORCPT ); Fri, 16 Sep 2016 08:20:36 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37718 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934888AbcIPMTs (ORCPT ); Fri, 16 Sep 2016 08:19:48 -0400 Received: by mail-wm0-f45.google.com with SMTP id k186so38182037wmd.0 for ; Fri, 16 Sep 2016 05:19:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tr1RCOXXJtFhvSeYLswi2M0CyrTND2dgq3JEuVL2ZL8=; b=QE+cIXDuih7SbRpp4PuZpiQmkRr8DOfoM1Ju4uvkgOrqi88d8XCIUIJFDlkDsOW6Xm ljvgE3F+7vcuUc6pxpVRwwhNowAPZGeOD/WEe5yGh1fZ48J5/ki3RRBKyf3Sq48ka/Bl YOnfsUCgX3qyuBrRQ6LpZINyd1+M9AjNNvMcuTL8eg7aQUX7Rf34eH7hzl/tvPu7cXkV IWhWZpzkDgMsBU+jFgwGCdPsCaegjqiZtpaRM3UOr2ooan8IH10Q8DuQR0o3dw5me6Fj jh2kFwuYixbZiw19l2ABzQOiZGv4rSOvFqOLBqisrygoiM9+qep4vp5n1PsA7b4V4a3I ja/w== X-Gm-Message-State: AE9vXwNV5NMgKFfgtTbYe4gVsQ9p8GrksVZekuaS9ooSqdpwAP93PO9Qev1N6Z9InGx/G4Hu X-Received: by 10.194.157.226 with SMTP id wp2mr14652339wjb.48.1474028386864; Fri, 16 Sep 2016 05:19:46 -0700 (PDT) Received: from veci.piliscsaba.szeredi.hu (4E5CE698.dsl.pool.telekom.hu. [78.92.230.152]) by smtp.gmail.com with ESMTPSA id n7sm8169812wjs.34.2016.09.16.05.19.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Sep 2016 05:19:46 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro , Chris Mason Subject: [PATCH 08/12] btrfs: use filemap_check_errors() Date: Fri, 16 Sep 2016 14:19:27 +0200 Message-Id: <1474028371-21288-9-git-send-email-mszeredi@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1474028371-21288-1-git-send-email-mszeredi@redhat.com> References: <1474028371-21288-1-git-send-email-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Miklos Szeredi Reviewed-by: Omar Sandoval Cc: Chris Mason --- fs/btrfs/ctree.h | 1 - fs/btrfs/file.c | 2 +- fs/btrfs/inode.c | 15 --------------- fs/btrfs/tree-log.c | 4 ++-- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 33fe03551105..e62fd50237e4 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3161,7 +3161,6 @@ int btrfs_prealloc_file_range_trans(struct inode *inode, struct btrfs_trans_handle *trans, int mode, u64 start, u64 num_bytes, u64 min_size, loff_t actual_len, u64 *alloc_hint); -int btrfs_inode_check_errors(struct inode *inode); extern const struct dentry_operations btrfs_dentry_operations; #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS void btrfs_test_inode_set_ops(struct inode *inode); diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index fea31a4a6e36..4843cb994835 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2040,7 +2040,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) * flags for any errors that might have happened while doing * writeback of file data. */ - ret = btrfs_inode_check_errors(inode); + ret = filemap_check_errors(inode->i_mapping); inode_unlock(inode); goto out; } diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e6811c42e41e..0207622ec622 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -10543,21 +10543,6 @@ out_inode: } -/* Inspired by filemap_check_errors() */ -int btrfs_inode_check_errors(struct inode *inode) -{ - int ret = 0; - - if (test_bit(AS_ENOSPC, &inode->i_mapping->flags) && - test_and_clear_bit(AS_ENOSPC, &inode->i_mapping->flags)) - ret = -ENOSPC; - if (test_bit(AS_EIO, &inode->i_mapping->flags) && - test_and_clear_bit(AS_EIO, &inode->i_mapping->flags)) - ret = -EIO; - - return ret; -} - static const struct inode_operations btrfs_dir_inode_operations = { .getattr = btrfs_getattr, .lookup = btrfs_lookup, diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index ef9c55bc7907..8a84ebd8e7cc 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3961,7 +3961,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans, * i_mapping flags, so that the next fsync won't get * an outdated io error too. */ - btrfs_inode_check_errors(inode); + filemap_check_errors(inode->i_mapping); *ordered_io_error = true; break; } @@ -4198,7 +4198,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, * without writing to the log tree and the fsync must report the * file data write error and not commit the current transaction. */ - ret = btrfs_inode_check_errors(inode); + ret = filemap_check_errors(inode->i_mapping); if (ret) ctx->io_err = ret; process: