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>
This commit is contained in:
parent
4d0c5ba2ff
commit
f031221001
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue