Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Iliopoulos <ailiopoulos@suse.com>2019-06-12 16:19:55 +0200
committerAnthony Iliopoulos <ailiopoulos@suse.com>2019-06-12 16:19:55 +0200
commita20daf378483ef66076a44c56c5e33eb2750029e (patch)
tree46825b2575858da2d2afd93b1e9a188ae360afcf
parentd875624dd3ab9bf1e88dfe23a8fd3a5d565e6196 (diff)
xfs: refactor the tail of xfs_writepage_map (bsc#1138016).
-rw-r--r--patches.fixes/xfs-refactor-the-tail-of-xfs_writepage_map.patch113
-rw-r--r--series.conf1
2 files changed, 114 insertions, 0 deletions
diff --git a/patches.fixes/xfs-refactor-the-tail-of-xfs_writepage_map.patch b/patches.fixes/xfs-refactor-the-tail-of-xfs_writepage_map.patch
new file mode 100644
index 0000000000..ed1b2f742b
--- /dev/null
+++ b/patches.fixes/xfs-refactor-the-tail-of-xfs_writepage_map.patch
@@ -0,0 +1,113 @@
+From 8e1f065bea1b1c128c92ef7e386779a23cd5d342 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Wed, 11 Jul 2018 22:26:04 -0700
+Subject: [PATCH] xfs: refactor the tail of xfs_writepage_map
+Git-commit: 8e1f065bea1b1c128c92ef7e386779a23cd5d342
+Patch-mainline: v4.19-rc1
+References: bsc#1138016
+
+Rejuggle how we deal with the different error vs non-error and have
+ioends vs not have ioend cases to keep the fast path streamlined, and
+the duplicate code at a minimum.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Brian Foster <bfoster@redhat.com>
+Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
+Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
+Acked-by: Anthony Iliopoulos <ailiopoulos@suse.com>
+
+---
+ fs/xfs/xfs_aops.c | 65 +++++++++++++++++++++++++++----------------------------
+ 1 file changed, 32 insertions(+), 33 deletions(-)
+
+diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
+index af9224ea4ebf..c8e0d3055153 100644
+--- a/fs/xfs/xfs_aops.c
++++ b/fs/xfs/xfs_aops.c
+@@ -854,7 +854,14 @@ xfs_writepage_map(
+ * submission of outstanding ioends on the writepage context so they are
+ * treated correctly on error.
+ */
+- if (count) {
++ if (unlikely(error)) {
++ if (!count) {
++ xfs_aops_discard_page(page);
++ ClearPageUptodate(page);
++ unlock_page(page);
++ goto done;
++ }
++
+ /*
+ * If the page was not fully cleaned, we need to ensure that the
+ * higher layers come back to it correctly. That means we need
+@@ -863,43 +870,35 @@ xfs_writepage_map(
+ * so another attempt to write this page in this writeback sweep
+ * will be made.
+ */
+- if (error) {
+- set_page_writeback_keepwrite(page);
+- } else {
+- clear_page_dirty_for_io(page);
+- set_page_writeback(page);
+- }
+- unlock_page(page);
+-
+- /*
+- * Preserve the original error if there was one, otherwise catch
+- * submission errors here and propagate into subsequent ioend
+- * submissions.
+- */
+- list_for_each_entry_safe(ioend, next, &submit_list, io_list) {
+- int error2;
+-
+- list_del_init(&ioend->io_list);
+- error2 = xfs_submit_ioend(wbc, ioend, error);
+- if (error2 && !error)
+- error = error2;
+- }
+- } else if (error) {
+- xfs_aops_discard_page(page);
+- ClearPageUptodate(page);
+- unlock_page(page);
++ set_page_writeback_keepwrite(page);
+ } else {
+- /*
+- * We can end up here with no error and nothing to write if we
+- * race with a partial page truncate on a sub-page block sized
+- * filesystem. In that case we need to mark the page clean.
+- */
+ clear_page_dirty_for_io(page);
+ set_page_writeback(page);
+- unlock_page(page);
+- end_page_writeback(page);
+ }
+
++ unlock_page(page);
++
++ /*
++ * Preserve the original error if there was one, otherwise catch
++ * submission errors here and propagate into subsequent ioend
++ * submissions.
++ */
++ list_for_each_entry_safe(ioend, next, &submit_list, io_list) {
++ int error2;
++
++ list_del_init(&ioend->io_list);
++ error2 = xfs_submit_ioend(wbc, ioend, error);
++ if (error2 && !error)
++ error = error2;
++ }
++
++ /*
++ * We can end up here with no error and nothing to write if we race with
++ * a partial page truncate on a sub-page block sized filesystem.
++ */
++ if (!count)
++ end_page_writeback(page);
++done:
+ mapping_set_error(page->mapping, error);
+ return error;
+ }
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index ca5da0ef1c..82a344f32f 100644
--- a/series.conf
+++ b/series.conf
@@ -18116,6 +18116,7 @@
patches.fixes/xfs-don-t-look-at-buffer-heads-in-xfs_add_to_ioend.patch
patches.fixes/xfs-move-all-writeback-buffer_head-manipulation-into.patch
patches.fixes/xfs-remove-xfs_start_page_writeback.patch
+ patches.fixes/xfs-refactor-the-tail-of-xfs_writepage_map.patch
patches.fixes/xfs-detect-and-fix-bad-summary-counts-at-mount.patch
patches.fixes/xfs-refactor-unmount-record-write.patch
patches.fixes/xfs-force-summary-counter-recalc-at-next-mount.patch