From 50c07bb2e56fc12818247945069b5ef21ac72e6e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 28 Apr 2010 12:29:00 +0000 Subject: [PATCH] --- yaml --- r: 195823 b: refs/heads/master c: bd1556a146d46070049428dded306829cb65161d h: refs/heads/master i: 195821: ff28bba16f19470e3cbb5adac5fdcf24811ed524 195819: 438dddc4c0350e467c9c4baf383b7a0a88c030a7 195815: ceb35f352b441c39a25733fb699ae929f7a151f2 195807: 04337f34e79b910c7127402f20ccb32d23c441d1 v: v3 --- [refs] | 2 +- trunk/fs/xfs/linux-2.6/xfs_aops.c | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index d33d440e3015..ed3800908d72 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2b8f12b7e438fa6ba4a0f8f861871be0beb3a3e6 +refs/heads/master: bd1556a146d46070049428dded306829cb65161d diff --git a/trunk/fs/xfs/linux-2.6/xfs_aops.c b/trunk/fs/xfs/linux-2.6/xfs_aops.c index 1d51bdde5748..089eaca860b4 100644 --- a/trunk/fs/xfs/linux-2.6/xfs_aops.c +++ b/trunk/fs/xfs/linux-2.6/xfs_aops.c @@ -1065,7 +1065,7 @@ xfs_page_state_convert( unsigned long p_offset = 0; unsigned int type; __uint64_t end_offset; - pgoff_t end_index, last_index, tlast; + pgoff_t end_index, last_index; ssize_t size, len; int flags, err, imap_valid = 0, uptodate = 1; int page_dirty, count = 0; @@ -1260,15 +1260,22 @@ xfs_page_state_convert( xfs_start_page_writeback(page, 1, count); if (ioend && imap_valid) { - struct xfs_mount *m = XFS_I(inode)->i_mount; - xfs_off_t iomap_offset = XFS_FSB_TO_B(m, imap.br_startoff); - xfs_off_t iomap_bsize = XFS_FSB_TO_B(m, imap.br_blockcount); + xfs_off_t end_index; + + end_index = imap.br_startoff + imap.br_blockcount; + + /* to bytes */ + end_index <<= inode->i_blkbits; + + /* to pages */ + end_index = (end_index - 1) >> PAGE_CACHE_SHIFT; + + /* check against file size */ + if (end_index > last_index) + end_index = last_index; - offset = (iomap_offset + iomap_bsize - 1) >> - PAGE_CACHE_SHIFT; - tlast = min_t(pgoff_t, offset, last_index); xfs_cluster_write(inode, page->index + 1, &imap, &ioend, - wbc, startio, all_bh, tlast); + wbc, startio, all_bh, end_index); } if (iohead)