aboutsummaryrefslogtreecommitdiffstats
diff options
authorFilipe Manana <fdmanana@suse.com>2026-04-27 15:37:41 +0100
committerDavid Sterba <dsterba@suse.com>2026-05-24 03:01:07 +0200
commit8df7debe4ee5aee2ad18558b4a8b2cacd8a88153 (patch)
tree996011c64223e6e664fb2afe9836cb63f2356c32
parent42399725563657d9640fdb09596a6841378f613f (diff)
downloadlinux-next-history-8df7debe4ee5aee2ad18558b4a8b2cacd8a88153.tar.gz
btrfs: remove redundant writeback error check during fsync
If we can skip logging the inode during fsync, we check for writeback errors in the inode's mapping by calling filemap_check_wb_err() and then jump to the 'out_release_extents' label, which in turn jumps to the 'out' label under which we check again for a writeback error by calling file_check_and_advance_wb_err(). So the filemap_check_wb_err() ends up being redundant. This happens since commit 333427a505be ("btrfs: minimal conversion to errseq_t writeback error reporting on fsync"). Remove the filemap_check_wb_err() call. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/file.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 42914c9785e54..f77ccef837b96 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1688,14 +1688,6 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
* reason, it's no longer relevant.
*/
clear_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags);
- /*
- * An ordered extent might have started before and completed
- * already with io errors, in which case the inode was not
- * updated and we end up here. So check the inode's mapping
- * for any errors that might have happened since we last
- * checked called fsync.
- */
- ret = filemap_check_wb_err(inode->vfs_inode.i_mapping, file->f_wb_err);
goto out_release_extents;
}
@@ -1811,6 +1803,10 @@ out:
ASSERT(list_empty(&ctx.list));
ASSERT(list_empty(&ctx.conflict_inodes));
ASSERT(ret <= 0, "ret=%d", ret);
+ /*
+ * Ordered extents might have started and completed before this fsync,
+ * so check for any io errors and advance the writeback error sequence.
+ */
err = file_check_and_advance_wb_err(file);
if (!ret)
ret = err;