summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2017-07-06 07:02:31 -0400
committerJeff Layton <jlayton@redhat.com>2017-07-06 07:02:31 -0400
commit333427a505be1e10d8da13427dc0c33ec1976b99 (patch)
treeea09f92ec458c48fe51ba5277f9e1806945873a3 /fs/btrfs/file.c
parent1b180274f5bfa0b8b05f7e55d9962f77f387be9c (diff)
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: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index da1096eb1a40..deeb4799da5c 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2011,7 +2011,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
2011 struct btrfs_root *root = BTRFS_I(inode)->root; 2011 struct btrfs_root *root = BTRFS_I(inode)->root;
2012 struct btrfs_trans_handle *trans; 2012 struct btrfs_trans_handle *trans;
2013 struct btrfs_log_ctx ctx; 2013 struct btrfs_log_ctx ctx;
2014 int ret = 0; 2014 int ret = 0, err;
2015 bool full_sync = 0; 2015 bool full_sync = 0;
2016 u64 len; 2016 u64 len;
2017 2017
@@ -2030,7 +2030,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
2030 */ 2030 */
2031 ret = start_ordered_ops(inode, start, end); 2031 ret = start_ordered_ops(inode, start, end);
2032 if (ret) 2032 if (ret)
2033 return ret; 2033 goto out;
2034 2034
2035 inode_lock(inode); 2035 inode_lock(inode);
2036 atomic_inc(&root->log_batch); 2036 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 * An ordered extent might have started before and completed 2135 * An ordered extent might have started before and completed
2136 * already with io errors, in which case the inode was not 2136 * already with io errors, in which case the inode was not
2137 * updated and we end up here. So check the inode's mapping 2137 * updated and we end up here. So check the inode's mapping
2138 * flags for any errors that might have happened while doing 2138 * for any errors that might have happened since we last
2139 * writeback of file data. 2139 * checked called fsync.
2140 */ 2140 */
2141 ret = filemap_check_errors(inode->i_mapping); 2141 ret = filemap_check_wb_err(inode->i_mapping, file->f_wb_err);
2142 inode_unlock(inode); 2142 inode_unlock(inode);
2143 goto out; 2143 goto out;
2144 } 2144 }
@@ -2227,6 +2227,9 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
2227 ret = btrfs_end_transaction(trans); 2227 ret = btrfs_end_transaction(trans);
2228 } 2228 }
2229out: 2229out:
2230 err = file_check_and_advance_wb_err(file);
2231 if (!ret)
2232 ret = err;
2230 return ret > 0 ? -EIO : ret; 2233 return ret > 0 ? -EIO : ret;
2231} 2234}
2232 2235