diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-04-28 08:28:52 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-05-19 10:58:16 -0400 |
commit | 046f1685bb5211c3dea74fda0198c19171e9abc9 (patch) | |
tree | 3d01a53802173f26cd0475c74344b598f855e8f2 | |
parent | 826bf0adce0cddd9c94c2706b63d181dfc5cdaaa (diff) |
xfs: remove iomap_target
Instead of using the iomap_target field in struct xfs_iomap
and the IOMAP_REALTIME flag just use the already existing
xfs_find_bdev_for_inode helper. There's some fallout as we
need to pass the inode in a few more places, which we also
use to sanitize some calling conventions.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 39 | ||||
-rw-r--r-- | fs/xfs/xfs_iomap.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_iomap.h | 2 |
3 files changed, 18 insertions, 29 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 0f8b9968a803..49dec212da40 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -103,8 +103,9 @@ xfs_count_page_state( | |||
103 | 103 | ||
104 | STATIC struct block_device * | 104 | STATIC struct block_device * |
105 | xfs_find_bdev_for_inode( | 105 | xfs_find_bdev_for_inode( |
106 | struct xfs_inode *ip) | 106 | struct inode *inode) |
107 | { | 107 | { |
108 | struct xfs_inode *ip = XFS_I(inode); | ||
108 | struct xfs_mount *mp = ip->i_mount; | 109 | struct xfs_mount *mp = ip->i_mount; |
109 | 110 | ||
110 | if (XFS_IS_REALTIME_INODE(ip)) | 111 | if (XFS_IS_REALTIME_INODE(ip)) |
@@ -554,19 +555,19 @@ xfs_add_to_ioend( | |||
554 | 555 | ||
555 | STATIC void | 556 | STATIC void |
556 | xfs_map_buffer( | 557 | xfs_map_buffer( |
558 | struct inode *inode, | ||
557 | struct buffer_head *bh, | 559 | struct buffer_head *bh, |
558 | xfs_iomap_t *mp, | 560 | xfs_iomap_t *mp, |
559 | xfs_off_t offset, | 561 | xfs_off_t offset) |
560 | uint block_bits) | ||
561 | { | 562 | { |
562 | sector_t bn; | 563 | sector_t bn; |
563 | 564 | ||
564 | ASSERT(mp->iomap_bn != IOMAP_DADDR_NULL); | 565 | ASSERT(mp->iomap_bn != IOMAP_DADDR_NULL); |
565 | 566 | ||
566 | bn = (mp->iomap_bn >> (block_bits - BBSHIFT)) + | 567 | bn = (mp->iomap_bn >> (inode->i_blkbits - BBSHIFT)) + |
567 | ((offset - mp->iomap_offset) >> block_bits); | 568 | ((offset - mp->iomap_offset) >> inode->i_blkbits); |
568 | 569 | ||
569 | ASSERT(bn || (mp->iomap_flags & IOMAP_REALTIME)); | 570 | ASSERT(bn || XFS_IS_REALTIME_INODE(XFS_I(inode))); |
570 | 571 | ||
571 | bh->b_blocknr = bn; | 572 | bh->b_blocknr = bn; |
572 | set_buffer_mapped(bh); | 573 | set_buffer_mapped(bh); |
@@ -574,17 +575,17 @@ xfs_map_buffer( | |||
574 | 575 | ||
575 | STATIC void | 576 | STATIC void |
576 | xfs_map_at_offset( | 577 | xfs_map_at_offset( |
578 | struct inode *inode, | ||
577 | struct buffer_head *bh, | 579 | struct buffer_head *bh, |
578 | loff_t offset, | 580 | xfs_iomap_t *iomapp, |
579 | int block_bits, | 581 | xfs_off_t offset) |
580 | xfs_iomap_t *iomapp) | ||
581 | { | 582 | { |
582 | ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE)); | 583 | ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE)); |
583 | ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY)); | 584 | ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY)); |
584 | 585 | ||
585 | lock_buffer(bh); | 586 | lock_buffer(bh); |
586 | xfs_map_buffer(bh, iomapp, offset, block_bits); | 587 | xfs_map_buffer(inode, bh, iomapp, offset); |
587 | bh->b_bdev = iomapp->iomap_target->bt_bdev; | 588 | bh->b_bdev = xfs_find_bdev_for_inode(inode); |
588 | set_buffer_mapped(bh); | 589 | set_buffer_mapped(bh); |
589 | clear_buffer_delay(bh); | 590 | clear_buffer_delay(bh); |
590 | clear_buffer_unwritten(bh); | 591 | clear_buffer_unwritten(bh); |
@@ -750,7 +751,6 @@ xfs_convert_page( | |||
750 | xfs_off_t end_offset; | 751 | xfs_off_t end_offset; |
751 | unsigned long p_offset; | 752 | unsigned long p_offset; |
752 | unsigned int type; | 753 | unsigned int type; |
753 | int bbits = inode->i_blkbits; | ||
754 | int len, page_dirty; | 754 | int len, page_dirty; |
755 | int count = 0, done = 0, uptodate = 1; | 755 | int count = 0, done = 0, uptodate = 1; |
756 | xfs_off_t offset = page_offset(page); | 756 | xfs_off_t offset = page_offset(page); |
@@ -814,7 +814,7 @@ xfs_convert_page( | |||
814 | ASSERT(!(mp->iomap_flags & IOMAP_HOLE)); | 814 | ASSERT(!(mp->iomap_flags & IOMAP_HOLE)); |
815 | ASSERT(!(mp->iomap_flags & IOMAP_DELAY)); | 815 | ASSERT(!(mp->iomap_flags & IOMAP_DELAY)); |
816 | 816 | ||
817 | xfs_map_at_offset(bh, offset, bbits, mp); | 817 | xfs_map_at_offset(inode, bh, mp, offset); |
818 | if (startio) { | 818 | if (startio) { |
819 | xfs_add_to_ioend(inode, bh, offset, | 819 | xfs_add_to_ioend(inode, bh, offset, |
820 | type, ioendp, done); | 820 | type, ioendp, done); |
@@ -1174,8 +1174,7 @@ xfs_page_state_convert( | |||
1174 | iomap_valid = xfs_iomap_valid(&iomap, offset); | 1174 | iomap_valid = xfs_iomap_valid(&iomap, offset); |
1175 | } | 1175 | } |
1176 | if (iomap_valid) { | 1176 | if (iomap_valid) { |
1177 | xfs_map_at_offset(bh, offset, | 1177 | xfs_map_at_offset(inode, bh, &iomap, offset); |
1178 | inode->i_blkbits, &iomap); | ||
1179 | if (startio) { | 1178 | if (startio) { |
1180 | xfs_add_to_ioend(inode, bh, offset, | 1179 | xfs_add_to_ioend(inode, bh, offset, |
1181 | type, &ioend, | 1180 | type, &ioend, |
@@ -1473,10 +1472,8 @@ __xfs_get_blocks( | |||
1473 | * For unwritten extents do not report a disk address on | 1472 | * For unwritten extents do not report a disk address on |
1474 | * the read case (treat as if we're reading into a hole). | 1473 | * the read case (treat as if we're reading into a hole). |
1475 | */ | 1474 | */ |
1476 | if (create || !(iomap.iomap_flags & IOMAP_UNWRITTEN)) { | 1475 | if (create || !(iomap.iomap_flags & IOMAP_UNWRITTEN)) |
1477 | xfs_map_buffer(bh_result, &iomap, offset, | 1476 | xfs_map_buffer(inode, bh_result, &iomap, offset); |
1478 | inode->i_blkbits); | ||
1479 | } | ||
1480 | if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) { | 1477 | if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) { |
1481 | if (direct) | 1478 | if (direct) |
1482 | bh_result->b_private = inode; | 1479 | bh_result->b_private = inode; |
@@ -1488,7 +1485,7 @@ __xfs_get_blocks( | |||
1488 | * If this is a realtime file, data may be on a different device. | 1485 | * If this is a realtime file, data may be on a different device. |
1489 | * to that pointed to from the buffer_head b_bdev currently. | 1486 | * to that pointed to from the buffer_head b_bdev currently. |
1490 | */ | 1487 | */ |
1491 | bh_result->b_bdev = iomap.iomap_target->bt_bdev; | 1488 | bh_result->b_bdev = xfs_find_bdev_for_inode(inode); |
1492 | 1489 | ||
1493 | /* | 1490 | /* |
1494 | * If we previously allocated a block out beyond eof and we are now | 1491 | * If we previously allocated a block out beyond eof and we are now |
@@ -1612,7 +1609,7 @@ xfs_vm_direct_IO( | |||
1612 | struct block_device *bdev; | 1609 | struct block_device *bdev; |
1613 | ssize_t ret; | 1610 | ssize_t ret; |
1614 | 1611 | ||
1615 | bdev = xfs_find_bdev_for_inode(XFS_I(inode)); | 1612 | bdev = xfs_find_bdev_for_inode(inode); |
1616 | 1613 | ||
1617 | iocb->private = xfs_alloc_ioend(inode, rw == WRITE ? | 1614 | iocb->private = xfs_alloc_ioend(inode, rw == WRITE ? |
1618 | IOMAP_UNWRITTEN : IOMAP_READ); | 1615 | IOMAP_UNWRITTEN : IOMAP_READ); |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 2d9bce7fcf85..7327d3f3bf64 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -72,12 +72,6 @@ xfs_imap_to_bmap( | |||
72 | iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount); | 72 | iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount); |
73 | iomapp->iomap_flags = flags; | 73 | iomapp->iomap_flags = flags; |
74 | 74 | ||
75 | if (XFS_IS_REALTIME_INODE(ip)) { | ||
76 | iomapp->iomap_flags |= IOMAP_REALTIME; | ||
77 | iomapp->iomap_target = mp->m_rtdev_targp; | ||
78 | } else { | ||
79 | iomapp->iomap_target = mp->m_ddev_targp; | ||
80 | } | ||
81 | start_block = imap->br_startblock; | 75 | start_block = imap->br_startblock; |
82 | if (start_block == HOLESTARTBLOCK) { | 76 | if (start_block == HOLESTARTBLOCK) { |
83 | iomapp->iomap_bn = IOMAP_DADDR_NULL; | 77 | iomapp->iomap_bn = IOMAP_DADDR_NULL; |
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h index 174f29990991..a85fa90f6fe7 100644 --- a/fs/xfs/xfs_iomap.h +++ b/fs/xfs/xfs_iomap.h | |||
@@ -25,7 +25,6 @@ typedef enum { /* iomap_flags values */ | |||
25 | IOMAP_READ = 0, /* mapping for a read */ | 25 | IOMAP_READ = 0, /* mapping for a read */ |
26 | IOMAP_HOLE = 0x02, /* mapping covers a hole */ | 26 | IOMAP_HOLE = 0x02, /* mapping covers a hole */ |
27 | IOMAP_DELAY = 0x04, /* mapping covers delalloc region */ | 27 | IOMAP_DELAY = 0x04, /* mapping covers delalloc region */ |
28 | IOMAP_REALTIME = 0x10, /* mapping on the realtime device */ | ||
29 | IOMAP_UNWRITTEN = 0x20, /* mapping covers allocated */ | 28 | IOMAP_UNWRITTEN = 0x20, /* mapping covers allocated */ |
30 | /* but uninitialized file data */ | 29 | /* but uninitialized file data */ |
31 | IOMAP_NEW = 0x40 /* just allocate */ | 30 | IOMAP_NEW = 0x40 /* just allocate */ |
@@ -71,7 +70,6 @@ typedef enum { | |||
71 | 70 | ||
72 | typedef struct xfs_iomap { | 71 | typedef struct xfs_iomap { |
73 | xfs_daddr_t iomap_bn; /* first 512B blk of mapping */ | 72 | xfs_daddr_t iomap_bn; /* first 512B blk of mapping */ |
74 | xfs_buftarg_t *iomap_target; | ||
75 | xfs_off_t iomap_offset; /* offset of mapping, bytes */ | 73 | xfs_off_t iomap_offset; /* offset of mapping, bytes */ |
76 | xfs_off_t iomap_bsize; /* size of mapping, bytes */ | 74 | xfs_off_t iomap_bsize; /* size of mapping, bytes */ |
77 | xfs_off_t iomap_delta; /* offset into mapping, bytes */ | 75 | xfs_off_t iomap_delta; /* offset into mapping, bytes */ |