Lines Matching +full:non +full:- +full:contiguous
1 // SPDX-License-Identifier: GPL-2.0
50 cur->bc_rec.r.rm_startblock = bno; in xfs_rmap_lookup_le()
51 cur->bc_rec.r.rm_blockcount = 0; in xfs_rmap_lookup_le()
52 cur->bc_rec.r.rm_owner = owner; in xfs_rmap_lookup_le()
53 cur->bc_rec.r.rm_offset = offset; in xfs_rmap_lookup_le()
54 cur->bc_rec.r.rm_flags = flags; in xfs_rmap_lookup_le()
65 return -EFSCORRUPTED; in xfs_rmap_lookup_le()
85 cur->bc_rec.r.rm_startblock = bno; in xfs_rmap_lookup_eq()
86 cur->bc_rec.r.rm_blockcount = len; in xfs_rmap_lookup_eq()
87 cur->bc_rec.r.rm_owner = owner; in xfs_rmap_lookup_eq()
88 cur->bc_rec.r.rm_offset = offset; in xfs_rmap_lookup_eq()
89 cur->bc_rec.r.rm_flags = flags; in xfs_rmap_lookup_eq()
106 trace_xfs_rmap_update(cur, irec->rm_startblock, irec->rm_blockcount, in xfs_rmap_update()
107 irec->rm_owner, irec->rm_offset, irec->rm_flags); in xfs_rmap_update()
109 rec.rmap.rm_startblock = cpu_to_be32(irec->rm_startblock); in xfs_rmap_update()
110 rec.rmap.rm_blockcount = cpu_to_be32(irec->rm_blockcount); in xfs_rmap_update()
111 rec.rmap.rm_owner = cpu_to_be64(irec->rm_owner); in xfs_rmap_update()
137 if (XFS_IS_CORRUPT(rcur->bc_mp, i != 0)) { in xfs_rmap_insert()
139 error = -EFSCORRUPTED; in xfs_rmap_insert()
143 rcur->bc_rec.r.rm_startblock = agbno; in xfs_rmap_insert()
144 rcur->bc_rec.r.rm_blockcount = len; in xfs_rmap_insert()
145 rcur->bc_rec.r.rm_owner = owner; in xfs_rmap_insert()
146 rcur->bc_rec.r.rm_offset = offset; in xfs_rmap_insert()
147 rcur->bc_rec.r.rm_flags = flags; in xfs_rmap_insert()
151 if (XFS_IS_CORRUPT(rcur->bc_mp, i != 1)) { in xfs_rmap_insert()
153 error = -EFSCORRUPTED; in xfs_rmap_insert()
179 if (XFS_IS_CORRUPT(rcur->bc_mp, i != 1)) { in xfs_rmap_delete()
181 error = -EFSCORRUPTED; in xfs_rmap_delete()
188 if (XFS_IS_CORRUPT(rcur->bc_mp, i != 1)) { in xfs_rmap_delete()
190 error = -EFSCORRUPTED; in xfs_rmap_delete()
205 irec->rm_startblock = be32_to_cpu(rec->rmap.rm_startblock); in xfs_rmap_btrec_to_irec()
206 irec->rm_blockcount = be32_to_cpu(rec->rmap.rm_blockcount); in xfs_rmap_btrec_to_irec()
207 irec->rm_owner = be64_to_cpu(rec->rmap.rm_owner); in xfs_rmap_btrec_to_irec()
208 return xfs_rmap_irec_offset_unpack(be64_to_cpu(rec->rmap.rm_offset), in xfs_rmap_btrec_to_irec()
224 if (irec->rm_blockcount == 0) in xfs_rmap_check_irec()
226 if (irec->rm_startblock <= XFS_AGFL_BLOCK(mp)) { in xfs_rmap_check_irec()
227 if (irec->rm_owner != XFS_RMAP_OWN_FS) in xfs_rmap_check_irec()
229 if (irec->rm_blockcount != XFS_AGFL_BLOCK(mp) + 1) in xfs_rmap_check_irec()
233 if (!xfs_verify_agbext(pag, irec->rm_startblock, in xfs_rmap_check_irec()
234 irec->rm_blockcount)) in xfs_rmap_check_irec()
238 if (!(xfs_verify_ino(mp, irec->rm_owner) || in xfs_rmap_check_irec()
239 (irec->rm_owner <= XFS_RMAP_OWN_FS && in xfs_rmap_check_irec()
240 irec->rm_owner >= XFS_RMAP_OWN_MIN))) in xfs_rmap_check_irec()
244 is_inode = !XFS_RMAP_NON_INODE_OWNER(irec->rm_owner); in xfs_rmap_check_irec()
245 is_bmbt = irec->rm_flags & XFS_RMAP_BMBT_BLOCK; in xfs_rmap_check_irec()
246 is_attr = irec->rm_flags & XFS_RMAP_ATTR_FORK; in xfs_rmap_check_irec()
247 is_unwritten = irec->rm_flags & XFS_RMAP_UNWRITTEN; in xfs_rmap_check_irec()
249 if (is_bmbt && irec->rm_offset != 0) in xfs_rmap_check_irec()
252 if (!is_inode && irec->rm_offset != 0) in xfs_rmap_check_irec()
263 !xfs_verify_fileext(mp, irec->rm_offset, irec->rm_blockcount)) in xfs_rmap_check_irec()
276 if (irec->rm_offset != 0) in xfs_rtrmap_check_meta_irec()
278 if (irec->rm_flags & XFS_RMAP_UNWRITTEN) in xfs_rtrmap_check_meta_irec()
281 switch (irec->rm_owner) { in xfs_rtrmap_check_meta_irec()
283 if (irec->rm_startblock != 0) in xfs_rtrmap_check_meta_irec()
285 if (irec->rm_blockcount != mp->m_sb.sb_rextsize) in xfs_rtrmap_check_meta_irec()
291 if (!xfs_verify_rgbext(rtg, irec->rm_startblock, in xfs_rtrmap_check_meta_irec()
292 irec->rm_blockcount)) in xfs_rtrmap_check_meta_irec()
309 if (!xfs_verify_ino(mp, irec->rm_owner)) in xfs_rtrmap_check_inode_irec()
311 if (!xfs_verify_rgbext(rtg, irec->rm_startblock, irec->rm_blockcount)) in xfs_rtrmap_check_inode_irec()
313 if (!xfs_verify_fileext(mp, irec->rm_offset, irec->rm_blockcount)) in xfs_rtrmap_check_inode_irec()
323 if (irec->rm_blockcount == 0) in xfs_rtrmap_check_irec()
325 if (irec->rm_flags & (XFS_RMAP_BMBT_BLOCK | XFS_RMAP_ATTR_FORK)) in xfs_rtrmap_check_irec()
327 if (XFS_RMAP_NON_INODE_OWNER(irec->rm_owner)) in xfs_rtrmap_check_irec()
337 if (xfs_btree_is_rtrmap(cur->bc_ops) || in xfs_rmap_check_btrec()
338 xfs_btree_is_mem_rtrmap(cur->bc_ops)) in xfs_rmap_check_btrec()
339 return xfs_rtrmap_check_irec(to_rtg(cur->bc_group), irec); in xfs_rmap_check_btrec()
340 return xfs_rmap_check_irec(to_perag(cur->bc_group), irec); in xfs_rmap_check_btrec()
349 struct xfs_mount *mp = cur->bc_mp; in xfs_rmap_complain_bad_rec()
351 if (xfs_btree_is_mem_rmap(cur->bc_ops)) in xfs_rmap_complain_bad_rec()
353 "In-Memory Reverse Mapping BTree record corruption detected at %pS!", fa); in xfs_rmap_complain_bad_rec()
354 else if (xfs_btree_is_rtrmap(cur->bc_ops)) in xfs_rmap_complain_bad_rec()
357 cur->bc_group->xg_gno, fa); in xfs_rmap_complain_bad_rec()
361 cur->bc_group->xg_gno, fa); in xfs_rmap_complain_bad_rec()
364 irec->rm_owner, irec->rm_flags, irec->rm_startblock, in xfs_rmap_complain_bad_rec()
365 irec->rm_blockcount); in xfs_rmap_complain_bad_rec()
367 return -EFSCORRUPTED; in xfs_rmap_complain_bad_rec()
371 * Get the data from the pointed-to record.
410 trace_xfs_rmap_find_left_neighbor_candidate(cur, rec->rm_startblock, in xfs_rmap_find_left_neighbor_helper()
411 rec->rm_blockcount, rec->rm_owner, rec->rm_offset, in xfs_rmap_find_left_neighbor_helper()
412 rec->rm_flags); in xfs_rmap_find_left_neighbor_helper()
414 if (rec->rm_owner != info->high.rm_owner) in xfs_rmap_find_left_neighbor_helper()
416 if (!XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) && in xfs_rmap_find_left_neighbor_helper()
417 !(rec->rm_flags & XFS_RMAP_BMBT_BLOCK) && in xfs_rmap_find_left_neighbor_helper()
418 rec->rm_offset + rec->rm_blockcount - 1 != info->high.rm_offset) in xfs_rmap_find_left_neighbor_helper()
421 *info->irec = *rec; in xfs_rmap_find_left_neighbor_helper()
422 return -ECANCELED; in xfs_rmap_find_left_neighbor_helper()
447 info.high.rm_startblock = bno - 1; in xfs_rmap_find_left_neighbor()
453 info.high.rm_offset = offset - 1; in xfs_rmap_find_left_neighbor()
470 * produce correct results -- if the index contains a record that is an in xfs_rmap_find_left_neighbor()
474 * As an optimization, try a non-overlapped lookup first. This makes in xfs_rmap_find_left_neighbor()
488 if (error != -ECANCELED) in xfs_rmap_find_left_neighbor()
492 trace_xfs_rmap_find_left_neighbor_result(cur, irec->rm_startblock, in xfs_rmap_find_left_neighbor()
493 irec->rm_blockcount, irec->rm_owner, irec->rm_offset, in xfs_rmap_find_left_neighbor()
494 irec->rm_flags); in xfs_rmap_find_left_neighbor()
507 trace_xfs_rmap_lookup_le_range_candidate(cur, rec->rm_startblock, in xfs_rmap_lookup_le_range_helper()
508 rec->rm_blockcount, rec->rm_owner, rec->rm_offset, in xfs_rmap_lookup_le_range_helper()
509 rec->rm_flags); in xfs_rmap_lookup_le_range_helper()
511 if (rec->rm_owner != info->high.rm_owner) in xfs_rmap_lookup_le_range_helper()
513 if (!XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) && in xfs_rmap_lookup_le_range_helper()
514 !(rec->rm_flags & XFS_RMAP_BMBT_BLOCK) && in xfs_rmap_lookup_le_range_helper()
515 (rec->rm_offset > info->high.rm_offset || in xfs_rmap_lookup_le_range_helper()
516 rec->rm_offset + rec->rm_blockcount <= info->high.rm_offset)) in xfs_rmap_lookup_le_range_helper()
519 *info->irec = *rec; in xfs_rmap_lookup_le_range_helper()
520 return -ECANCELED; in xfs_rmap_lookup_le_range_helper()
526 * block ranges. This is the overlapping-interval version of
563 * produce correct results -- if the index contains a record that is an in xfs_rmap_lookup_le_range()
567 * As an optimization, try a non-overlapped lookup first. This makes in xfs_rmap_lookup_le_range()
581 if (error != -ECANCELED) in xfs_rmap_lookup_le_range()
585 trace_xfs_rmap_lookup_le_range_result(cur, irec->rm_startblock, in xfs_rmap_lookup_le_range()
586 irec->rm_blockcount, irec->rm_owner, irec->rm_offset, in xfs_rmap_lookup_le_range()
587 irec->rm_flags); in xfs_rmap_lookup_le_range()
593 * unknown-owner removal then we have no owner information to check.
605 struct xfs_mount *mp = cur->bc_mp; in xfs_rmap_free_check_owner()
614 (rec->rm_flags & XFS_RMAP_UNWRITTEN))) { in xfs_rmap_free_check_owner()
616 error = -EFSCORRUPTED; in xfs_rmap_free_check_owner()
621 if (XFS_IS_CORRUPT(mp, owner != rec->rm_owner)) { in xfs_rmap_free_check_owner()
623 error = -EFSCORRUPTED; in xfs_rmap_free_check_owner()
633 !(rec->rm_flags & XFS_RMAP_BMBT_BLOCK))) { in xfs_rmap_free_check_owner()
635 error = -EFSCORRUPTED; in xfs_rmap_free_check_owner()
639 if (XFS_IS_CORRUPT(mp, rec->rm_offset > offset)) { in xfs_rmap_free_check_owner()
641 error = -EFSCORRUPTED; in xfs_rmap_free_check_owner()
645 offset + len > ltoff + rec->rm_blockcount)) { in xfs_rmap_free_check_owner()
647 error = -EFSCORRUPTED; in xfs_rmap_free_check_owner()
666 * extent. We verify that - the extent lookup result in a record that does not
682 struct xfs_mount *mp = cur->bc_mp; in xfs_rmap_unmap()
709 error = -EFSCORRUPTED; in xfs_rmap_unmap()
730 error = -EFSCORRUPTED; in xfs_rmap_unmap()
737 * If we're doing an unknown-owner removal for EFI recovery, we expect in xfs_rmap_unmap()
757 error = -EFSCORRUPTED; in xfs_rmap_unmap()
770 error = -EFSCORRUPTED; in xfs_rmap_unmap()
790 error = -EFSCORRUPTED; in xfs_rmap_unmap()
805 ltrec.rm_blockcount -= len; in xfs_rmap_unmap()
822 ltrec.rm_blockcount -= len; in xfs_rmap_unmap()
830 * record to the length of the new left-extent size, increment in xfs_rmap_unmap()
832 * containing the remaining right-extent space. in xfs_rmap_unmap()
842 ltrec.rm_blockcount = bno - ltrec.rm_startblock; in xfs_rmap_unmap()
851 cur->bc_rec.r.rm_startblock = bno + len; in xfs_rmap_unmap()
852 cur->bc_rec.r.rm_blockcount = orig_len - len - in xfs_rmap_unmap()
854 cur->bc_rec.r.rm_owner = ltrec.rm_owner; in xfs_rmap_unmap()
856 cur->bc_rec.r.rm_offset = 0; in xfs_rmap_unmap()
858 cur->bc_rec.r.rm_offset = offset + len; in xfs_rmap_unmap()
859 cur->bc_rec.r.rm_flags = flags; in xfs_rmap_unmap()
860 trace_xfs_rmap_insert(cur, cur->bc_rec.r.rm_startblock, in xfs_rmap_unmap()
861 cur->bc_rec.r.rm_blockcount, in xfs_rmap_unmap()
862 cur->bc_rec.r.rm_owner, in xfs_rmap_unmap()
863 cur->bc_rec.r.rm_offset, in xfs_rmap_unmap()
864 cur->bc_rec.r.rm_flags); in xfs_rmap_unmap()
924 xfs_hooks_call(&xg->xg_rmap_update_hooks, op, &p); in xfs_rmap_update_hook()
934 return xfs_hooks_add(&xg->xg_rmap_update_hooks, &hook->rmap_hook); in xfs_rmap_hook_add()
943 xfs_hooks_del(&xg->xg_rmap_update_hooks, &hook->rmap_hook); in xfs_rmap_hook_del()
952 xfs_hook_setup(&hook->rmap_hook, mod_fn); in xfs_rmap_hook_setup()
970 struct xfs_mount *mp = tp->t_mountp; in xfs_rmap_free()
997 if (irec->rm_owner == XFS_RMAP_OWN_NULL) in xfs_rmap_is_mergeable()
999 if (irec->rm_owner != owner) in xfs_rmap_is_mergeable()
1002 (irec->rm_flags & XFS_RMAP_UNWRITTEN)) in xfs_rmap_is_mergeable()
1005 (irec->rm_flags & XFS_RMAP_ATTR_FORK)) in xfs_rmap_is_mergeable()
1008 (irec->rm_flags & XFS_RMAP_BMBT_BLOCK)) in xfs_rmap_is_mergeable()
1027 struct xfs_mount *mp = cur->bc_mp; in xfs_rmap_map()
1049 * For the initial lookup, look for an exact match or the left-adjacent in xfs_rmap_map()
1070 error = -EFSCORRUPTED; in xfs_rmap_map()
1075 * Increment the cursor to see if we have a right-adjacent record to our in xfs_rmap_map()
1088 error = -EFSCORRUPTED; in xfs_rmap_map()
1093 error = -EFSCORRUPTED; in xfs_rmap_map()
1112 * left edge contiguous, merge into left record. in xfs_rmap_map()
1127 * right edge also contiguous, delete right record in xfs_rmap_map()
1144 error = -EFSCORRUPTED; in xfs_rmap_map()
1160 * right edge contiguous, merge into right record. in xfs_rmap_map()
1177 * no contiguous edge with identical owner, insert in xfs_rmap_map()
1180 cur->bc_rec.r.rm_startblock = bno; in xfs_rmap_map()
1181 cur->bc_rec.r.rm_blockcount = len; in xfs_rmap_map()
1182 cur->bc_rec.r.rm_owner = owner; in xfs_rmap_map()
1183 cur->bc_rec.r.rm_offset = offset; in xfs_rmap_map()
1184 cur->bc_rec.r.rm_flags = flags; in xfs_rmap_map()
1191 error = -EFSCORRUPTED; in xfs_rmap_map()
1215 struct xfs_mount *mp = tp->t_mountp; in xfs_rmap_alloc()
1255 struct xfs_mount *mp = cur->bc_mp; in xfs_rmap_convert()
1277 * For the initial lookup, look for an exact match or the left-adjacent in xfs_rmap_convert()
1286 error = -EFSCORRUPTED; in xfs_rmap_convert()
1309 * Decrement the cursor to see if we have a left-adjacent record to our in xfs_rmap_convert()
1323 error = -EFSCORRUPTED; in xfs_rmap_convert()
1330 error = -EFSCORRUPTED; in xfs_rmap_convert()
1343 * Increment the cursor to see if we have a right-adjacent record to our in xfs_rmap_convert()
1352 error = -EFSCORRUPTED; in xfs_rmap_convert()
1365 error = -EFSCORRUPTED; in xfs_rmap_convert()
1370 error = -EFSCORRUPTED; in xfs_rmap_convert()
1400 error = -EFSCORRUPTED; in xfs_rmap_convert()
1413 * The left and right neighbors are both contiguous with new. in xfs_rmap_convert()
1420 error = -EFSCORRUPTED; in xfs_rmap_convert()
1431 error = -EFSCORRUPTED; in xfs_rmap_convert()
1439 error = -EFSCORRUPTED; in xfs_rmap_convert()
1450 error = -EFSCORRUPTED; in xfs_rmap_convert()
1458 error = -EFSCORRUPTED; in xfs_rmap_convert()
1471 * The left neighbor is contiguous, the right is not. in xfs_rmap_convert()
1481 error = -EFSCORRUPTED; in xfs_rmap_convert()
1489 error = -EFSCORRUPTED; in xfs_rmap_convert()
1502 * The right neighbor is contiguous, the left is not. in xfs_rmap_convert()
1509 error = -EFSCORRUPTED; in xfs_rmap_convert()
1520 error = -EFSCORRUPTED; in xfs_rmap_convert()
1528 error = -EFSCORRUPTED; in xfs_rmap_convert()
1542 * Neither the left nor right neighbors are contiguous with in xfs_rmap_convert()
1555 * The left neighbor is contiguous. in xfs_rmap_convert()
1560 NEW.rm_blockcount -= len; in xfs_rmap_convert()
1577 * The left neighbor is not contiguous. in xfs_rmap_convert()
1582 NEW.rm_blockcount -= len; in xfs_rmap_convert()
1591 cur->bc_rec.r = NEW; in xfs_rmap_convert()
1598 error = -EFSCORRUPTED; in xfs_rmap_convert()
1606 * The right neighbor is contiguous with the new allocation. in xfs_rmap_convert()
1609 NEW.rm_blockcount -= len; in xfs_rmap_convert()
1628 * The right neighbor is not contiguous. in xfs_rmap_convert()
1631 NEW.rm_blockcount -= len; in xfs_rmap_convert()
1641 error = -EFSCORRUPTED; in xfs_rmap_convert()
1649 cur->bc_rec.r = NEW; in xfs_rmap_convert()
1656 error = -EFSCORRUPTED; in xfs_rmap_convert()
1667 /* new right extent - oldext */ in xfs_rmap_convert()
1671 NEW.rm_blockcount = PREV.rm_offset + PREV.rm_blockcount - in xfs_rmap_convert()
1677 /* new left extent - oldext */ in xfs_rmap_convert()
1679 NEW.rm_blockcount = offset - PREV.rm_offset; in xfs_rmap_convert()
1680 cur->bc_rec.r = NEW; in xfs_rmap_convert()
1689 error = -EFSCORRUPTED; in xfs_rmap_convert()
1703 error = -EFSCORRUPTED; in xfs_rmap_convert()
1706 /* new middle extent - newext */ in xfs_rmap_convert()
1707 cur->bc_rec.r.rm_flags &= ~XFS_RMAP_UNWRITTEN; in xfs_rmap_convert()
1708 cur->bc_rec.r.rm_flags |= newext; in xfs_rmap_convert()
1715 error = -EFSCORRUPTED; in xfs_rmap_convert()
1753 struct xfs_mount *mp = cur->bc_mp; in xfs_rmap_convert_shared()
1775 * For the initial lookup, look for and exact match or the left-adjacent in xfs_rmap_convert_shared()
1785 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
1814 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
1833 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
1838 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
1868 * The left and right neighbors are both contiguous with new. in xfs_rmap_convert_shared()
1888 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
1900 * The left neighbor is contiguous, the right is not. in xfs_rmap_convert_shared()
1915 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
1927 * The right neighbor is contiguous, the left is not. in xfs_rmap_convert_shared()
1942 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
1955 * Neither the left nor right neighbors are contiguous with in xfs_rmap_convert_shared()
1966 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
1978 * The left neighbor is contiguous. in xfs_rmap_convert_shared()
1988 NEW.rm_blockcount -= len; in xfs_rmap_convert_shared()
2002 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
2014 * The left neighbor is not contiguous. in xfs_rmap_convert_shared()
2024 NEW.rm_blockcount -= len; in xfs_rmap_convert_shared()
2038 * The right neighbor is contiguous with the new allocation. in xfs_rmap_convert_shared()
2048 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
2051 NEW.rm_blockcount = offset - NEW.rm_offset; in xfs_rmap_convert_shared()
2074 * The right neighbor is not contiguous. in xfs_rmap_convert_shared()
2084 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
2087 NEW.rm_blockcount -= len; in xfs_rmap_convert_shared()
2102 /* new right extent - oldext */ in xfs_rmap_convert_shared()
2106 NEW.rm_blockcount = PREV.rm_offset + PREV.rm_blockcount - in xfs_rmap_convert_shared()
2114 /* new left extent - oldext */ in xfs_rmap_convert_shared()
2123 error = -EFSCORRUPTED; in xfs_rmap_convert_shared()
2126 NEW.rm_blockcount = offset - NEW.rm_offset; in xfs_rmap_convert_shared()
2130 /* new middle extent - newext */ in xfs_rmap_convert_shared()
2185 struct xfs_mount *mp = cur->bc_mp; in xfs_rmap_unmap_shared()
2210 error = -EFSCORRUPTED; in xfs_rmap_unmap_shared()
2221 error = -EFSCORRUPTED; in xfs_rmap_unmap_shared()
2228 error = -EFSCORRUPTED; in xfs_rmap_unmap_shared()
2237 error = -EFSCORRUPTED; in xfs_rmap_unmap_shared()
2244 error = -EFSCORRUPTED; in xfs_rmap_unmap_shared()
2249 error = -EFSCORRUPTED; in xfs_rmap_unmap_shared()
2281 ltrec.rm_blockcount -= len; in xfs_rmap_unmap_shared()
2306 error = -EFSCORRUPTED; in xfs_rmap_unmap_shared()
2309 ltrec.rm_blockcount -= len; in xfs_rmap_unmap_shared()
2316 * record to the length of the new left-extent size, increment in xfs_rmap_unmap_shared()
2318 * containing the remaining right-extent space. in xfs_rmap_unmap_shared()
2336 error = -EFSCORRUPTED; in xfs_rmap_unmap_shared()
2339 ltrec.rm_blockcount = bno - ltrec.rm_startblock; in xfs_rmap_unmap_shared()
2346 orig_len - len - ltrec.rm_blockcount, in xfs_rmap_unmap_shared()
2377 struct xfs_mount *mp = cur->bc_mp; in xfs_rmap_map_shared()
2413 error = -EFSCORRUPTED; in xfs_rmap_map_shared()
2429 * Left edge contiguous, merge into left record. in xfs_rmap_map_shared()
2442 * Right edge also contiguous, delete right record in xfs_rmap_map_shared()
2466 error = -EFSCORRUPTED; in xfs_rmap_map_shared()
2477 * Right edge contiguous, merge into right record. in xfs_rmap_map_shared()
2492 /* Move the start and re-add it. */ in xfs_rmap_map_shared()
2503 * No contiguous edge with identical owner, insert in xfs_rmap_map_shared()
2526 xfs_owner_info_pack(&oinfo, rmap->rm_owner, rmap->rm_offset, in xfs_rmap_map_raw()
2527 rmap->rm_flags); in xfs_rmap_map_raw()
2529 if ((rmap->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK | in xfs_rmap_map_raw()
2531 XFS_RMAP_NON_INODE_OWNER(rmap->rm_owner)) in xfs_rmap_map_raw()
2532 return xfs_rmap_map(cur, rmap->rm_startblock, in xfs_rmap_map_raw()
2533 rmap->rm_blockcount, in xfs_rmap_map_raw()
2534 rmap->rm_flags & XFS_RMAP_UNWRITTEN, in xfs_rmap_map_raw()
2537 return xfs_rmap_map_shared(cur, rmap->rm_startblock, in xfs_rmap_map_raw()
2538 rmap->rm_blockcount, in xfs_rmap_map_raw()
2539 rmap->rm_flags & XFS_RMAP_UNWRITTEN, in xfs_rmap_map_raw()
2565 return query->fn(cur, &irec, query->priv); in xfs_rmap_query_range_helper()
2627 return -EFSCORRUPTED; in __xfs_rmap_finish_intent()
2637 struct xfs_perag *pag = to_perag(ri->ri_group); in xfs_rmap_finish_init_cursor()
2650 if (XFS_IS_CORRUPT(tp->t_mountp, !agbp)) { in xfs_rmap_finish_init_cursor()
2652 return -EFSCORRUPTED; in xfs_rmap_finish_init_cursor()
2654 *pcur = xfs_rmapbt_init_cursor(tp->t_mountp, tp, agbp, pag); in xfs_rmap_finish_init_cursor()
2664 struct xfs_rtgroup *rtg = to_rtg(ri->ri_group); in xfs_rtrmap_finish_init_cursor()
2686 struct xfs_mount *mp = tp->t_mountp; in xfs_rmap_finish_one()
2694 return -EIO; in xfs_rmap_finish_one()
2700 if (*pcur != NULL && (*pcur)->bc_group != ri->ri_group) { in xfs_rmap_finish_one()
2705 if (ri->ri_group->xg_type == XG_TYPE_RTG) in xfs_rmap_finish_one()
2713 xfs_rmap_ino_owner(&oinfo, ri->ri_owner, ri->ri_whichfork, in xfs_rmap_finish_one()
2714 ri->ri_bmap.br_startoff); in xfs_rmap_finish_one()
2715 unwritten = ri->ri_bmap.br_state == XFS_EXT_UNWRITTEN; in xfs_rmap_finish_one()
2717 bno = xfs_fsb_to_gbno(mp, ri->ri_bmap.br_startblock, in xfs_rmap_finish_one()
2718 ri->ri_group->xg_type); in xfs_rmap_finish_one()
2719 error = __xfs_rmap_finish_intent(*pcur, ri->ri_type, bno, in xfs_rmap_finish_one()
2720 ri->ri_bmap.br_blockcount, &oinfo, unwritten); in xfs_rmap_finish_one()
2724 xfs_rmap_update_hook(tp, ri->ri_group, ri->ri_type, bno, in xfs_rmap_finish_one()
2725 ri->ri_bmap.br_blockcount, unwritten, &oinfo); in xfs_rmap_finish_one()
2756 INIT_LIST_HEAD(&ri->ri_list); in __xfs_rmap_add()
2757 ri->ri_type = type; in __xfs_rmap_add()
2758 ri->ri_owner = owner; in __xfs_rmap_add()
2759 ri->ri_whichfork = whichfork; in __xfs_rmap_add()
2760 ri->ri_bmap = *bmap; in __xfs_rmap_add()
2761 ri->ri_realtime = isrt; in __xfs_rmap_add()
2777 if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork)) in xfs_rmap_map_extent()
2783 __xfs_rmap_add(tp, type, ip->i_ino, isrt, whichfork, PREV); in xfs_rmap_map_extent()
2797 if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork)) in xfs_rmap_unmap_extent()
2803 __xfs_rmap_add(tp, type, ip->i_ino, isrt, whichfork, PREV); in xfs_rmap_unmap_extent()
2829 __xfs_rmap_add(tp, type, ip->i_ino, isrt, whichfork, PREV); in xfs_rmap_convert_extent()
2832 /* Schedule the creation of an rmap for non-file data. */
2843 if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK)) in xfs_rmap_alloc_extent()
2854 /* Schedule the deletion of an rmap for non-file data. */
2865 if (!xfs_rmap_update_is_needed(tp->t_mountp, XFS_DATA_FORK)) in xfs_rmap_free_extent()
2876 /* Compare rmap records. Returns -1 if a < b, 1 if a > b, and 0 if equal. */
2888 if (a->rm_startblock < b->rm_startblock) in xfs_rmap_compare()
2889 return -1; in xfs_rmap_compare()
2890 else if (a->rm_startblock > b->rm_startblock) in xfs_rmap_compare()
2892 else if (a->rm_owner < b->rm_owner) in xfs_rmap_compare()
2893 return -1; in xfs_rmap_compare()
2894 else if (a->rm_owner > b->rm_owner) in xfs_rmap_compare()
2897 return -1; in xfs_rmap_compare()
2917 .rmap.rm_startblock = cpu_to_be32(-1U), in xfs_rmap_has_records()
2925 high.r.rm_startblock = bno + len - 1; in xfs_rmap_has_records()
2952 if (XFS_RMAP_NON_INODE_OWNER(rmap->rm_owner)) in xfs_rmap_shareable()
2954 if (rmap->rm_flags & (XFS_RMAP_ATTR_FORK | in xfs_rmap_shareable()
2969 roc->results = results; in xfs_rmap_ownercount_init()
2971 roc->low.rm_startblock = bno; in xfs_rmap_ownercount_init()
2972 memset(&roc->high, 0xFF, sizeof(roc->high)); in xfs_rmap_ownercount_init()
2973 roc->high.rm_startblock = bno + len - 1; in xfs_rmap_ownercount_init()
2976 roc->good.rm_startblock = bno; in xfs_rmap_ownercount_init()
2977 roc->good.rm_blockcount = len; in xfs_rmap_ownercount_init()
2978 roc->good.rm_owner = oinfo->oi_owner; in xfs_rmap_ownercount_init()
2979 roc->good.rm_offset = oinfo->oi_offset; in xfs_rmap_ownercount_init()
2980 if (oinfo->oi_flags & XFS_OWNER_INFO_ATTR_FORK) in xfs_rmap_ownercount_init()
2981 roc->good.rm_flags |= XFS_RMAP_ATTR_FORK; in xfs_rmap_ownercount_init()
2982 if (oinfo->oi_flags & XFS_OWNER_INFO_BMBT_BLOCK) in xfs_rmap_ownercount_init()
2983 roc->good.rm_flags |= XFS_RMAP_BMBT_BLOCK; in xfs_rmap_ownercount_init()
3003 delta = (int64_t)roc->good.rm_startblock - check.rm_startblock; in xfs_rmap_count_owners_helper()
3006 check.rm_blockcount -= delta; in xfs_rmap_count_owners_helper()
3012 delta = (check.rm_startblock + check.rm_blockcount) - in xfs_rmap_count_owners_helper()
3013 (roc->good.rm_startblock + roc->good.rm_blockcount); in xfs_rmap_count_owners_helper()
3015 check.rm_blockcount -= delta; in xfs_rmap_count_owners_helper()
3020 if (check.rm_startblock == roc->good.rm_startblock && in xfs_rmap_count_owners_helper()
3021 check.rm_blockcount == roc->good.rm_blockcount && in xfs_rmap_count_owners_helper()
3022 check.rm_owner == roc->good.rm_owner && in xfs_rmap_count_owners_helper()
3023 check.rm_offset == roc->good.rm_offset && in xfs_rmap_count_owners_helper()
3024 keyflags == roc->good.rm_flags) { in xfs_rmap_count_owners_helper()
3025 roc->results->matches++; in xfs_rmap_count_owners_helper()
3027 roc->results->non_owner_matches++; in xfs_rmap_count_owners_helper()
3028 if (xfs_rmap_shareable(cur->bc_mp, &roc->good) ^ in xfs_rmap_count_owners_helper()
3029 xfs_rmap_shareable(cur->bc_mp, &check)) in xfs_rmap_count_owners_helper()
3030 roc->results->bad_non_owner_matches++; in xfs_rmap_count_owners_helper()
3033 if (roc->results->non_owner_matches && roc->stop_on_nonmatch) in xfs_rmap_count_owners_helper()
3034 return -ECANCELED; in xfs_rmap_count_owners_helper()
3039 /* Count the number of owners and non-owners of this range of blocks. */
3058 * There can't be any non-owner rmaps that conflict with the given in xfs_rmap_count_owners()
3061 if (!results->matches) in xfs_rmap_count_owners()
3062 results->bad_non_owner_matches = 0; in xfs_rmap_count_owners()
3088 if (error == -ECANCELED) { in xfs_rmap_has_other_keys()
3134 return xfs_rmap_intent_cache != NULL ? 0 : -ENOMEM; in xfs_rmap_intent_init_cache()