diff -urpN linux-2.6-xfs1/fs/xfs/linux-2.6/xfs_aops.c linux-2.6-xfs1.stk2/fs/xfs/linux-2.6/xfs_aops.c --- linux-2.6-xfs1/fs/xfs/linux-2.6/xfs_aops.c 2008-04-22 04:06:46.000000000 +0200 +++ linux-2.6-xfs1.stk2/fs/xfs/linux-2.6/xfs_aops.c 2008-04-27 02:38:51.000000000 +0200 @@ -935,17 +935,11 @@ xfs_page_state_convert( unsigned long p_offset = 0; unsigned int type; __uint64_t end_offset; - pgoff_t end_index, last_index, tlast; - ssize_t size, len; + pgoff_t end_index, last_index; int flags, err, iomap_valid = 0, uptodate = 1; int page_dirty, count = 0; - int trylock = 0; int all_bh = unmapped; - - if (startio) { - if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking) - trylock |= BMAPI_TRYLOCK; - } +#define len (1 << inode->i_blkbits) /* Is this page beyond the end of the file? */ offset = i_size_read(inode); @@ -975,7 +969,6 @@ xfs_page_state_convert( */ end_offset = min_t(unsigned long long, (xfs_off_t)(page->index + 1) << PAGE_CACHE_SHIFT, offset); - len = 1 << inode->i_blkbits; p_offset = min_t(unsigned long, end_offset & (PAGE_CACHE_SIZE - 1), PAGE_CACHE_SIZE); p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE; @@ -1031,13 +1024,18 @@ xfs_page_state_convert( flags = BMAPI_WRITE | BMAPI_IGNSTATE; } else if (buffer_delay(bh)) { type = IOMAP_DELAY; - flags = BMAPI_ALLOCATE | trylock; + flags = BMAPI_ALLOCATE; + if (startio && wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking) { + flags = BMAPI_ALLOCATE | BMAPI_TRYLOCK; + } } else { type = IOMAP_NEW; flags = BMAPI_WRITE | BMAPI_MMAP; } if (!iomap_valid) { + ssize_t size; + /* * if we didn't have a valid mapping then we * need to ensure that we put the new mapping @@ -1082,6 +1080,8 @@ xfs_page_state_convert( * underneath it. Map the extent by reading it. */ if (!iomap_valid || flags != BMAPI_READ) { + ssize_t size; + flags = BMAPI_READ; size = xfs_probe_cluster(inode, page, bh, head, 1); @@ -1129,6 +1129,8 @@ xfs_page_state_convert( xfs_start_page_writeback(page, wbc, 1, count); if (ioend && iomap_valid) { + pgoff_t tlast; + offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >> PAGE_CACHE_SHIFT; tlast = min_t(pgoff_t, offset, last_index); @@ -1156,6 +1158,7 @@ error: ClearPageUptodate(page); } return err; +#undef len } /*