xfs
[Top] [All Lists]

Re: Review: Fix sub-page zeroing for buffered writes into unwritten exte

To: David Chinner <dgc@xxxxxxx>
Subject: Re: Review: Fix sub-page zeroing for buffered writes into unwritten extents
From: Lachlan McIlroy <lachlan@xxxxxxx>
Date: Wed, 24 Jan 2007 16:44:04 +0000
Cc: xfs-dev@xxxxxxx, xfs@xxxxxxxxxxx
In-reply-to: <20070123224704.GH33919298@xxxxxxxxxxxxxxxxx>
Organization: SGI
References: <20070123224704.GH33919298@xxxxxxxxxxxxxxxxx>
Reply-to: lachlan@xxxxxxx
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.7.12) Gecko/20050920
Dave,

I'm trying to understand what the sequence of events is here.

If we write to an unwritten extent then will __xfs_get_blocks()
be called with create=1 and flags=BMAPI_WRITE?  And calling
bhv_vop_bmap() with flags set to BMAPI_WRITE will cause xfs_iomap()
to set iomap_flags to IOMAP_NEW?  The combination of create=1 and
iomap_flags=IOMAP_NEW in __xfs_get_blocks() should result in calling
set_buffer_new(), right?

I must be missing something...

Lachlan

David Chinner wrote:
Simple test case:

prealloc large file
write 3000 bytes to the middle of the file
read back file

The data in the block where the 3000 bytes was written has
non-zero garbage around it both in memory and on disk.

The problem is a buffer mapping problem. When we copy data
into an unwritten buffer, we have the create flag set which
means we map the buffer. We then mark the buffer as unwritten,
and do some more checks. Because the buffer is mapped, we do
not set the buffer_new() flag on the buffer, which means when
we return to the generic code, it does not do sub-block zeroing
of the unwritten areas of the block.

The following patch fixes the problem. Comments?

Cheers,

Dave.


<Prev in Thread] Current Thread [Next in Thread>