Re: Problem with delayed allocation

Aneesh Kumar K.V
2008-08-06T10:06:12Z

On Tue, Aug 05, 2008 at 06:51:33PM +0530, Aneesh Kumar K.V wrote:
> On Tue, Aug 05, 2008 at 12:22:17PM +0530, Aneesh Kumar K.V wrote:
> > On Tue, Aug 05, 2008 at 02:44:28AM -0400, Theodore Tso wrote:
> > > On Mon, Aug 04, 2008 at 10:05:05PM +0530, Aneesh Kumar K.V wrote:
> > > >
> > > > This is the complete patch that I have. I haven't fully tested it
> > > > (right now waiting for the machine to be free). This should apply
> > > > after stable-boundary-undo.patch
> > >
> > > Umm... the patch doesn't apply right after the stable boundary udo
> > > patch.
> > >
> > > - Ted
> >
> > I did a fresh git pull and updated the patch. I also accumulated few
> > changes after words while testing on ABAT. Attaching both the patches
> > below. The patches apply after ext4_journal_credits_fix_for_writepages.patch
> > in the patch queue.
>
> I still see the problem with the below changes. Now that i have read
> the writeback path more closely I am not sure how it will guarantee
> that all dirty pages of the inode are written back to disk before
> generic_sync_sb_inodes return.
>

Below changes fixed it for me. range_start was used in the loop in
generic_sync_sb_inodes and since we were checking for !range_start
we missed restoring wbc->range_start for range_start == 0.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 472a6a7..ea1a8db 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2241,14 +2241,14 @@ static int ext4_da_writepages(struct address_space *mapping,
if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
return 0;

- if (!wbc->range_cyclic) {
+ if (!wbc->range_cyclic)
/*
* If range_cyclic is not set force range_cont
* and save the old writeback_index
*/
wbc->range_cont = 1;
- range_start = wbc->range_start;
- }
+
+ range_start = wbc->range_start;
pages_skipped = wbc->pages_skipped;

restart_loop:
@@ -2322,8 +2322,7 @@ static int ext4_da_writepages(struct address_space *mapping,

out_writepages:
wbc->nr_to_write = to_write;
- if (range_start)
- wbc->range_start = range_start;
+ wbc->range_start = range_start;
return ret;
}