linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -V2] ext4: Mark the buffer_heads as dirty and uptodate after prepare_write
@ 2008-11-07 13:12 Aneesh Kumar K.V
  2008-11-07 13:33 ` Theodore Tso
  0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2008-11-07 13:12 UTC (permalink / raw)
  To: cmm, tytso, sandeen, vallesroc, Solofo.Ramangalahy,
	cryptooctoploid
  Cc: linux-ext4, Aneesh Kumar K.V

We need to make sure we mark the buffer_heads as dirty and uptodate
so that block_write_full_page write them correctly.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/ext4/inode.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 95d0d12..f9461d7 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2333,6 +2333,15 @@ static int ext4_da_writepage(struct page *page,
 		ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE,
 						ext4_normal_get_block_write);
 		if (!ret) {
+			/*
+			 * We mark the buffer_head dirty and uptodate even
+			 * if we are not doing a block_write_full_page. This
+			 * make sure when writeback see the page again with
+			 * buffer_head present the buffer_head would have
+			 * the right flags
+			 */
+			block_commit_write(page, 0, PAGE_CACHE_SIZE);
+
 			page_bufs = page_buffers(page);
 			/* check whether all are mapped and non delay */
 			if (walk_page_buffers(NULL, page_bufs, 0, len, NULL,
-- 
1.6.0.3.640.g6331a


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

* Re: [PATCH -V2] ext4: Mark the buffer_heads as dirty and uptodate after prepare_write
  2008-11-07 13:12 [PATCH -V2] ext4: Mark the buffer_heads as dirty and uptodate after prepare_write Aneesh Kumar K.V
@ 2008-11-07 13:33 ` Theodore Tso
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Tso @ 2008-11-07 13:33 UTC (permalink / raw)
  To: Aneesh Kumar K.V
  Cc: cmm, sandeen, vallesroc, Solofo.Ramangalahy, cryptooctoploid,
	linux-ext4

Per discussion on IRC, we've Aneesh and I have concluded that the V1
patch is correct, and in fact calling block_commit_write() when we
will be redirtying the page (a) can cause problems if one or more
buffer heads on the page is marked for delayed allocation and so
bh->block_nr is 0, and (b) wastes disk bandwidth since the page
contents will be potentially written out twice.

So we'll be going with the V1 version of the patch, and pushing it to
Linus ASAP.

						- Ted

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

end of thread, other threads:[~2008-11-07 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-07 13:12 [PATCH -V2] ext4: Mark the buffer_heads as dirty and uptodate after prepare_write Aneesh Kumar K.V
2008-11-07 13:33 ` Theodore Tso

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).