Commit 333427a5 authored by Jeff Layton's avatar Jeff Layton

btrfs: minimal conversion to errseq_t writeback error reporting on fsync

Just check and advance the errseq_t in the file before returning, and
use an errseq_t based check for writeback errors.

Other internal callers of filemap_* functions are left as-is.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
parent 1b180274
...@@ -2011,7 +2011,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -2011,7 +2011,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
struct btrfs_log_ctx ctx; struct btrfs_log_ctx ctx;
int ret = 0; int ret = 0, err;
bool full_sync = 0; bool full_sync = 0;
u64 len; u64 len;
...@@ -2030,7 +2030,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -2030,7 +2030,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
*/ */
ret = start_ordered_ops(inode, start, end); ret = start_ordered_ops(inode, start, end);
if (ret) if (ret)
return ret; goto out;
inode_lock(inode); inode_lock(inode);
atomic_inc(&root->log_batch); atomic_inc(&root->log_batch);
...@@ -2135,10 +2135,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -2135,10 +2135,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
* An ordered extent might have started before and completed * An ordered extent might have started before and completed
* already with io errors, in which case the inode was not * already with io errors, in which case the inode was not
* updated and we end up here. So check the inode's mapping * updated and we end up here. So check the inode's mapping
* flags for any errors that might have happened while doing * for any errors that might have happened since we last
* writeback of file data. * checked called fsync.
*/ */
ret = filemap_check_errors(inode->i_mapping); ret = filemap_check_wb_err(inode->i_mapping, file->f_wb_err);
inode_unlock(inode); inode_unlock(inode);
goto out; goto out;
} }
...@@ -2227,6 +2227,9 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -2227,6 +2227,9 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
ret = btrfs_end_transaction(trans); ret = btrfs_end_transaction(trans);
} }
out: out:
err = file_check_and_advance_wb_err(file);
if (!ret)
ret = err;
return ret > 0 ? -EIO : ret; return ret > 0 ? -EIO : ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment