diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 58fc7ade90b5..4b6bfdb8251c 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -487,28 +487,37 @@ xfs_add_to_ioend( | |||
487 | } | 487 | } |
488 | 488 | ||
489 | STATIC void | 489 | STATIC void |
490 | xfs_map_buffer( | ||
491 | struct buffer_head *bh, | ||
492 | xfs_iomap_t *mp, | ||
493 | xfs_off_t offset, | ||
494 | uint block_bits) | ||
495 | { | ||
496 | sector_t bn; | ||
497 | |||
498 | ASSERT(mp->iomap_bn != IOMAP_DADDR_NULL); | ||
499 | |||
500 | bn = (mp->iomap_bn >> (block_bits - BBSHIFT)) + | ||
501 | ((offset - mp->iomap_offset) >> block_bits); | ||
502 | |||
503 | ASSERT(bn || (mp->iomap_flags & IOMAP_REALTIME)); | ||
504 | |||
505 | bh->b_blocknr = bn; | ||
506 | set_buffer_mapped(bh); | ||
507 | } | ||
508 | |||
509 | STATIC void | ||
490 | xfs_map_at_offset( | 510 | xfs_map_at_offset( |
491 | struct buffer_head *bh, | 511 | struct buffer_head *bh, |
492 | loff_t offset, | 512 | loff_t offset, |
493 | int block_bits, | 513 | int block_bits, |
494 | xfs_iomap_t *iomapp) | 514 | xfs_iomap_t *iomapp) |
495 | { | 515 | { |
496 | xfs_daddr_t bn; | ||
497 | int sector_shift; | ||
498 | |||
499 | ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE)); | 516 | ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE)); |
500 | ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY)); | 517 | ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY)); |
501 | ASSERT(iomapp->iomap_bn != IOMAP_DADDR_NULL); | ||
502 | |||
503 | sector_shift = block_bits - BBSHIFT; | ||
504 | bn = (iomapp->iomap_bn >> sector_shift) + | ||
505 | ((offset - iomapp->iomap_offset) >> block_bits); | ||
506 | |||
507 | ASSERT(bn || (iomapp->iomap_flags & IOMAP_REALTIME)); | ||
508 | ASSERT((bn << sector_shift) >= iomapp->iomap_bn); | ||
509 | 518 | ||
510 | lock_buffer(bh); | 519 | lock_buffer(bh); |
511 | bh->b_blocknr = bn; | 520 | xfs_map_buffer(bh, iomapp, offset, block_bits); |
512 | bh->b_bdev = iomapp->iomap_target->bt_bdev; | 521 | bh->b_bdev = iomapp->iomap_target->bt_bdev; |
513 | set_buffer_mapped(bh); | 522 | set_buffer_mapped(bh); |
514 | clear_buffer_delay(bh); | 523 | clear_buffer_delay(bh); |
@@ -1246,21 +1255,13 @@ __linvfs_get_block( | |||
1246 | return 0; | 1255 | return 0; |
1247 | 1256 | ||
1248 | if (iomap.iomap_bn != IOMAP_DADDR_NULL) { | 1257 | if (iomap.iomap_bn != IOMAP_DADDR_NULL) { |
1249 | xfs_daddr_t bn; | 1258 | /* |
1250 | xfs_off_t delta; | 1259 | * For unwritten extents do not report a disk address on |
1251 | |||
1252 | /* For unwritten extents do not report a disk address on | ||
1253 | * the read case (treat as if we're reading into a hole). | 1260 | * the read case (treat as if we're reading into a hole). |
1254 | */ | 1261 | */ |
1255 | if (create || !(iomap.iomap_flags & IOMAP_UNWRITTEN)) { | 1262 | if (create || !(iomap.iomap_flags & IOMAP_UNWRITTEN)) { |
1256 | delta = offset - iomap.iomap_offset; | 1263 | xfs_map_buffer(bh_result, &iomap, offset, |
1257 | delta >>= inode->i_blkbits; | 1264 | inode->i_blkbits); |
1258 | |||
1259 | bn = iomap.iomap_bn >> (inode->i_blkbits - BBSHIFT); | ||
1260 | bn += delta; | ||
1261 | BUG_ON(!bn && !(iomap.iomap_flags & IOMAP_REALTIME)); | ||
1262 | bh_result->b_blocknr = bn; | ||
1263 | set_buffer_mapped(bh_result); | ||
1264 | } | 1265 | } |
1265 | if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) { | 1266 | if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) { |
1266 | if (direct) | 1267 | if (direct) |