diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-04-28 08:28:54 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-05-19 10:58:17 -0400 |
commit | 8699bb0a480193e62d5ccb9c86e2c26b407090a8 (patch) | |
tree | aabcc9cd0800cf5c0d0605d46a104ed825f90db6 /fs/xfs/linux-2.6/xfs_aops.c | |
parent | 9563b3d8998c78d5b7e718b546d5f68037c494fe (diff) |
xfs: report iomap_offset and iomap_bsize in block base
Report the iomap_offset and iomap_bsize fields of struct xfs_iomap
in terms of fsblocks instead of in terms of disk blocks. Shift the
byte conversions into the callers temporarily, but they will
disappear or get cleaned up later.
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.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 577d0b448732..303a779406c0 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -320,11 +320,16 @@ xfs_map_blocks( | |||
320 | 320 | ||
321 | STATIC int | 321 | STATIC int |
322 | xfs_iomap_valid( | 322 | xfs_iomap_valid( |
323 | struct inode *inode, | ||
323 | xfs_iomap_t *iomapp, | 324 | xfs_iomap_t *iomapp, |
324 | loff_t offset) | 325 | loff_t offset) |
325 | { | 326 | { |
326 | return offset >= iomapp->iomap_offset && | 327 | struct xfs_mount *mp = XFS_I(inode)->i_mount; |
327 | offset < iomapp->iomap_offset + iomapp->iomap_bsize; | 328 | xfs_off_t iomap_offset = XFS_FSB_TO_B(mp, iomapp->iomap_offset); |
329 | xfs_off_t iomap_bsize = XFS_FSB_TO_B(mp, iomapp->iomap_bsize); | ||
330 | |||
331 | return offset >= iomap_offset && | ||
332 | offset < iomap_offset + iomap_bsize; | ||
328 | } | 333 | } |
329 | 334 | ||
330 | /* | 335 | /* |
@@ -561,11 +566,13 @@ xfs_map_buffer( | |||
561 | xfs_off_t offset) | 566 | xfs_off_t offset) |
562 | { | 567 | { |
563 | sector_t bn; | 568 | sector_t bn; |
569 | struct xfs_mount *m = XFS_I(inode)->i_mount; | ||
570 | xfs_off_t iomap_offset = XFS_FSB_TO_B(m, mp->iomap_offset); | ||
564 | 571 | ||
565 | ASSERT(mp->iomap_bn != IOMAP_DADDR_NULL); | 572 | ASSERT(mp->iomap_bn != IOMAP_DADDR_NULL); |
566 | 573 | ||
567 | bn = (mp->iomap_bn >> (inode->i_blkbits - BBSHIFT)) + | 574 | bn = (mp->iomap_bn >> (inode->i_blkbits - BBSHIFT)) + |
568 | ((offset - mp->iomap_offset) >> inode->i_blkbits); | 575 | ((offset - iomap_offset) >> inode->i_blkbits); |
569 | 576 | ||
570 | ASSERT(bn || XFS_IS_REALTIME_INODE(XFS_I(inode))); | 577 | ASSERT(bn || XFS_IS_REALTIME_INODE(XFS_I(inode))); |
571 | 578 | ||
@@ -806,7 +813,7 @@ xfs_convert_page( | |||
806 | else | 813 | else |
807 | type = IOMAP_DELAY; | 814 | type = IOMAP_DELAY; |
808 | 815 | ||
809 | if (!xfs_iomap_valid(mp, offset)) { | 816 | if (!xfs_iomap_valid(inode, mp, offset)) { |
810 | done = 1; | 817 | done = 1; |
811 | continue; | 818 | continue; |
812 | } | 819 | } |
@@ -1116,7 +1123,7 @@ xfs_page_state_convert( | |||
1116 | } | 1123 | } |
1117 | 1124 | ||
1118 | if (iomap_valid) | 1125 | if (iomap_valid) |
1119 | iomap_valid = xfs_iomap_valid(&iomap, offset); | 1126 | iomap_valid = xfs_iomap_valid(inode, &iomap, offset); |
1120 | 1127 | ||
1121 | /* | 1128 | /* |
1122 | * First case, map an unwritten extent and prepare for | 1129 | * First case, map an unwritten extent and prepare for |
@@ -1171,7 +1178,7 @@ xfs_page_state_convert( | |||
1171 | &iomap, flags); | 1178 | &iomap, flags); |
1172 | if (err) | 1179 | if (err) |
1173 | goto error; | 1180 | goto error; |
1174 | iomap_valid = xfs_iomap_valid(&iomap, offset); | 1181 | iomap_valid = xfs_iomap_valid(inode, &iomap, offset); |
1175 | } | 1182 | } |
1176 | if (iomap_valid) { | 1183 | if (iomap_valid) { |
1177 | xfs_map_at_offset(inode, bh, &iomap, offset); | 1184 | xfs_map_at_offset(inode, bh, &iomap, offset); |
@@ -1201,7 +1208,7 @@ xfs_page_state_convert( | |||
1201 | &iomap, flags); | 1208 | &iomap, flags); |
1202 | if (err) | 1209 | if (err) |
1203 | goto error; | 1210 | goto error; |
1204 | iomap_valid = xfs_iomap_valid(&iomap, offset); | 1211 | iomap_valid = xfs_iomap_valid(inode, &iomap, offset); |
1205 | } | 1212 | } |
1206 | 1213 | ||
1207 | /* | 1214 | /* |
@@ -1241,7 +1248,11 @@ xfs_page_state_convert( | |||
1241 | xfs_start_page_writeback(page, 1, count); | 1248 | xfs_start_page_writeback(page, 1, count); |
1242 | 1249 | ||
1243 | if (ioend && iomap_valid) { | 1250 | if (ioend && iomap_valid) { |
1244 | offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >> | 1251 | struct xfs_mount *m = XFS_I(inode)->i_mount; |
1252 | xfs_off_t iomap_offset = XFS_FSB_TO_B(m, iomap.iomap_offset); | ||
1253 | xfs_off_t iomap_bsize = XFS_FSB_TO_B(m, iomap.iomap_bsize); | ||
1254 | |||
1255 | offset = (iomap_offset + iomap_bsize - 1) >> | ||
1245 | PAGE_CACHE_SHIFT; | 1256 | PAGE_CACHE_SHIFT; |
1246 | tlast = min_t(pgoff_t, offset, last_index); | 1257 | tlast = min_t(pgoff_t, offset, last_index); |
1247 | xfs_cluster_write(inode, page->index + 1, &iomap, &ioend, | 1258 | xfs_cluster_write(inode, page->index + 1, &iomap, &ioend, |
@@ -1512,11 +1523,14 @@ __xfs_get_blocks( | |||
1512 | } | 1523 | } |
1513 | 1524 | ||
1514 | if (direct || size > (1 << inode->i_blkbits)) { | 1525 | if (direct || size > (1 << inode->i_blkbits)) { |
1515 | xfs_off_t iomap_delta = offset - iomap.iomap_offset; | 1526 | struct xfs_mount *mp = XFS_I(inode)->i_mount; |
1527 | xfs_off_t iomap_offset = XFS_FSB_TO_B(mp, iomap.iomap_offset); | ||
1528 | xfs_off_t iomap_delta = offset - iomap_offset; | ||
1529 | xfs_off_t iomap_bsize = XFS_FSB_TO_B(mp, iomap.iomap_bsize); | ||
1516 | 1530 | ||
1517 | ASSERT(iomap.iomap_bsize - iomap_delta > 0); | 1531 | ASSERT(iomap_bsize - iomap_delta > 0); |
1518 | offset = min_t(xfs_off_t, | 1532 | offset = min_t(xfs_off_t, |
1519 | iomap.iomap_bsize - iomap_delta, size); | 1533 | iomap_bsize - iomap_delta, size); |
1520 | bh_result->b_size = (ssize_t)min_t(xfs_off_t, LONG_MAX, offset); | 1534 | bh_result->b_size = (ssize_t)min_t(xfs_off_t, LONG_MAX, offset); |
1521 | } | 1535 | } |
1522 | 1536 | ||