Lines Matching refs:imap
38 xfs_bmbt_irec_t *imap) in xfs_alert_fsblock_zero() argument
45 (unsigned long long)imap->br_startblock, in xfs_alert_fsblock_zero()
46 (unsigned long long)imap->br_startoff, in xfs_alert_fsblock_zero()
47 (unsigned long long)imap->br_blockcount, in xfs_alert_fsblock_zero()
48 imap->br_state); in xfs_alert_fsblock_zero()
56 struct xfs_bmbt_irec *imap, in xfs_bmbt_to_iomap() argument
62 if (unlikely(!xfs_valid_startblock(ip, imap->br_startblock))) in xfs_bmbt_to_iomap()
63 return xfs_alert_fsblock_zero(ip, imap); in xfs_bmbt_to_iomap()
65 if (imap->br_startblock == HOLESTARTBLOCK) { in xfs_bmbt_to_iomap()
68 } else if (imap->br_startblock == DELAYSTARTBLOCK || in xfs_bmbt_to_iomap()
69 isnullstartblock(imap->br_startblock)) { in xfs_bmbt_to_iomap()
73 iomap->addr = BBTOB(xfs_fsb_to_db(ip, imap->br_startblock)); in xfs_bmbt_to_iomap()
74 if (imap->br_state == XFS_EXT_UNWRITTEN) in xfs_bmbt_to_iomap()
79 iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff); in xfs_bmbt_to_iomap()
80 iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount); in xfs_bmbt_to_iomap()
191 struct xfs_bmbt_irec *imap) in xfs_iomap_write_direct() argument
237 if (imap->br_state == XFS_EXT_UNWRITTEN) { in xfs_iomap_write_direct()
261 imap, &nimaps); in xfs_iomap_write_direct()
280 if (unlikely(!xfs_valid_startblock(ip, imap->br_startblock))) in xfs_iomap_write_direct()
281 error = xfs_alert_fsblock_zero(ip, imap); in xfs_iomap_write_direct()
512 xfs_bmbt_irec_t imap; in xfs_iomap_write_unwritten() local
569 XFS_BMAPI_CONVERT, resblks, &imap, in xfs_iomap_write_unwritten()
595 if (unlikely(!xfs_valid_startblock(ip, imap.br_startblock))) in xfs_iomap_write_unwritten()
596 return xfs_alert_fsblock_zero(ip, &imap); in xfs_iomap_write_unwritten()
598 if ((numblks_fsb = imap.br_blockcount) == 0) { in xfs_iomap_write_unwritten()
603 ASSERT(imap.br_blockcount); in xfs_iomap_write_unwritten()
622 struct xfs_bmbt_irec *imap, in imap_needs_alloc() argument
629 imap->br_startblock == HOLESTARTBLOCK || in imap_needs_alloc()
630 imap->br_startblock == DELAYSTARTBLOCK) in imap_needs_alloc()
633 if (IS_DAX(inode) && imap->br_state == XFS_EXT_UNWRITTEN) in imap_needs_alloc()
642 struct xfs_bmbt_irec *imap, in imap_needs_cow() argument
651 imap->br_startblock == HOLESTARTBLOCK || in imap_needs_cow()
652 imap->br_state == XFS_EXT_UNWRITTEN) in imap_needs_cow()
715 struct xfs_bmbt_irec *imap, in imap_spans_range() argument
719 if (imap->br_startoff > offset_fsb) in imap_spans_range()
721 if (imap->br_startoff + imap->br_blockcount < end_fsb) in imap_spans_range()
737 struct xfs_bmbt_irec imap, cmap; in xfs_direct_write_iomap_begin() local
762 error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb, &imap, in xfs_direct_write_iomap_begin()
767 if (imap_needs_cow(ip, flags, &imap, nimaps)) { in xfs_direct_write_iomap_begin()
773 error = xfs_reflink_allocate_cow(ip, &imap, &cmap, &shared, in xfs_direct_write_iomap_begin()
779 end_fsb = imap.br_startoff + imap.br_blockcount; in xfs_direct_write_iomap_begin()
783 if (imap_needs_alloc(inode, flags, &imap, nimaps)) in xfs_direct_write_iomap_begin()
793 !imap_spans_range(&imap, offset_fsb, end_fsb)) { in xfs_direct_write_iomap_begin()
799 trace_xfs_iomap_found(ip, offset, length, XFS_DATA_FORK, &imap); in xfs_direct_write_iomap_begin()
800 return xfs_bmbt_to_iomap(ip, iomap, &imap, iomap_flags); in xfs_direct_write_iomap_begin()
821 else if (nimaps && imap.br_startblock == HOLESTARTBLOCK) in xfs_direct_write_iomap_begin()
822 end_fsb = min(end_fsb, imap.br_startoff + imap.br_blockcount); in xfs_direct_write_iomap_begin()
826 &imap); in xfs_direct_write_iomap_begin()
830 trace_xfs_iomap_alloc(ip, offset, length, XFS_DATA_FORK, &imap); in xfs_direct_write_iomap_begin()
831 return xfs_bmbt_to_iomap(ip, iomap, &imap, iomap_flags | IOMAP_F_NEW); in xfs_direct_write_iomap_begin()
837 if (imap.br_startblock != HOLESTARTBLOCK) { in xfs_direct_write_iomap_begin()
838 error = xfs_bmbt_to_iomap(ip, srcmap, &imap, 0); in xfs_direct_write_iomap_begin()
866 struct xfs_bmbt_irec imap, cmap; in xfs_buffered_write_iomap_begin() local
905 eof = !xfs_iext_lookup_extent(ip, &ip->i_df, offset_fsb, &icur, &imap); in xfs_buffered_write_iomap_begin()
907 imap.br_startoff = end_fsb; /* fake hole until the end */ in xfs_buffered_write_iomap_begin()
910 if ((flags & IOMAP_ZERO) && imap.br_startoff > offset_fsb) { in xfs_buffered_write_iomap_begin()
911 xfs_hole_to_iomap(ip, iomap, offset_fsb, imap.br_startoff); in xfs_buffered_write_iomap_begin()
936 if (imap.br_startoff <= offset_fsb) { in xfs_buffered_write_iomap_begin()
943 ((flags & IOMAP_ZERO) && imap.br_state != XFS_EXT_NORM)) { in xfs_buffered_write_iomap_begin()
945 &imap); in xfs_buffered_write_iomap_begin()
949 xfs_trim_extent(&imap, offset_fsb, end_fsb - offset_fsb); in xfs_buffered_write_iomap_begin()
952 error = xfs_bmap_trim_cow(ip, &imap, &shared); in xfs_buffered_write_iomap_begin()
959 &imap); in xfs_buffered_write_iomap_begin()
968 end_fsb = imap.br_startoff + imap.br_blockcount; in xfs_buffered_write_iomap_begin()
1023 allocfork == XFS_DATA_FORK ? &imap : &cmap, in xfs_buffered_write_iomap_begin()
1052 trace_xfs_iomap_alloc(ip, offset, count, allocfork, &imap); in xfs_buffered_write_iomap_begin()
1053 return xfs_bmbt_to_iomap(ip, iomap, &imap, IOMAP_F_NEW); in xfs_buffered_write_iomap_begin()
1057 return xfs_bmbt_to_iomap(ip, iomap, &imap, 0); in xfs_buffered_write_iomap_begin()
1061 if (imap.br_startoff <= offset_fsb) { in xfs_buffered_write_iomap_begin()
1062 error = xfs_bmbt_to_iomap(ip, srcmap, &imap, 0); in xfs_buffered_write_iomap_begin()
1068 xfs_trim_extent(&cmap, offset_fsb, imap.br_startoff - offset_fsb); in xfs_buffered_write_iomap_begin()
1154 struct xfs_bmbt_irec imap; in xfs_read_iomap_begin() local
1169 error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb, &imap, in xfs_read_iomap_begin()
1172 error = xfs_reflink_trim_around_shared(ip, &imap, &shared); in xfs_read_iomap_begin()
1177 trace_xfs_iomap_found(ip, offset, length, XFS_DATA_FORK, &imap); in xfs_read_iomap_begin()
1178 return xfs_bmbt_to_iomap(ip, iomap, &imap, shared ? IOMAP_F_SHARED : 0); in xfs_read_iomap_begin()
1200 struct xfs_bmbt_irec imap, cmap; in xfs_seek_iomap_begin() local
1214 if (xfs_iext_lookup_extent(ip, &ip->i_df, offset_fsb, &icur, &imap)) { in xfs_seek_iomap_begin()
1218 if (imap.br_startoff <= offset_fsb) in xfs_seek_iomap_begin()
1220 data_fsb = imap.br_startoff; in xfs_seek_iomap_begin()
1253 imap.br_blockcount = cow_fsb - offset_fsb; in xfs_seek_iomap_begin()
1255 imap.br_blockcount = data_fsb - offset_fsb; in xfs_seek_iomap_begin()
1256 imap.br_startoff = offset_fsb; in xfs_seek_iomap_begin()
1257 imap.br_startblock = HOLESTARTBLOCK; in xfs_seek_iomap_begin()
1258 imap.br_state = XFS_EXT_NORM; in xfs_seek_iomap_begin()
1260 xfs_trim_extent(&imap, offset_fsb, end_fsb); in xfs_seek_iomap_begin()
1261 error = xfs_bmbt_to_iomap(ip, iomap, &imap, 0); in xfs_seek_iomap_begin()
1284 struct xfs_bmbt_irec imap; in xfs_xattr_iomap_begin() local
1300 error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb, &imap, in xfs_xattr_iomap_begin()
1308 return xfs_bmbt_to_iomap(ip, iomap, &imap, 0); in xfs_xattr_iomap_begin()