aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c19
-rw-r--r--fs/xfs/xfs_iomap.c19
-rw-r--r--fs/xfs/xfs_iomap.h4
3 files changed, 16 insertions, 26 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 303a779406c0..2b09cc34dd07 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -568,10 +568,12 @@ xfs_map_buffer(
568 sector_t bn; 568 sector_t bn;
569 struct xfs_mount *m = XFS_I(inode)->i_mount; 569 struct xfs_mount *m = XFS_I(inode)->i_mount;
570 xfs_off_t iomap_offset = XFS_FSB_TO_B(m, mp->iomap_offset); 570 xfs_off_t iomap_offset = XFS_FSB_TO_B(m, mp->iomap_offset);
571 xfs_daddr_t iomap_bn = xfs_fsb_to_db(XFS_I(inode), mp->iomap_bn);
571 572
572 ASSERT(mp->iomap_bn != IOMAP_DADDR_NULL); 573 ASSERT(mp->iomap_bn != HOLESTARTBLOCK);
574 ASSERT(mp->iomap_bn != DELAYSTARTBLOCK);
573 575
574 bn = (mp->iomap_bn >> (inode->i_blkbits - BBSHIFT)) + 576 bn = (iomap_bn >> (inode->i_blkbits - BBSHIFT)) +
575 ((offset - iomap_offset) >> inode->i_blkbits); 577 ((offset - iomap_offset) >> inode->i_blkbits);
576 578
577 ASSERT(bn || XFS_IS_REALTIME_INODE(XFS_I(inode))); 579 ASSERT(bn || XFS_IS_REALTIME_INODE(XFS_I(inode)));
@@ -587,8 +589,8 @@ xfs_map_at_offset(
587 xfs_iomap_t *iomapp, 589 xfs_iomap_t *iomapp,
588 xfs_off_t offset) 590 xfs_off_t offset)
589{ 591{
590 ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE)); 592 ASSERT(iomapp->iomap_bn != HOLESTARTBLOCK);
591 ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY)); 593 ASSERT(iomapp->iomap_bn != DELAYSTARTBLOCK);
592 594
593 lock_buffer(bh); 595 lock_buffer(bh);
594 xfs_map_buffer(inode, bh, iomapp, offset); 596 xfs_map_buffer(inode, bh, iomapp, offset);
@@ -818,8 +820,8 @@ xfs_convert_page(
818 continue; 820 continue;
819 } 821 }
820 822
821 ASSERT(!(mp->iomap_flags & IOMAP_HOLE)); 823 ASSERT(mp->iomap_bn != HOLESTARTBLOCK);
822 ASSERT(!(mp->iomap_flags & IOMAP_DELAY)); 824 ASSERT(mp->iomap_bn != DELAYSTARTBLOCK);
823 825
824 xfs_map_at_offset(inode, bh, mp, offset); 826 xfs_map_at_offset(inode, bh, mp, offset);
825 if (startio) { 827 if (startio) {
@@ -1478,7 +1480,8 @@ __xfs_get_blocks(
1478 if (niomap == 0) 1480 if (niomap == 0)
1479 return 0; 1481 return 0;
1480 1482
1481 if (iomap.iomap_bn != IOMAP_DADDR_NULL) { 1483 if (iomap.iomap_bn != HOLESTARTBLOCK &&
1484 iomap.iomap_bn != DELAYSTARTBLOCK) {
1482 /* 1485 /*
1483 * For unwritten extents do not report a disk address on 1486 * For unwritten extents do not report a disk address on
1484 * the read case (treat as if we're reading into a hole). 1487 * the read case (treat as if we're reading into a hole).
@@ -1513,7 +1516,7 @@ __xfs_get_blocks(
1513 (iomap.iomap_flags & (IOMAP_NEW|IOMAP_UNWRITTEN)))) 1516 (iomap.iomap_flags & (IOMAP_NEW|IOMAP_UNWRITTEN))))
1514 set_buffer_new(bh_result); 1517 set_buffer_new(bh_result);
1515 1518
1516 if (iomap.iomap_flags & IOMAP_DELAY) { 1519 if (iomap.iomap_bn == DELAYSTARTBLOCK) {
1517 BUG_ON(direct); 1520 BUG_ON(direct);
1518 if (create) { 1521 if (create) {
1519 set_buffer_uptodate(bh_result); 1522 set_buffer_uptodate(bh_result);
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 49b5ad22a9d8..fbe5d32f9ef5 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -64,24 +64,15 @@ xfs_imap_to_bmap(
64 int imaps, /* Number of imap entries */ 64 int imaps, /* Number of imap entries */
65 int flags) 65 int flags)
66{ 66{
67 xfs_fsblock_t start_block;
68
69 iomapp->iomap_offset = imap->br_startoff; 67 iomapp->iomap_offset = imap->br_startoff;
70 iomapp->iomap_bsize = imap->br_blockcount; 68 iomapp->iomap_bsize = imap->br_blockcount;
71 iomapp->iomap_flags = flags; 69 iomapp->iomap_flags = flags;
70 iomapp->iomap_bn = imap->br_startblock;
72 71
73 start_block = imap->br_startblock; 72 if (imap->br_startblock != HOLESTARTBLOCK &&
74 if (start_block == HOLESTARTBLOCK) { 73 imap->br_startblock != DELAYSTARTBLOCK &&
75 iomapp->iomap_bn = IOMAP_DADDR_NULL; 74 ISUNWRITTEN(imap))
76 iomapp->iomap_flags |= IOMAP_HOLE; 75 iomapp->iomap_flags |= IOMAP_UNWRITTEN;
77 } else if (start_block == DELAYSTARTBLOCK) {
78 iomapp->iomap_bn = IOMAP_DADDR_NULL;
79 iomapp->iomap_flags |= IOMAP_DELAY;
80 } else {
81 iomapp->iomap_bn = xfs_fsb_to_db(ip, start_block);
82 if (ISUNWRITTEN(imap))
83 iomapp->iomap_flags |= IOMAP_UNWRITTEN;
84 }
85} 76}
86 77
87int 78int
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index db9299631ee4..d2f3b67d39f9 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -18,12 +18,8 @@
18#ifndef __XFS_IOMAP_H__ 18#ifndef __XFS_IOMAP_H__
19#define __XFS_IOMAP_H__ 19#define __XFS_IOMAP_H__
20 20
21#define IOMAP_DADDR_NULL ((xfs_daddr_t) (-1LL))
22
23
24typedef enum { /* iomap_flags values */ 21typedef enum { /* iomap_flags values */
25 IOMAP_READ = 0, /* mapping for a read */ 22 IOMAP_READ = 0, /* mapping for a read */
26 IOMAP_HOLE = 0x02, /* mapping covers a hole */
27 IOMAP_DELAY = 0x04, /* mapping covers delalloc region */ 23 IOMAP_DELAY = 0x04, /* mapping covers delalloc region */
28 IOMAP_UNWRITTEN = 0x20, /* mapping covers allocated */ 24 IOMAP_UNWRITTEN = 0x20, /* mapping covers allocated */
29 /* but uninitialized file data */ 25 /* but uninitialized file data */