aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-09-16 06:44:21 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2016-09-16 06:44:21 -0400
commitf0312210010bf063c29efe112b0d9accbc9191b3 (patch)
treecbd83b7b3306eb7ecda01d027b769231cf61f952
parent4d0c5ba2ff79ef9f5188998b29fd28fcb05f3667 (diff)
btrfs: use filemap_check_errors()
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Omar Sandoval <osandov@fb.com> Cc: Chris Mason <clm@fb.com>
-rw-r--r--fs/btrfs/ctree.h1
-rw-r--r--fs/btrfs/file.c2
-rw-r--r--fs/btrfs/inode.c15
-rw-r--r--fs/btrfs/tree-log.c4
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,
3161 struct btrfs_trans_handle *trans, int mode, 3161 struct btrfs_trans_handle *trans, int mode,
3162 u64 start, u64 num_bytes, u64 min_size, 3162 u64 start, u64 num_bytes, u64 min_size,
3163 loff_t actual_len, u64 *alloc_hint); 3163 loff_t actual_len, u64 *alloc_hint);
3164int btrfs_inode_check_errors(struct inode *inode);
3165extern const struct dentry_operations btrfs_dentry_operations; 3164extern const struct dentry_operations btrfs_dentry_operations;
3166#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS 3165#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
3167void btrfs_test_inode_set_ops(struct inode *inode); 3166void 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)
2040 * flags for any errors that might have happened while doing 2040 * flags for any errors that might have happened while doing
2041 * writeback of file data. 2041 * writeback of file data.
2042 */ 2042 */
2043 ret = btrfs_inode_check_errors(inode); 2043 ret = filemap_check_errors(inode->i_mapping);
2044 inode_unlock(inode); 2044 inode_unlock(inode);
2045 goto out; 2045 goto out;
2046 } 2046 }
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:
10543 10543
10544} 10544}
10545 10545
10546/* Inspired by filemap_check_errors() */
10547int btrfs_inode_check_errors(struct inode *inode)
10548{
10549 int ret = 0;
10550
10551 if (test_bit(AS_ENOSPC, &inode->i_mapping->flags) &&
10552 test_and_clear_bit(AS_ENOSPC, &inode->i_mapping->flags))
10553 ret = -ENOSPC;
10554 if (test_bit(AS_EIO, &inode->i_mapping->flags) &&
10555 test_and_clear_bit(AS_EIO, &inode->i_mapping->flags))
10556 ret = -EIO;
10557
10558 return ret;
10559}
10560
10561static const struct inode_operations btrfs_dir_inode_operations = { 10546static const struct inode_operations btrfs_dir_inode_operations = {
10562 .getattr = btrfs_getattr, 10547 .getattr = btrfs_getattr,
10563 .lookup = btrfs_lookup, 10548 .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,
3961 * i_mapping flags, so that the next fsync won't get 3961 * i_mapping flags, so that the next fsync won't get
3962 * an outdated io error too. 3962 * an outdated io error too.
3963 */ 3963 */
3964 btrfs_inode_check_errors(inode); 3964 filemap_check_errors(inode->i_mapping);
3965 *ordered_io_error = true; 3965 *ordered_io_error = true;
3966 break; 3966 break;
3967 } 3967 }
@@ -4198,7 +4198,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
4198 * without writing to the log tree and the fsync must report the 4198 * without writing to the log tree and the fsync must report the
4199 * file data write error and not commit the current transaction. 4199 * file data write error and not commit the current transaction.
4200 */ 4200 */
4201 ret = btrfs_inode_check_errors(inode); 4201 ret = filemap_check_errors(inode->i_mapping);
4202 if (ret) 4202 if (ret)
4203 ctx->io_err = ret; 4203 ctx->io_err = ret;
4204process: 4204process: