public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] splice: partial write handling fix
@ 2007-03-14 15:55 Dmitriy Monakhov
  2007-03-15 12:21 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitriy Monakhov @ 2007-03-14 15:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: axboe

currently if partial write has happened while ->commit_write() then page
wasn't marked as accessed and rebalanced. 

Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org>

diff --git a/fs/splice.c b/fs/splice.c
index 2fca6eb..bb1bf62 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -682,18 +682,25 @@ find_page:
 	}
 
 	ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len);
-	if (!ret) {
+	if (ret) {
+		if(ret == AOP_TRUNCATED_PAGE) {
+			page_cache_release(page);
+			goto find_page;
+		}
+		if (ret < 0)
+			goto out;
 		/*
-		 * Return the number of bytes written and mark page as
-		 * accessed, we are now done!
+		 * Partial write has happened, so 'ret' already initialized by
+		 * number of bytes written, Where is nothing we have to do here.
 		 */
+	} else
 		ret = this_len;
-		mark_page_accessed(page);
-		balance_dirty_pages_ratelimited(mapping);
-	} else if (ret == AOP_TRUNCATED_PAGE) {
-		page_cache_release(page);
-		goto find_page;
-	}
+	/*
+	 * Return the number of bytes written and mark page as
+	 * accessed, we are now done!
+	 */
+	mark_page_accessed(page);
+	balance_dirty_pages_ratelimited(mapping);
 out:
 	page_cache_release(page);
 	unlock_page(page);


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

end of thread, other threads:[~2007-03-15 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-14 15:55 [PATCH] splice: partial write handling fix Dmitriy Monakhov
2007-03-15 12:21 ` Jens Axboe
2007-03-15 13:46   ` Dmitriy Monakhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox