aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-09-18 21:09:12 -0400
committerDave Chinner <david@fromorbit.com>2016-09-18 21:09:12 -0400
commite9c4973638beff4b346d802fd9443975b041035d (patch)
tree08972d9ac8d58faec88a05e10ef5d796a12e5580 /fs/xfs
parentea78d80866ce375defb2fdd1c8a3aafec95e0f85 (diff)
xfs: move xfs_bmbt_to_iomap up
We'll need it earlier in the file soon, so the unchanged function to the top of xfs_iomap.c Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_iomap.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 2af0dda1c978..ba3592f3b98c 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -44,6 +44,32 @@
44 << mp->m_writeio_log) 44 << mp->m_writeio_log)
45#define XFS_WRITE_IMAPS XFS_BMAP_MAX_NMAP 45#define XFS_WRITE_IMAPS XFS_BMAP_MAX_NMAP
46 46
47void
48xfs_bmbt_to_iomap(
49 struct xfs_inode *ip,
50 struct iomap *iomap,
51 struct xfs_bmbt_irec *imap)
52{
53 struct xfs_mount *mp = ip->i_mount;
54
55 if (imap->br_startblock == HOLESTARTBLOCK) {
56 iomap->blkno = IOMAP_NULL_BLOCK;
57 iomap->type = IOMAP_HOLE;
58 } else if (imap->br_startblock == DELAYSTARTBLOCK) {
59 iomap->blkno = IOMAP_NULL_BLOCK;
60 iomap->type = IOMAP_DELALLOC;
61 } else {
62 iomap->blkno = xfs_fsb_to_db(ip, imap->br_startblock);
63 if (imap->br_state == XFS_EXT_UNWRITTEN)
64 iomap->type = IOMAP_UNWRITTEN;
65 else
66 iomap->type = IOMAP_MAPPED;
67 }
68 iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff);
69 iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount);
70 iomap->bdev = xfs_find_bdev_for_inode(VFS_I(ip));
71}
72
47STATIC int 73STATIC int
48xfs_iomap_eof_align_last_fsb( 74xfs_iomap_eof_align_last_fsb(
49 xfs_mount_t *mp, 75 xfs_mount_t *mp,
@@ -947,32 +973,6 @@ error_on_bmapi_transaction:
947 return error; 973 return error;
948} 974}
949 975
950void
951xfs_bmbt_to_iomap(
952 struct xfs_inode *ip,
953 struct iomap *iomap,
954 struct xfs_bmbt_irec *imap)
955{
956 struct xfs_mount *mp = ip->i_mount;
957
958 if (imap->br_startblock == HOLESTARTBLOCK) {
959 iomap->blkno = IOMAP_NULL_BLOCK;
960 iomap->type = IOMAP_HOLE;
961 } else if (imap->br_startblock == DELAYSTARTBLOCK) {
962 iomap->blkno = IOMAP_NULL_BLOCK;
963 iomap->type = IOMAP_DELALLOC;
964 } else {
965 iomap->blkno = xfs_fsb_to_db(ip, imap->br_startblock);
966 if (imap->br_state == XFS_EXT_UNWRITTEN)
967 iomap->type = IOMAP_UNWRITTEN;
968 else
969 iomap->type = IOMAP_MAPPED;
970 }
971 iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff);
972 iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount);
973 iomap->bdev = xfs_find_bdev_for_inode(VFS_I(ip));
974}
975
976static inline bool imap_needs_alloc(struct xfs_bmbt_irec *imap, int nimaps) 976static inline bool imap_needs_alloc(struct xfs_bmbt_irec *imap, int nimaps)
977{ 977{
978 return !nimaps || 978 return !nimaps ||