Lines Matching +full:high +full:- +full:to +full:- +full:low

1 // SPDX-License-Identifier: GPL-2.0+
29 /* Convert an xfs_fsmap to an fsmap. */
35 dest->fmr_device = src->fmr_device; in xfs_fsmap_from_internal()
36 dest->fmr_flags = src->fmr_flags; in xfs_fsmap_from_internal()
37 dest->fmr_physical = BBTOB(src->fmr_physical); in xfs_fsmap_from_internal()
38 dest->fmr_owner = src->fmr_owner; in xfs_fsmap_from_internal()
39 dest->fmr_offset = BBTOB(src->fmr_offset); in xfs_fsmap_from_internal()
40 dest->fmr_length = BBTOB(src->fmr_length); in xfs_fsmap_from_internal()
41 dest->fmr_reserved[0] = 0; in xfs_fsmap_from_internal()
42 dest->fmr_reserved[1] = 0; in xfs_fsmap_from_internal()
43 dest->fmr_reserved[2] = 0; in xfs_fsmap_from_internal()
46 /* Convert an fsmap to an xfs_fsmap. */
52 dest->fmr_device = src->fmr_device; in xfs_fsmap_to_internal()
53 dest->fmr_flags = src->fmr_flags; in xfs_fsmap_to_internal()
54 dest->fmr_physical = BTOBBT(src->fmr_physical); in xfs_fsmap_to_internal()
55 dest->fmr_owner = src->fmr_owner; in xfs_fsmap_to_internal()
56 dest->fmr_offset = BTOBBT(src->fmr_offset); in xfs_fsmap_to_internal()
57 dest->fmr_length = BTOBBT(src->fmr_length); in xfs_fsmap_to_internal()
66 if (!(src->fmr_flags & FMR_OF_SPECIAL_OWNER)) { in xfs_fsmap_owner_to_rmap()
67 dest->rm_owner = src->fmr_owner; in xfs_fsmap_owner_to_rmap()
71 switch (src->fmr_owner) { in xfs_fsmap_owner_to_rmap()
73 case -1ULL: /* "highest owner id possible" */ in xfs_fsmap_owner_to_rmap()
74 dest->rm_owner = 0; in xfs_fsmap_owner_to_rmap()
77 dest->rm_owner = XFS_RMAP_OWN_NULL; in xfs_fsmap_owner_to_rmap()
80 dest->rm_owner = XFS_RMAP_OWN_UNKNOWN; in xfs_fsmap_owner_to_rmap()
83 dest->rm_owner = XFS_RMAP_OWN_FS; in xfs_fsmap_owner_to_rmap()
86 dest->rm_owner = XFS_RMAP_OWN_LOG; in xfs_fsmap_owner_to_rmap()
89 dest->rm_owner = XFS_RMAP_OWN_AG; in xfs_fsmap_owner_to_rmap()
92 dest->rm_owner = XFS_RMAP_OWN_INOBT; in xfs_fsmap_owner_to_rmap()
95 dest->rm_owner = XFS_RMAP_OWN_INODES; in xfs_fsmap_owner_to_rmap()
98 dest->rm_owner = XFS_RMAP_OWN_REFC; in xfs_fsmap_owner_to_rmap()
101 dest->rm_owner = XFS_RMAP_OWN_COW; in xfs_fsmap_owner_to_rmap()
106 return -EINVAL; in xfs_fsmap_owner_to_rmap()
117 dest->fmr_flags = 0; in xfs_fsmap_owner_from_rmap()
118 if (!XFS_RMAP_NON_INODE_OWNER(src->rm_owner)) { in xfs_fsmap_owner_from_rmap()
119 dest->fmr_owner = src->rm_owner; in xfs_fsmap_owner_from_rmap()
122 dest->fmr_flags |= FMR_OF_SPECIAL_OWNER; in xfs_fsmap_owner_from_rmap()
124 switch (src->rm_owner) { in xfs_fsmap_owner_from_rmap()
126 dest->fmr_owner = XFS_FMR_OWN_FS; in xfs_fsmap_owner_from_rmap()
129 dest->fmr_owner = XFS_FMR_OWN_LOG; in xfs_fsmap_owner_from_rmap()
132 dest->fmr_owner = XFS_FMR_OWN_AG; in xfs_fsmap_owner_from_rmap()
135 dest->fmr_owner = XFS_FMR_OWN_INOBT; in xfs_fsmap_owner_from_rmap()
138 dest->fmr_owner = XFS_FMR_OWN_INODES; in xfs_fsmap_owner_from_rmap()
141 dest->fmr_owner = XFS_FMR_OWN_REFC; in xfs_fsmap_owner_from_rmap()
144 dest->fmr_owner = XFS_FMR_OWN_COW; in xfs_fsmap_owner_from_rmap()
147 dest->fmr_owner = XFS_FMR_OWN_FREE; in xfs_fsmap_owner_from_rmap()
151 return -EFSCORRUPTED; in xfs_fsmap_owner_from_rmap()
165 struct xfs_rmap_irec low; /* low rmap key */ member
166 struct xfs_rmap_irec high; /* high rmap key */ member
187 return d1->dev - d2->dev; in xfs_getfsmap_dev_compare()
198 struct xfs_mount *mp = tp->t_mountp; in xfs_getfsmap_is_shared()
208 if (!info->pag) in xfs_getfsmap_is_shared()
213 cur = xfs_refcountbt_init_cursor(mp, tp, info->agf_bp, info->pag); in xfs_getfsmap_is_shared()
215 error = xfs_refcount_find_shared(cur, rec->rm_startblock, in xfs_getfsmap_is_shared()
216 rec->rm_blockcount, &fbno, &flen, false); in xfs_getfsmap_is_shared()
236 rec = &info->fsmap_recs[info->head->fmh_entries++]; in xfs_getfsmap_format()
252 struct xfs_mount *mp = tp->t_mountp; in xfs_getfsmap_helper()
257 return -EINTR; in xfs_getfsmap_helper()
263 if (xfs_rmap_compare(rec, &info->low) < 0) { in xfs_getfsmap_helper()
264 rec_daddr += XFS_FSB_TO_BB(mp, rec->rm_blockcount); in xfs_getfsmap_helper()
265 if (info->next_daddr < rec_daddr) in xfs_getfsmap_helper()
266 info->next_daddr = rec_daddr; in xfs_getfsmap_helper()
271 if (info->head->fmh_count == 0) { in xfs_getfsmap_helper()
272 if (info->head->fmh_entries == UINT_MAX) in xfs_getfsmap_helper()
273 return -ECANCELED; in xfs_getfsmap_helper()
275 if (rec_daddr > info->next_daddr) in xfs_getfsmap_helper()
276 info->head->fmh_entries++; in xfs_getfsmap_helper()
278 if (info->last) in xfs_getfsmap_helper()
281 info->head->fmh_entries++; in xfs_getfsmap_helper()
283 rec_daddr += XFS_FSB_TO_BB(mp, rec->rm_blockcount); in xfs_getfsmap_helper()
284 if (info->next_daddr < rec_daddr) in xfs_getfsmap_helper()
285 info->next_daddr = rec_daddr; in xfs_getfsmap_helper()
294 if (rec_daddr > info->next_daddr) { in xfs_getfsmap_helper()
295 if (info->head->fmh_entries >= info->head->fmh_count) in xfs_getfsmap_helper()
296 return -ECANCELED; in xfs_getfsmap_helper()
298 fmr.fmr_device = info->dev; in xfs_getfsmap_helper()
299 fmr.fmr_physical = info->next_daddr; in xfs_getfsmap_helper()
300 fmr.fmr_owner = info->missing_owner; in xfs_getfsmap_helper()
302 fmr.fmr_length = rec_daddr - info->next_daddr; in xfs_getfsmap_helper()
307 if (info->last) in xfs_getfsmap_helper()
311 if (info->head->fmh_entries >= info->head->fmh_count) in xfs_getfsmap_helper()
312 return -ECANCELED; in xfs_getfsmap_helper()
314 trace_xfs_fsmap_mapping(mp, info->dev, in xfs_getfsmap_helper()
315 info->pag ? info->pag->pag_agno : NULLAGNUMBER, rec); in xfs_getfsmap_helper()
317 fmr.fmr_device = info->dev; in xfs_getfsmap_helper()
322 fmr.fmr_offset = XFS_FSB_TO_BB(mp, rec->rm_offset); in xfs_getfsmap_helper()
323 fmr.fmr_length = XFS_FSB_TO_BB(mp, rec->rm_blockcount); in xfs_getfsmap_helper()
324 if (rec->rm_flags & XFS_RMAP_UNWRITTEN) in xfs_getfsmap_helper()
326 if (rec->rm_flags & XFS_RMAP_ATTR_FORK) in xfs_getfsmap_helper()
328 if (rec->rm_flags & XFS_RMAP_BMBT_BLOCK) in xfs_getfsmap_helper()
340 rec_daddr += XFS_FSB_TO_BB(mp, rec->rm_blockcount); in xfs_getfsmap_helper()
341 if (info->next_daddr < rec_daddr) in xfs_getfsmap_helper()
342 info->next_daddr = rec_daddr; in xfs_getfsmap_helper()
353 struct xfs_mount *mp = cur->bc_mp; in xfs_getfsmap_datadev_helper()
358 fsb = XFS_AGB_TO_FSB(mp, cur->bc_ag.pag->pag_agno, rec->rm_startblock); in xfs_getfsmap_datadev_helper()
361 return xfs_getfsmap_helper(cur->bc_tp, info, rec, rec_daddr); in xfs_getfsmap_datadev_helper()
371 struct xfs_mount *mp = cur->bc_mp; in xfs_getfsmap_datadev_bnobt_helper()
376 rec_daddr = XFS_AGB_TO_DADDR(mp, cur->bc_ag.pag->pag_agno, in xfs_getfsmap_datadev_bnobt_helper()
377 rec->ar_startblock); in xfs_getfsmap_datadev_bnobt_helper()
379 irec.rm_startblock = rec->ar_startblock; in xfs_getfsmap_datadev_bnobt_helper()
380 irec.rm_blockcount = rec->ar_blockcount; in xfs_getfsmap_datadev_bnobt_helper()
385 return xfs_getfsmap_helper(cur->bc_tp, info, &irec, rec_daddr); in xfs_getfsmap_datadev_bnobt_helper()
394 irec->rm_flags = 0; in xfs_getfsmap_set_irec_flags()
395 if (fmr->fmr_flags & FMR_OF_ATTR_FORK) in xfs_getfsmap_set_irec_flags()
396 irec->rm_flags |= XFS_RMAP_ATTR_FORK; in xfs_getfsmap_set_irec_flags()
397 if (fmr->fmr_flags & FMR_OF_EXTENT_MAP) in xfs_getfsmap_set_irec_flags()
398 irec->rm_flags |= XFS_RMAP_BMBT_BLOCK; in xfs_getfsmap_set_irec_flags()
399 if (fmr->fmr_flags & FMR_OF_PREALLOC) in xfs_getfsmap_set_irec_flags()
400 irec->rm_flags |= XFS_RMAP_UNWRITTEN; in xfs_getfsmap_set_irec_flags()
410 struct xfs_mount *mp = tp->t_mountp; in xfs_getfsmap_logdev()
415 info->low.rm_startblock = XFS_BB_TO_FSBT(mp, keys[0].fmr_physical); in xfs_getfsmap_logdev()
416 info->low.rm_offset = XFS_BB_TO_FSBT(mp, keys[0].fmr_offset); in xfs_getfsmap_logdev()
417 error = xfs_fsmap_owner_to_rmap(&info->low, keys); in xfs_getfsmap_logdev()
420 info->low.rm_blockcount = 0; in xfs_getfsmap_logdev()
421 xfs_getfsmap_set_irec_flags(&info->low, &keys[0]); in xfs_getfsmap_logdev()
423 error = xfs_fsmap_owner_to_rmap(&info->high, keys + 1); in xfs_getfsmap_logdev()
426 info->high.rm_startblock = -1U; in xfs_getfsmap_logdev()
427 info->high.rm_owner = ULLONG_MAX; in xfs_getfsmap_logdev()
428 info->high.rm_offset = ULLONG_MAX; in xfs_getfsmap_logdev()
429 info->high.rm_blockcount = 0; in xfs_getfsmap_logdev()
430 info->high.rm_flags = XFS_RMAP_KEY_FLAGS | XFS_RMAP_REC_FLAGS; in xfs_getfsmap_logdev()
431 info->missing_owner = XFS_FMR_OWN_FREE; in xfs_getfsmap_logdev()
433 trace_xfs_fsmap_low_key(mp, info->dev, NULLAGNUMBER, &info->low); in xfs_getfsmap_logdev()
434 trace_xfs_fsmap_high_key(mp, info->dev, NULLAGNUMBER, &info->high); in xfs_getfsmap_logdev()
441 rmap.rm_blockcount = mp->m_sb.sb_logblocks; in xfs_getfsmap_logdev()
462 irec.rm_startblock = rec->ar_startext * mp->m_sb.sb_rextsize; in xfs_getfsmap_rtdev_rtbitmap_helper()
464 irec.rm_blockcount = rec->ar_extcount * mp->m_sb.sb_rextsize; in xfs_getfsmap_rtdev_rtbitmap_helper()
481 struct xfs_mount *mp = tp->t_mountp; in __xfs_getfsmap_rtdev()
487 eofs = XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks); in __xfs_getfsmap_rtdev()
491 end_fsb = XFS_BB_TO_FSB(mp, min(eofs - 1, keys[1].fmr_physical)); in __xfs_getfsmap_rtdev()
494 info->low.rm_startblock = start_fsb; in __xfs_getfsmap_rtdev()
495 error = xfs_fsmap_owner_to_rmap(&info->low, &keys[0]); in __xfs_getfsmap_rtdev()
498 info->low.rm_offset = XFS_BB_TO_FSBT(mp, keys[0].fmr_offset); in __xfs_getfsmap_rtdev()
499 info->low.rm_blockcount = 0; in __xfs_getfsmap_rtdev()
500 xfs_getfsmap_set_irec_flags(&info->low, &keys[0]); in __xfs_getfsmap_rtdev()
502 info->high.rm_startblock = end_fsb; in __xfs_getfsmap_rtdev()
503 error = xfs_fsmap_owner_to_rmap(&info->high, &keys[1]); in __xfs_getfsmap_rtdev()
506 info->high.rm_offset = XFS_BB_TO_FSBT(mp, keys[1].fmr_offset); in __xfs_getfsmap_rtdev()
507 info->high.rm_blockcount = 0; in __xfs_getfsmap_rtdev()
508 xfs_getfsmap_set_irec_flags(&info->high, &keys[1]); in __xfs_getfsmap_rtdev()
510 trace_xfs_fsmap_low_key(mp, info->dev, NULLAGNUMBER, &info->low); in __xfs_getfsmap_rtdev()
511 trace_xfs_fsmap_high_key(mp, info->dev, NULLAGNUMBER, &info->high); in __xfs_getfsmap_rtdev()
524 struct xfs_mount *mp = tp->t_mountp; in xfs_getfsmap_rtdev_rtbitmap_query()
527 xfs_ilock(mp->m_rbmip, XFS_ILOCK_SHARED); in xfs_getfsmap_rtdev_rtbitmap_query()
530 * Set up query parameters to return free rtextents covering the range in xfs_getfsmap_rtdev_rtbitmap_query()
533 alow.ar_startext = info->low.rm_startblock; in xfs_getfsmap_rtdev_rtbitmap_query()
534 ahigh.ar_startext = info->high.rm_startblock; in xfs_getfsmap_rtdev_rtbitmap_query()
535 do_div(alow.ar_startext, mp->m_sb.sb_rextsize); in xfs_getfsmap_rtdev_rtbitmap_query()
536 if (do_div(ahigh.ar_startext, mp->m_sb.sb_rextsize)) in xfs_getfsmap_rtdev_rtbitmap_query()
547 info->last = true; in xfs_getfsmap_rtdev_rtbitmap_query()
548 ahigh.ar_startext = min(mp->m_sb.sb_rextents, ahigh.ar_startext); in xfs_getfsmap_rtdev_rtbitmap_query()
554 xfs_iunlock(mp->m_rbmip, XFS_ILOCK_SHARED); in xfs_getfsmap_rtdev_rtbitmap_query()
565 info->missing_owner = XFS_FMR_OWN_UNKNOWN; in xfs_getfsmap_rtdev_rtbitmap()
583 struct xfs_mount *mp = tp->t_mountp; in __xfs_getfsmap_datadev()
593 eofs = XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); in __xfs_getfsmap_datadev()
597 end_fsb = XFS_DADDR_TO_FSB(mp, min(eofs - 1, keys[1].fmr_physical)); in __xfs_getfsmap_datadev()
600 * Convert the fsmap low/high keys to AG based keys. Initialize in __xfs_getfsmap_datadev()
601 * low to the fsmap low key and max out the high key to the end in __xfs_getfsmap_datadev()
604 info->low.rm_startblock = XFS_FSB_TO_AGBNO(mp, start_fsb); in __xfs_getfsmap_datadev()
605 info->low.rm_offset = XFS_BB_TO_FSBT(mp, keys[0].fmr_offset); in __xfs_getfsmap_datadev()
606 error = xfs_fsmap_owner_to_rmap(&info->low, &keys[0]); in __xfs_getfsmap_datadev()
609 info->low.rm_blockcount = 0; in __xfs_getfsmap_datadev()
610 xfs_getfsmap_set_irec_flags(&info->low, &keys[0]); in __xfs_getfsmap_datadev()
612 info->high.rm_startblock = -1U; in __xfs_getfsmap_datadev()
613 info->high.rm_owner = ULLONG_MAX; in __xfs_getfsmap_datadev()
614 info->high.rm_offset = ULLONG_MAX; in __xfs_getfsmap_datadev()
615 info->high.rm_blockcount = 0; in __xfs_getfsmap_datadev()
616 info->high.rm_flags = XFS_RMAP_KEY_FLAGS | XFS_RMAP_REC_FLAGS; in __xfs_getfsmap_datadev()
623 * Set the AG high key from the fsmap high key if this in __xfs_getfsmap_datadev()
626 info->pag = pag; in __xfs_getfsmap_datadev()
627 if (pag->pag_agno == end_ag) { in __xfs_getfsmap_datadev()
628 info->high.rm_startblock = XFS_FSB_TO_AGBNO(mp, in __xfs_getfsmap_datadev()
630 info->high.rm_offset = XFS_BB_TO_FSBT(mp, in __xfs_getfsmap_datadev()
632 error = xfs_fsmap_owner_to_rmap(&info->high, &keys[1]); in __xfs_getfsmap_datadev()
635 xfs_getfsmap_set_irec_flags(&info->high, &keys[1]); in __xfs_getfsmap_datadev()
641 xfs_trans_brelse(tp, info->agf_bp); in __xfs_getfsmap_datadev()
642 info->agf_bp = NULL; in __xfs_getfsmap_datadev()
645 error = xfs_alloc_read_agf(pag, tp, 0, &info->agf_bp); in __xfs_getfsmap_datadev()
649 trace_xfs_fsmap_low_key(mp, info->dev, pag->pag_agno, in __xfs_getfsmap_datadev()
650 &info->low); in __xfs_getfsmap_datadev()
651 trace_xfs_fsmap_high_key(mp, info->dev, pag->pag_agno, in __xfs_getfsmap_datadev()
652 &info->high); in __xfs_getfsmap_datadev()
659 * Set the AG low key to the start of the AG prior to in __xfs_getfsmap_datadev()
660 * moving on to the next AG. in __xfs_getfsmap_datadev()
662 if (pag->pag_agno == start_ag) { in __xfs_getfsmap_datadev()
663 info->low.rm_startblock = 0; in __xfs_getfsmap_datadev()
664 info->low.rm_owner = 0; in __xfs_getfsmap_datadev()
665 info->low.rm_offset = 0; in __xfs_getfsmap_datadev()
666 info->low.rm_flags = 0; in __xfs_getfsmap_datadev()
671 * before we drop the reference to the perag when the loop in __xfs_getfsmap_datadev()
674 if (pag->pag_agno == end_ag) { in __xfs_getfsmap_datadev()
675 info->last = true; in __xfs_getfsmap_datadev()
680 info->pag = NULL; in __xfs_getfsmap_datadev()
686 if (info->agf_bp) { in __xfs_getfsmap_datadev()
687 xfs_trans_brelse(tp, info->agf_bp); in __xfs_getfsmap_datadev()
688 info->agf_bp = NULL; in __xfs_getfsmap_datadev()
690 if (info->pag) { in __xfs_getfsmap_datadev()
691 xfs_perag_put(info->pag); in __xfs_getfsmap_datadev()
692 info->pag = NULL; in __xfs_getfsmap_datadev()
710 if (info->last) in xfs_getfsmap_datadev_rmapbt_query()
711 return xfs_getfsmap_datadev_helper(*curpp, &info->high, info); in xfs_getfsmap_datadev_rmapbt_query()
714 *curpp = xfs_rmapbt_init_cursor(tp->t_mountp, tp, info->agf_bp, in xfs_getfsmap_datadev_rmapbt_query()
715 info->pag); in xfs_getfsmap_datadev_rmapbt_query()
716 return xfs_rmap_query_range(*curpp, &info->low, &info->high, in xfs_getfsmap_datadev_rmapbt_query()
727 info->missing_owner = XFS_FMR_OWN_FREE; in xfs_getfsmap_datadev_rmapbt()
743 if (info->last) in xfs_getfsmap_datadev_bnobt_query()
747 *curpp = xfs_allocbt_init_cursor(tp->t_mountp, tp, info->agf_bp, in xfs_getfsmap_datadev_bnobt_query()
748 info->pag, XFS_BTNUM_BNO); in xfs_getfsmap_datadev_bnobt_query()
749 key->ar_startblock = info->low.rm_startblock; in xfs_getfsmap_datadev_bnobt_query()
750 key[1].ar_startblock = info->high.rm_startblock; in xfs_getfsmap_datadev_bnobt_query()
764 info->missing_owner = XFS_FMR_OWN_UNKNOWN; in xfs_getfsmap_datadev_bnobt()
775 if (fm->fmr_device == 0 || fm->fmr_device == UINT_MAX || in xfs_getfsmap_is_valid_device()
776 fm->fmr_device == new_encode_dev(mp->m_ddev_targp->bt_dev)) in xfs_getfsmap_is_valid_device()
778 if (mp->m_logdev_targp && in xfs_getfsmap_is_valid_device()
779 fm->fmr_device == new_encode_dev(mp->m_logdev_targp->bt_dev)) in xfs_getfsmap_is_valid_device()
781 if (mp->m_rtdev_targp && in xfs_getfsmap_is_valid_device()
782 fm->fmr_device == new_encode_dev(mp->m_rtdev_targp->bt_dev)) in xfs_getfsmap_is_valid_device()
787 /* Ensure that the low key is less than the high key. */
793 if (low_key->fmr_device > high_key->fmr_device) in xfs_getfsmap_check_keys()
795 if (low_key->fmr_device < high_key->fmr_device) in xfs_getfsmap_check_keys()
798 if (low_key->fmr_physical > high_key->fmr_physical) in xfs_getfsmap_check_keys()
800 if (low_key->fmr_physical < high_key->fmr_physical) in xfs_getfsmap_check_keys()
803 if (low_key->fmr_owner > high_key->fmr_owner) in xfs_getfsmap_check_keys()
805 if (low_key->fmr_owner < high_key->fmr_owner) in xfs_getfsmap_check_keys()
808 if (low_key->fmr_offset > high_key->fmr_offset) in xfs_getfsmap_check_keys()
810 if (low_key->fmr_offset < high_key->fmr_offset) in xfs_getfsmap_check_keys()
827 * in the supplied records array until there are no more reverse mappings to
829 * function returns -ECANCELED to indicate that more records would have been
832 * Key to Confusion
833 * ----------------
835 * xfs_fsmap_head.fmh_keys -- low and high fsmap keys passed in;
836 * these reflect fs-wide sector addrs.
837 * dkeys -- fmh_keys used to query each device;
838 * these are fmh_keys but w/ the low key
840 * xfs_getfsmap_info.next_daddr -- next disk addr we expect to see; this
843 * xfs_getfsmap_info.low/high -- per-AG low/high keys computed from
844 * dkeys; used to query the metadata.
853 struct xfs_fsmap dkeys[2]; /* per-dev keys */ in xfs_getfsmap()
860 if (head->fmh_iflags & ~FMH_IF_VALID) in xfs_getfsmap()
861 return -EINVAL; in xfs_getfsmap()
862 if (!xfs_getfsmap_is_valid_device(mp, &head->fmh_keys[0]) || in xfs_getfsmap()
863 !xfs_getfsmap_is_valid_device(mp, &head->fmh_keys[1])) in xfs_getfsmap()
864 return -EINVAL; in xfs_getfsmap()
868 head->fmh_entries = 0; in xfs_getfsmap()
872 handlers[0].dev = new_encode_dev(mp->m_ddev_targp->bt_dev); in xfs_getfsmap()
877 if (mp->m_logdev_targp != mp->m_ddev_targp) { in xfs_getfsmap()
878 handlers[1].dev = new_encode_dev(mp->m_logdev_targp->bt_dev); in xfs_getfsmap()
882 if (mp->m_rtdev_targp) { in xfs_getfsmap()
883 handlers[2].dev = new_encode_dev(mp->m_rtdev_targp->bt_dev); in xfs_getfsmap()
892 * To continue where we left off, we allow userspace to use the in xfs_getfsmap()
893 * last mapping from a previous call as the low key of the next. in xfs_getfsmap()
894 * This is identified by a non-zero length in the low key. We in xfs_getfsmap()
895 * have to increment the low key in this scenario to ensure we in xfs_getfsmap()
899 * If the low key mapping refers to file data, the same physical in xfs_getfsmap()
900 * blocks could be mapped to several other files/offsets. in xfs_getfsmap()
901 * According to rmapbt record ordering, the minimal next in xfs_getfsmap()
903 * offset in the same inode. Therefore, bump the file offset to in xfs_getfsmap()
904 * continue the search appropriately. For all other low key in xfs_getfsmap()
909 dkeys[0] = head->fmh_keys[0]; in xfs_getfsmap()
914 return -EINVAL; in xfs_getfsmap()
920 if (!xfs_getfsmap_check_keys(dkeys, &head->fmh_keys[1])) in xfs_getfsmap()
921 return -EINVAL; in xfs_getfsmap()
923 info.next_daddr = head->fmh_keys[0].fmr_physical + in xfs_getfsmap()
924 head->fmh_keys[0].fmr_length; in xfs_getfsmap()
933 if (head->fmh_keys[0].fmr_device > handlers[i].dev) in xfs_getfsmap()
935 if (head->fmh_keys[1].fmr_device < handlers[i].dev) in xfs_getfsmap()
939 * If this device number matches the high key, we have in xfs_getfsmap()
940 * to pass the high key to the handler to limit the in xfs_getfsmap()
942 * low key, zero out the low key so that we get in xfs_getfsmap()
945 if (handlers[i].dev == head->fmh_keys[1].fmr_device) in xfs_getfsmap()
946 dkeys[1] = head->fmh_keys[1]; in xfs_getfsmap()
947 if (handlers[i].dev > head->fmh_keys[0].fmr_device) in xfs_getfsmap()
952 * buffer locking abilities to detect cycles in the rmapbt in xfs_getfsmap()
972 head->fmh_oflags = FMH_OF_DEV_T; in xfs_getfsmap()