aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_aops.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-04-28 08:29:00 -0400
committerAlex Elder <aelder@sgi.com>2010-05-19 10:58:20 -0400
commitbd1556a146d46070049428dded306829cb65161d (patch)
tree3ce3c35fb3359a83766a0442156cee692479037b /fs/xfs/linux-2.6/xfs_aops.c
parent2b8f12b7e438fa6ba4a0f8f861871be0beb3a3e6 (diff)
xfs: clean up end index calculation in xfs_page_state_convert
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 1d51bdde5748..089eaca860b4 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1065,7 +1065,7 @@ xfs_page_state_convert(
1065 unsigned long p_offset = 0; 1065 unsigned long p_offset = 0;
1066 unsigned int type; 1066 unsigned int type;
1067 __uint64_t end_offset; 1067 __uint64_t end_offset;
1068 pgoff_t end_index, last_index, tlast; 1068 pgoff_t end_index, last_index;
1069 ssize_t size, len; 1069 ssize_t size, len;
1070 int flags, err, imap_valid = 0, uptodate = 1; 1070 int flags, err, imap_valid = 0, uptodate = 1;
1071 int page_dirty, count = 0; 1071 int page_dirty, count = 0;
@@ -1260,15 +1260,22 @@ xfs_page_state_convert(
1260 xfs_start_page_writeback(page, 1, count); 1260 xfs_start_page_writeback(page, 1, count);
1261 1261
1262 if (ioend && imap_valid) { 1262 if (ioend && imap_valid) {
1263 struct xfs_mount *m = XFS_I(inode)->i_mount; 1263 xfs_off_t end_index;
1264 xfs_off_t iomap_offset = XFS_FSB_TO_B(m, imap.br_startoff); 1264
1265 xfs_off_t iomap_bsize = XFS_FSB_TO_B(m, imap.br_blockcount); 1265 end_index = imap.br_startoff + imap.br_blockcount;
1266
1267 /* to bytes */
1268 end_index <<= inode->i_blkbits;
1269
1270 /* to pages */
1271 end_index = (end_index - 1) >> PAGE_CACHE_SHIFT;
1272
1273 /* check against file size */
1274 if (end_index > last_index)
1275 end_index = last_index;
1266 1276
1267 offset = (iomap_offset + iomap_bsize - 1) >>
1268 PAGE_CACHE_SHIFT;
1269 tlast = min_t(pgoff_t, offset, last_index);
1270 xfs_cluster_write(inode, page->index + 1, &imap, &ioend, 1277 xfs_cluster_write(inode, page->index + 1, &imap, &ioend,
1271 wbc, startio, all_bh, tlast); 1278 wbc, startio, all_bh, end_index);
1272 } 1279 }
1273 1280
1274 if (iohead) 1281 if (iohead)