• Home
  • Raw
  • Download

Lines Matching refs:rl

74 static inline runlist_element *ntfs_rl_realloc(runlist_element *rl,  in ntfs_rl_realloc()  argument
79 old_size = PAGE_ALIGN(old_size * sizeof(*rl)); in ntfs_rl_realloc()
80 new_size = PAGE_ALIGN(new_size * sizeof(*rl)); in ntfs_rl_realloc()
82 return rl; in ntfs_rl_realloc()
88 if (likely(rl != NULL)) { in ntfs_rl_realloc()
91 memcpy(new_rl, rl, old_size); in ntfs_rl_realloc()
92 ntfs_free(rl); in ntfs_rl_realloc()
120 static inline runlist_element *ntfs_rl_realloc_nofail(runlist_element *rl, in ntfs_rl_realloc_nofail() argument
125 old_size = PAGE_ALIGN(old_size * sizeof(*rl)); in ntfs_rl_realloc_nofail()
126 new_size = PAGE_ALIGN(new_size * sizeof(*rl)); in ntfs_rl_realloc_nofail()
128 return rl; in ntfs_rl_realloc_nofail()
133 if (likely(rl != NULL)) { in ntfs_rl_realloc_nofail()
136 memcpy(new_rl, rl, old_size); in ntfs_rl_realloc_nofail()
137 ntfs_free(rl); in ntfs_rl_realloc_nofail()
755 runlist_element *rl; /* The output runlist. */ in ntfs_mapping_pairs_decompress() local
788 rl = ntfs_malloc_nofs(rlsize = PAGE_SIZE); in ntfs_mapping_pairs_decompress()
789 if (unlikely(!rl)) in ntfs_mapping_pairs_decompress()
793 rl->vcn = 0; in ntfs_mapping_pairs_decompress()
794 rl->lcn = LCN_RL_NOT_MAPPED; in ntfs_mapping_pairs_decompress()
795 rl->length = vcn; in ntfs_mapping_pairs_decompress()
809 ntfs_free(rl); in ntfs_mapping_pairs_decompress()
812 memcpy(rl2, rl, rlsize); in ntfs_mapping_pairs_decompress()
813 ntfs_free(rl); in ntfs_mapping_pairs_decompress()
814 rl = rl2; in ntfs_mapping_pairs_decompress()
818 rl[rlpos].vcn = vcn; in ntfs_mapping_pairs_decompress()
850 rl[rlpos].length = deltaxcn; in ntfs_mapping_pairs_decompress()
859 rl[rlpos].lcn = LCN_HOLE; in ntfs_mapping_pairs_decompress()
892 rl[rlpos].lcn = lcn; in ntfs_mapping_pairs_decompress()
938 rl[rlpos].vcn = vcn; in ntfs_mapping_pairs_decompress()
939 vcn += rl[rlpos].length = max_cluster - in ntfs_mapping_pairs_decompress()
941 rl[rlpos].lcn = LCN_RL_NOT_MAPPED; in ntfs_mapping_pairs_decompress()
953 rl[rlpos].lcn = LCN_ENOENT; in ntfs_mapping_pairs_decompress()
955 rl[rlpos].lcn = LCN_RL_NOT_MAPPED; in ntfs_mapping_pairs_decompress()
958 rl[rlpos].vcn = vcn; in ntfs_mapping_pairs_decompress()
959 rl[rlpos].length = (s64)0; in ntfs_mapping_pairs_decompress()
963 ntfs_debug_dump_runlist(rl); in ntfs_mapping_pairs_decompress()
964 return rl; in ntfs_mapping_pairs_decompress()
967 old_rl = ntfs_runlists_merge(old_rl, rl); in ntfs_mapping_pairs_decompress()
970 ntfs_free(rl); in ntfs_mapping_pairs_decompress()
976 ntfs_free(rl); in ntfs_mapping_pairs_decompress()
1004 LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn) in ntfs_rl_vcn_to_lcn() argument
1014 if (unlikely(!rl)) in ntfs_rl_vcn_to_lcn()
1018 if (unlikely(vcn < rl[0].vcn)) in ntfs_rl_vcn_to_lcn()
1021 for (i = 0; likely(rl[i].length); i++) { in ntfs_rl_vcn_to_lcn()
1022 if (unlikely(vcn < rl[i+1].vcn)) { in ntfs_rl_vcn_to_lcn()
1023 if (likely(rl[i].lcn >= (LCN)0)) in ntfs_rl_vcn_to_lcn()
1024 return rl[i].lcn + (vcn - rl[i].vcn); in ntfs_rl_vcn_to_lcn()
1025 return rl[i].lcn; in ntfs_rl_vcn_to_lcn()
1032 if (likely(rl[i].lcn < (LCN)0)) in ntfs_rl_vcn_to_lcn()
1033 return rl[i].lcn; in ntfs_rl_vcn_to_lcn()
1053 runlist_element *ntfs_rl_find_vcn_nolock(runlist_element *rl, const VCN vcn) in ntfs_rl_find_vcn_nolock() argument
1056 if (unlikely(!rl || vcn < rl[0].vcn)) in ntfs_rl_find_vcn_nolock()
1058 while (likely(rl->length)) { in ntfs_rl_find_vcn_nolock()
1059 if (unlikely(vcn < rl[1].vcn)) { in ntfs_rl_find_vcn_nolock()
1060 if (likely(rl->lcn >= LCN_HOLE)) in ntfs_rl_find_vcn_nolock()
1061 return rl; in ntfs_rl_find_vcn_nolock()
1064 rl++; in ntfs_rl_find_vcn_nolock()
1066 if (likely(rl->lcn == LCN_ENOENT)) in ntfs_rl_find_vcn_nolock()
1067 return rl; in ntfs_rl_find_vcn_nolock()
1132 const runlist_element *rl, const VCN first_vcn, in ntfs_get_size_for_mapping_pairs() argument
1142 if (!rl) { in ntfs_get_size_for_mapping_pairs()
1148 while (rl->length && first_vcn >= rl[1].vcn) in ntfs_get_size_for_mapping_pairs()
1149 rl++; in ntfs_get_size_for_mapping_pairs()
1150 if (unlikely((!rl->length && first_vcn > rl->vcn) || in ntfs_get_size_for_mapping_pairs()
1151 first_vcn < rl->vcn)) in ntfs_get_size_for_mapping_pairs()
1157 if (first_vcn > rl->vcn) { in ntfs_get_size_for_mapping_pairs()
1158 s64 delta, length = rl->length; in ntfs_get_size_for_mapping_pairs()
1161 if (unlikely(length < 0 || rl->lcn < LCN_HOLE)) in ntfs_get_size_for_mapping_pairs()
1167 if (unlikely(last_vcn >= 0 && rl[1].vcn > last_vcn)) { in ntfs_get_size_for_mapping_pairs()
1169 if (unlikely(rl[1].vcn > s1)) in ntfs_get_size_for_mapping_pairs()
1170 length = s1 - rl->vcn; in ntfs_get_size_for_mapping_pairs()
1173 delta = first_vcn - rl->vcn; in ntfs_get_size_for_mapping_pairs()
1183 if (likely(rl->lcn >= 0 || vol->major_ver < 3)) { in ntfs_get_size_for_mapping_pairs()
1184 prev_lcn = rl->lcn; in ntfs_get_size_for_mapping_pairs()
1185 if (likely(rl->lcn >= 0)) in ntfs_get_size_for_mapping_pairs()
1191 rl++; in ntfs_get_size_for_mapping_pairs()
1194 for (; rl->length && !the_end; rl++) { in ntfs_get_size_for_mapping_pairs()
1195 s64 length = rl->length; in ntfs_get_size_for_mapping_pairs()
1197 if (unlikely(length < 0 || rl->lcn < LCN_HOLE)) in ntfs_get_size_for_mapping_pairs()
1203 if (unlikely(last_vcn >= 0 && rl[1].vcn > last_vcn)) { in ntfs_get_size_for_mapping_pairs()
1205 if (unlikely(rl[1].vcn > s1)) in ntfs_get_size_for_mapping_pairs()
1206 length = s1 - rl->vcn; in ntfs_get_size_for_mapping_pairs()
1218 if (likely(rl->lcn >= 0 || vol->major_ver < 3)) { in ntfs_get_size_for_mapping_pairs()
1220 rls += ntfs_get_nr_significant_bytes(rl->lcn - in ntfs_get_size_for_mapping_pairs()
1222 prev_lcn = rl->lcn; in ntfs_get_size_for_mapping_pairs()
1227 if (rl->lcn == LCN_RL_NOT_MAPPED) in ntfs_get_size_for_mapping_pairs()
1324 const int dst_len, const runlist_element *rl, in ntfs_mapping_pairs_build() argument
1337 if (!rl) { in ntfs_mapping_pairs_build()
1347 while (rl->length && first_vcn >= rl[1].vcn) in ntfs_mapping_pairs_build()
1348 rl++; in ntfs_mapping_pairs_build()
1349 if (unlikely((!rl->length && first_vcn > rl->vcn) || in ntfs_mapping_pairs_build()
1350 first_vcn < rl->vcn)) in ntfs_mapping_pairs_build()
1359 if (first_vcn > rl->vcn) { in ntfs_mapping_pairs_build()
1360 s64 delta, length = rl->length; in ntfs_mapping_pairs_build()
1363 if (unlikely(length < 0 || rl->lcn < LCN_HOLE)) in ntfs_mapping_pairs_build()
1369 if (unlikely(last_vcn >= 0 && rl[1].vcn > last_vcn)) { in ntfs_mapping_pairs_build()
1371 if (unlikely(rl[1].vcn > s1)) in ntfs_mapping_pairs_build()
1372 length = s1 - rl->vcn; in ntfs_mapping_pairs_build()
1375 delta = first_vcn - rl->vcn; in ntfs_mapping_pairs_build()
1390 if (likely(rl->lcn >= 0 || vol->major_ver < 3)) { in ntfs_mapping_pairs_build()
1391 prev_lcn = rl->lcn; in ntfs_mapping_pairs_build()
1392 if (likely(rl->lcn >= 0)) in ntfs_mapping_pairs_build()
1409 rl++; in ntfs_mapping_pairs_build()
1412 for (; rl->length && !the_end; rl++) { in ntfs_mapping_pairs_build()
1413 s64 length = rl->length; in ntfs_mapping_pairs_build()
1415 if (unlikely(length < 0 || rl->lcn < LCN_HOLE)) in ntfs_mapping_pairs_build()
1421 if (unlikely(last_vcn >= 0 && rl[1].vcn > last_vcn)) { in ntfs_mapping_pairs_build()
1423 if (unlikely(rl[1].vcn > s1)) in ntfs_mapping_pairs_build()
1424 length = s1 - rl->vcn; in ntfs_mapping_pairs_build()
1441 if (likely(rl->lcn >= 0 || vol->major_ver < 3)) { in ntfs_mapping_pairs_build()
1444 len_len, dst_max, rl->lcn - prev_lcn); in ntfs_mapping_pairs_build()
1447 prev_lcn = rl->lcn; in ntfs_mapping_pairs_build()
1463 *stop_vcn = rl->vcn; in ntfs_mapping_pairs_build()
1468 if (rl->lcn == LCN_RL_NOT_MAPPED) in ntfs_mapping_pairs_build()
1502 runlist_element *rl; in ntfs_rl_truncate_nolock() local
1508 rl = runlist->rl; in ntfs_rl_truncate_nolock()
1511 runlist->rl = NULL; in ntfs_rl_truncate_nolock()
1512 if (rl) in ntfs_rl_truncate_nolock()
1513 ntfs_free(rl); in ntfs_rl_truncate_nolock()
1516 if (unlikely(!rl)) { in ntfs_rl_truncate_nolock()
1521 rl = ntfs_malloc_nofs(PAGE_SIZE); in ntfs_rl_truncate_nolock()
1522 if (unlikely(!rl)) { in ntfs_rl_truncate_nolock()
1527 runlist->rl = rl; in ntfs_rl_truncate_nolock()
1528 rl[1].length = rl->vcn = 0; in ntfs_rl_truncate_nolock()
1529 rl->lcn = LCN_HOLE; in ntfs_rl_truncate_nolock()
1530 rl[1].vcn = rl->length = new_length; in ntfs_rl_truncate_nolock()
1531 rl[1].lcn = LCN_ENOENT; in ntfs_rl_truncate_nolock()
1534 BUG_ON(new_length < rl->vcn); in ntfs_rl_truncate_nolock()
1536 while (likely(rl->length && new_length >= rl[1].vcn)) in ntfs_rl_truncate_nolock()
1537 rl++; in ntfs_rl_truncate_nolock()
1542 if (rl->length) { in ntfs_rl_truncate_nolock()
1548 trl = rl + 1; in ntfs_rl_truncate_nolock()
1551 old_size = trl - runlist->rl + 1; in ntfs_rl_truncate_nolock()
1553 rl->length = new_length - rl->vcn; in ntfs_rl_truncate_nolock()
1559 if (rl->length) { in ntfs_rl_truncate_nolock()
1560 rl++; in ntfs_rl_truncate_nolock()
1561 if (!rl->length) in ntfs_rl_truncate_nolock()
1563 rl->vcn = new_length; in ntfs_rl_truncate_nolock()
1564 rl->length = 0; in ntfs_rl_truncate_nolock()
1566 rl->lcn = LCN_ENOENT; in ntfs_rl_truncate_nolock()
1569 int new_size = rl - runlist->rl + 1; in ntfs_rl_truncate_nolock()
1570 rl = ntfs_rl_realloc(runlist->rl, old_size, new_size); in ntfs_rl_truncate_nolock()
1571 if (IS_ERR(rl)) in ntfs_rl_truncate_nolock()
1578 runlist->rl = rl; in ntfs_rl_truncate_nolock()
1580 } else if (likely(/* !rl->length && */ new_length > rl->vcn)) { in ntfs_rl_truncate_nolock()
1587 if ((rl > runlist->rl) && ((rl - 1)->lcn == LCN_HOLE)) in ntfs_rl_truncate_nolock()
1588 (rl - 1)->length = new_length - (rl - 1)->vcn; in ntfs_rl_truncate_nolock()
1591 old_size = rl - runlist->rl + 1; in ntfs_rl_truncate_nolock()
1593 rl = ntfs_rl_realloc(runlist->rl, old_size, in ntfs_rl_truncate_nolock()
1595 if (IS_ERR(rl)) { in ntfs_rl_truncate_nolock()
1598 return PTR_ERR(rl); in ntfs_rl_truncate_nolock()
1600 runlist->rl = rl; in ntfs_rl_truncate_nolock()
1605 rl += old_size - 1; in ntfs_rl_truncate_nolock()
1607 rl->lcn = LCN_HOLE; in ntfs_rl_truncate_nolock()
1608 rl->length = new_length - rl->vcn; in ntfs_rl_truncate_nolock()
1610 rl++; in ntfs_rl_truncate_nolock()
1611 rl->length = 0; in ntfs_rl_truncate_nolock()
1613 rl->vcn = new_length; in ntfs_rl_truncate_nolock()
1614 rl->lcn = LCN_ENOENT; in ntfs_rl_truncate_nolock()
1617 rl->lcn = LCN_ENOENT; in ntfs_rl_truncate_nolock()
1649 runlist_element *rl, *rl_end, *rl_real_end, *trl; in ntfs_rl_punch_nolock() local
1659 rl = runlist->rl; in ntfs_rl_punch_nolock()
1660 if (unlikely(!rl)) { in ntfs_rl_punch_nolock()
1666 while (likely(rl->length && start >= rl[1].vcn)) in ntfs_rl_punch_nolock()
1667 rl++; in ntfs_rl_punch_nolock()
1668 rl_end = rl; in ntfs_rl_punch_nolock()
1684 if (!rl->length) in ntfs_rl_punch_nolock()
1690 old_size = rl_real_end - runlist->rl + 1; in ntfs_rl_punch_nolock()
1692 if (rl->lcn == LCN_HOLE) { in ntfs_rl_punch_nolock()
1697 if (end <= rl[1].vcn) { in ntfs_rl_punch_nolock()
1703 rl->length = end - rl->vcn; in ntfs_rl_punch_nolock()
1707 rl->length = rl_end->vcn - rl->vcn; in ntfs_rl_punch_nolock()
1710 rl++; in ntfs_rl_punch_nolock()
1712 if (rl < rl_end) in ntfs_rl_punch_nolock()
1713 memmove(rl, rl_end, (rl_real_end - rl_end + 1) * in ntfs_rl_punch_nolock()
1714 sizeof(*rl)); in ntfs_rl_punch_nolock()
1716 if (end > rl->vcn) { in ntfs_rl_punch_nolock()
1717 delta = end - rl->vcn; in ntfs_rl_punch_nolock()
1718 rl->vcn = end; in ntfs_rl_punch_nolock()
1719 rl->length -= delta; in ntfs_rl_punch_nolock()
1721 if (rl->lcn >= 0) in ntfs_rl_punch_nolock()
1722 rl->lcn += delta; in ntfs_rl_punch_nolock()
1726 if (rl < rl_end) { in ntfs_rl_punch_nolock()
1727 rl = ntfs_rl_realloc(runlist->rl, old_size, in ntfs_rl_punch_nolock()
1728 old_size - (rl_end - rl)); in ntfs_rl_punch_nolock()
1729 if (IS_ERR(rl)) in ntfs_rl_punch_nolock()
1736 runlist->rl = rl; in ntfs_rl_punch_nolock()
1745 if (start == rl->vcn) { in ntfs_rl_punch_nolock()
1757 if (rl > runlist->rl && (rl - 1)->lcn == LCN_HOLE) { in ntfs_rl_punch_nolock()
1758 rl--; in ntfs_rl_punch_nolock()
1761 if (end >= rl[1].vcn) { in ntfs_rl_punch_nolock()
1762 rl->lcn = LCN_HOLE; in ntfs_rl_punch_nolock()
1772 trl = ntfs_rl_realloc(runlist->rl, old_size, old_size + 1); in ntfs_rl_punch_nolock()
1776 if (runlist->rl != trl) { in ntfs_rl_punch_nolock()
1777 rl = trl + (rl - runlist->rl); in ntfs_rl_punch_nolock()
1778 rl_end = trl + (rl_end - runlist->rl); in ntfs_rl_punch_nolock()
1779 rl_real_end = trl + (rl_real_end - runlist->rl); in ntfs_rl_punch_nolock()
1780 runlist->rl = trl; in ntfs_rl_punch_nolock()
1784 memmove(rl + 1, rl, (rl_real_end - rl + 1) * sizeof(*rl)); in ntfs_rl_punch_nolock()
1786 rl->lcn = LCN_HOLE; in ntfs_rl_punch_nolock()
1787 rl->length = length; in ntfs_rl_punch_nolock()
1788 rl++; in ntfs_rl_punch_nolock()
1789 rl->vcn += length; in ntfs_rl_punch_nolock()
1791 if (rl->lcn >= 0 || lcn_fixup) in ntfs_rl_punch_nolock()
1792 rl->lcn += length; in ntfs_rl_punch_nolock()
1793 rl->length -= length; in ntfs_rl_punch_nolock()
1807 rl->length = start - rl->vcn; in ntfs_rl_punch_nolock()
1808 rl++; in ntfs_rl_punch_nolock()
1810 if (rl < rl_end) in ntfs_rl_punch_nolock()
1811 memmove(rl, rl_end, (rl_real_end - rl_end + 1) * in ntfs_rl_punch_nolock()
1812 sizeof(*rl)); in ntfs_rl_punch_nolock()
1814 rl->vcn = start; in ntfs_rl_punch_nolock()
1815 rl->length = rl[1].vcn - start; in ntfs_rl_punch_nolock()
1829 if (end >= rl[1].vcn) { in ntfs_rl_punch_nolock()
1834 if (rl[1].length && end >= rl[2].vcn) { in ntfs_rl_punch_nolock()
1836 rl->length = start - rl->vcn; in ntfs_rl_punch_nolock()
1837 rl++; in ntfs_rl_punch_nolock()
1838 rl->vcn = start; in ntfs_rl_punch_nolock()
1839 rl->lcn = LCN_HOLE; in ntfs_rl_punch_nolock()
1842 trl = ntfs_rl_realloc(runlist->rl, old_size, old_size + 1); in ntfs_rl_punch_nolock()
1846 if (runlist->rl != trl) { in ntfs_rl_punch_nolock()
1847 rl = trl + (rl - runlist->rl); in ntfs_rl_punch_nolock()
1848 rl_end = trl + (rl_end - runlist->rl); in ntfs_rl_punch_nolock()
1849 rl_real_end = trl + (rl_real_end - runlist->rl); in ntfs_rl_punch_nolock()
1850 runlist->rl = trl; in ntfs_rl_punch_nolock()
1853 rl->length = start - rl->vcn; in ntfs_rl_punch_nolock()
1854 rl++; in ntfs_rl_punch_nolock()
1860 delta = rl->vcn - start; in ntfs_rl_punch_nolock()
1861 rl->vcn = start; in ntfs_rl_punch_nolock()
1862 if (rl->lcn >= 0) { in ntfs_rl_punch_nolock()
1863 rl->lcn -= delta; in ntfs_rl_punch_nolock()
1867 rl->length += delta; in ntfs_rl_punch_nolock()
1877 trl = ntfs_rl_realloc(runlist->rl, old_size, old_size + 2); in ntfs_rl_punch_nolock()
1881 if (runlist->rl != trl) { in ntfs_rl_punch_nolock()
1882 rl = trl + (rl - runlist->rl); in ntfs_rl_punch_nolock()
1883 rl_end = trl + (rl_end - runlist->rl); in ntfs_rl_punch_nolock()
1884 rl_real_end = trl + (rl_real_end - runlist->rl); in ntfs_rl_punch_nolock()
1885 runlist->rl = trl; in ntfs_rl_punch_nolock()
1888 memmove(rl + 2, rl, (rl_real_end - rl + 1) * sizeof(*rl)); in ntfs_rl_punch_nolock()
1890 rl->length = start - rl->vcn; in ntfs_rl_punch_nolock()
1891 rl++; in ntfs_rl_punch_nolock()
1892 rl->vcn = start; in ntfs_rl_punch_nolock()
1893 rl->lcn = LCN_HOLE; in ntfs_rl_punch_nolock()
1894 rl->length = length; in ntfs_rl_punch_nolock()
1895 rl++; in ntfs_rl_punch_nolock()
1896 delta = end - rl->vcn; in ntfs_rl_punch_nolock()
1897 rl->vcn = end; in ntfs_rl_punch_nolock()
1898 rl->lcn += delta; in ntfs_rl_punch_nolock()
1899 rl->length -= delta; in ntfs_rl_punch_nolock()