All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2: Fill-in the unused portion of the block with zeros by dio_zero_block()
@ 2015-09-09  1:55 jiangyiwen
  2015-09-09  2:13 ` Joseph Qi
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: jiangyiwen @ 2015-09-09  1:55 UTC (permalink / raw)
  To: ocfs2-devel

A simplified test case is (this case from Ryan):
1) dd if=/dev/zero of=/mnt/hello bs=512 count=1 oflag=direct;
2) truncate /mnt/hello -s 2097152
file 'hello' is not exist before test. After this command,
file 'hello' should be all zero. But 512~4096 is some random data.

Setting bh state to new when get a new block, if so,
direct_io_worker()->dio_zero_block() will fill-in the unused portion
of the block with zero.

Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>
---
 fs/ocfs2/aops.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 1a35c61..bd106b9 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -581,6 +581,7 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
 			ret = -EIO;
 			goto bail;
 		}
+		set_buffer_new(bh_result);
 	}

 	/*
-- 
1.8.3.4

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

end of thread, other threads:[~2015-09-15  2:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09  1:55 [Ocfs2-devel] [PATCH] ocfs2: Fill-in the unused portion of the block with zeros by dio_zero_block() jiangyiwen
2015-09-09  2:13 ` Joseph Qi
2015-09-09  5:16 ` Zhen Ren
2015-09-09  9:13   ` Joseph Qi
2015-09-09 10:42     ` Zhen Ren
2015-09-10  1:48       ` jiangyiwen
2015-09-09  9:14   ` jiangyiwen
2015-09-10  1:53 ` ryding
2015-09-14 22:22   ` Andrew Morton
2015-09-15  2:34     ` ryding
2015-09-14 22:13 ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.