linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Btrfs: report error after failure inlining extent in compressed write path
@ 2014-10-09 20:15 Filipe Manana
  2014-10-09 20:15 ` [PATCH 2/2] Btrfs: make inode.c:compress_file_range() return void Filipe Manana
  2014-10-10  9:45 ` [PATCH 1/2 v2] Btrfs: report error after failure inlining extent in compressed write path Filipe Manana
  0 siblings, 2 replies; 3+ messages in thread
From: Filipe Manana @ 2014-10-09 20:15 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Filipe Manana

If cow_file_range_inline() failed, when called from compress_file_range(),
we were tagging the locked page for writeback, end its writeback and unlock it,
but not marking it with an error nor setting AS_EIO in inode's mapping flags.

This made it impossible for a caller of filemap_fdatawrite_range (writepages)
or filemap_fdatawait_range() to know that an error happened. And the return
value of compress_file_range() is useless because it's returned to a workqueue
task and not to the task calling filemap_fdatawrite_range (writepages).

This change applies on top of the previous patchset starting at the patch
titled:

    "[1/5] Btrfs: set page and mapping error on compressed write failure"

Which changed extent_clear_unlock_delalloc() to use SetPageError and
mapping_set_error().

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7635b1d..b91a171 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -538,6 +538,7 @@ cont:
 						     clear_flags, PAGE_UNLOCK |
 						     PAGE_CLEAR_DIRTY |
 						     PAGE_SET_WRITEBACK |
+						     PAGE_SET_ERROR |
 						     PAGE_END_WRITEBACK);
 			goto free_pages_out;
 		}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Btrfs: make inode.c:compress_file_range() return void
  2014-10-09 20:15 [PATCH 1/2] Btrfs: report error after failure inlining extent in compressed write path Filipe Manana
@ 2014-10-09 20:15 ` Filipe Manana
  2014-10-10  9:45 ` [PATCH 1/2 v2] Btrfs: report error after failure inlining extent in compressed write path Filipe Manana
  1 sibling, 0 replies; 3+ messages in thread
From: Filipe Manana @ 2014-10-09 20:15 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Filipe Manana

Its return value is useless, its single caller ignores it and can't do
anything with it anyway, since it's a workqueue task and not the task
calling filemap_fdatawrite_range (writepages) nor filemap_fdatawait_range().
Failure is communicated to such functions via start and end of writeback
with the respective pages tagged with an error and AS_EIO flag set in the
inode's imapping.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/inode.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b91a171..aef0fa3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -382,7 +382,7 @@ static inline int inode_need_compress(struct inode *inode)
  * are written in the same order that the flusher thread sent them
  * down.
  */
-static noinline int compress_file_range(struct inode *inode,
+static noinline void compress_file_range(struct inode *inode,
 					struct page *locked_page,
 					u64 start, u64 end,
 					struct async_cow *async_cow,
@@ -621,8 +621,7 @@ cleanup_and_bail_uncompressed:
 		*num_added += 1;
 	}
 
-out:
-	return ret;
+	return;
 
 free_pages_out:
 	for (i = 0; i < nr_pages_ret; i++) {
@@ -630,8 +629,6 @@ free_pages_out:
 		page_cache_release(pages[i]);
 	}
 	kfree(pages);
-
-	goto out;
 }
 
 static void free_async_extent_pages(struct async_extent *async_extent)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 1/2 v2] Btrfs: report error after failure inlining extent in compressed write path
  2014-10-09 20:15 [PATCH 1/2] Btrfs: report error after failure inlining extent in compressed write path Filipe Manana
  2014-10-09 20:15 ` [PATCH 2/2] Btrfs: make inode.c:compress_file_range() return void Filipe Manana
@ 2014-10-10  9:45 ` Filipe Manana
  1 sibling, 0 replies; 3+ messages in thread
From: Filipe Manana @ 2014-10-10  9:45 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Filipe Manana

If cow_file_range_inline() failed, when called from compress_file_range(),
we were tagging the locked page for writeback, end its writeback and unlock it,
but not marking it with an error nor setting AS_EIO in inode's mapping flags.

This made it impossible for a caller of filemap_fdatawrite_range (writepages)
or filemap_fdatawait_range() to know that an error happened. And the return
value of compress_file_range() is useless because it's returned to a workqueue
task and not to the task calling filemap_fdatawrite_range (writepages).

This change applies on top of the previous patchset starting at the patch
titled:

    "[1/5] Btrfs: set page and mapping error on compressed write failure"

Which changed extent_clear_unlock_delalloc() to use SetPageError and
mapping_set_error().

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---

V2: Use SET_PAGE_ERROR only if ret < 0, obviously. Thanks btrfs/056.

 fs/btrfs/inode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7635b1d..2b09425 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -527,7 +527,10 @@ cont:
 		if (ret <= 0) {
 			unsigned long clear_flags = EXTENT_DELALLOC |
 				EXTENT_DEFRAG;
+			unsigned long page_error_op;
+
 			clear_flags |= (ret < 0) ? EXTENT_DO_ACCOUNTING : 0;
+			page_error_op = ret < 0 ? PAGE_SET_ERROR : 0;
 
 			/*
 			 * inline extent creation worked or returned error,
@@ -538,6 +541,7 @@ cont:
 						     clear_flags, PAGE_UNLOCK |
 						     PAGE_CLEAR_DIRTY |
 						     PAGE_SET_WRITEBACK |
+						     page_error_op |
 						     PAGE_END_WRITEBACK);
 			goto free_pages_out;
 		}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-10  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-09 20:15 [PATCH 1/2] Btrfs: report error after failure inlining extent in compressed write path Filipe Manana
2014-10-09 20:15 ` [PATCH 2/2] Btrfs: make inode.c:compress_file_range() return void Filipe Manana
2014-10-10  9:45 ` [PATCH 1/2 v2] Btrfs: report error after failure inlining extent in compressed write path Filipe Manana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).