Lines Matching defs:vcn
151 if ((dst->vcn + dst->length) != src->vcn)
238 dst[loc].length = dst[loc + 1].vcn - dst[loc].vcn;
242 dst[marker].vcn = dst[marker - 1].vcn + dst[marker - 1].length;
286 disc = (src[0].vcn > 0);
296 disc = (src[0].vcn > dst[loc - 1].vcn + merged_length);
325 dst[marker].vcn = dst[marker - 1].vcn + dst[marker - 1].length;
328 dst[marker].length = dst[marker + 1].vcn - dst[marker].vcn;
333 dst[loc].vcn = dst[loc - 1].vcn + dst[loc - 1].length;
334 dst[loc].length = dst[loc + 1].vcn - dst[loc].vcn;
336 dst[loc].vcn = 0;
337 dst[loc].length = dst[loc + 1].vcn;
428 dst[marker].vcn = dst[marker - 1].vcn + dst[marker - 1].length;
476 dst[loc].length = dst[loc+1].vcn - dst[loc].vcn;
477 dst[loc+ssize+1].vcn = dst[loc+ssize].vcn + dst[loc+ssize].length;
478 dst[loc+ssize+1].length = dst[loc+ssize+2].vcn - dst[loc+ssize+1].vcn;
546 if (unlikely(drl[0].vcn)) {
556 drl[0].vcn = 0;
558 drl[0].length = drl[1].vcn;
581 if (drl[di].vcn + drl[di].length > srl[sstart].vcn)
587 if ((drl[di].vcn == srl[si].vcn) && (drl[di].lcn >= 0) &&
600 marker_vcn = srl[marker = send].vcn;
615 (drl[dins].vcn == srl[sstart].vcn)); /* Start of hole */
617 ((drl[dins].vcn + drl[dins].length) <= /* End of hole */
618 (srl[send - 1].vcn + srl[send - 1].length)));
623 if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn))
652 if (drl[ds].vcn <= marker_vcn) {
655 if (drl[ds].vcn == marker_vcn) {
680 /* Need to set vcn if it isn't set already. */
682 drl[ds].vcn = drl[ds - 1].vcn +
688 drl[ds].length = marker_vcn - drl[ds].vcn;
693 drl[ds].vcn = marker_vcn;
738 VCN vcn; /* Current vcn. */
757 /* Start at vcn = lowest_vcn and lcn 0. */
758 vcn = sle64_to_cpu(attr->data.non_resident.lowest_vcn);
769 if (!vcn && !*buf)
778 if (vcn) {
779 rl->vcn = 0;
781 rl->length = vcn;
803 /* Enter the current vcn into the current runlist element. */
804 rl[rlpos].vcn = vcn;
806 * Get the change in vcn, i.e. the run length in clusters.
837 /* Increment the current vcn by the current run length. */
838 vcn += deltaxcn;
889 * vcn in the runlist - 1, or something has gone badly wrong.
892 if (unlikely(deltaxcn && vcn - 1 != deltaxcn)) {
924 rl[rlpos].vcn = vcn;
925 vcn += rl[rlpos].length = max_cluster -
944 rl[rlpos].vcn = vcn;
967 * ntfs_rl_vcn_to_lcn - convert a vcn into a lcn given a runlist
969 * @vcn: vcn to convert
971 * Convert the virtual cluster number @vcn of an attribute into a logical
984 * LCN_ENOENT There is no such vcn in the attribute.
990 LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn)
994 BUG_ON(vcn < 0);
1003 /* Catch out of lower bounds vcn. */
1004 if (unlikely(vcn < rl[0].vcn))
1008 if (unlikely(vcn < rl[i+1].vcn)) {
1010 return rl[i].lcn + (vcn - rl[i].vcn);
1027 * ntfs_rl_find_vcn_nolock - find a vcn in a runlist
1029 * @vcn: vcn to find
1031 * Find the virtual cluster number @vcn in the runlist @rl and return the
1032 * address of the runlist element containing the @vcn on success.
1034 * Return NULL if @rl is NULL or @vcn is in an unmapped part/out of bounds of
1039 runlist_element *ntfs_rl_find_vcn_nolock(runlist_element *rl, const VCN vcn)
1041 BUG_ON(vcn < 0);
1042 if (unlikely(!rl || vcn < rl[0].vcn))
1045 if (unlikely(vcn < rl[1].vcn)) {
1092 * @first_vcn: first vcn which to include in the mapping pairs array
1093 * @last_vcn: last vcn which to include in the mapping pairs array
1096 * pairs array corresponding to the runlist @rl, starting at vcn @first_vcn and
1097 * finishing with vcn @last_vcn.
1100 * mapping pairs array corresponding to the runlist starting at vcn @first_vcn
1134 while (rl->length && first_vcn >= rl[1].vcn)
1136 if (unlikely((!rl->length && first_vcn > rl->vcn) ||
1137 first_vcn < rl->vcn))
1143 if (first_vcn > rl->vcn) {
1153 if (unlikely(last_vcn >= 0 && rl[1].vcn > last_vcn)) {
1155 if (unlikely(rl[1].vcn > s1))
1156 length = s1 - rl->vcn;
1159 delta = first_vcn - rl->vcn;
1189 if (unlikely(last_vcn >= 0 && rl[1].vcn > last_vcn)) {
1191 if (unlikely(rl[1].vcn > s1))
1192 length = s1 - rl->vcn;
1277 * @first_vcn: first vcn which to include in the mapping pairs array
1278 * @last_vcn: last vcn which to include in the mapping pairs array
1279 * @stop_vcn: first vcn outside destination buffer on success or -ENOSPC
1281 * Create the mapping pairs array from the locked runlist @rl, starting at vcn
1282 * @first_vcn and finishing with vcn @last_vcn and save the array in @dst.
1287 * array corresponding to the runlist starting at vcn @first_vcn and finishing
1293 * the first vcn outside the destination buffer. Note that on error, @dst has
1333 while (rl->length && first_vcn >= rl[1].vcn)
1335 if (unlikely((!rl->length && first_vcn > rl->vcn) ||
1336 first_vcn < rl->vcn))
1345 if (first_vcn > rl->vcn) {
1355 if (unlikely(last_vcn >= 0 && rl[1].vcn > last_vcn)) {
1357 if (unlikely(rl[1].vcn > s1))
1358 length = s1 - rl->vcn;
1361 delta = first_vcn - rl->vcn;
1407 if (unlikely(last_vcn >= 0 && rl[1].vcn > last_vcn)) {
1409 if (unlikely(rl[1].vcn > s1))
1410 length = s1 - rl->vcn;
1447 /* Set stop vcn. */
1449 *stop_vcn = rl->vcn;
1462 * ntfs_rl_truncate_nolock - truncate a runlist starting at a specified vcn
1514 rl[1].length = rl->vcn = 0;
1516 rl[1].vcn = rl->length = new_length;
1520 BUG_ON(new_length < rl->vcn);
1522 while (likely(rl->length && new_length >= rl[1].vcn))
1539 rl->length = new_length - rl->vcn;
1549 rl->vcn = new_length;
1566 } else if (likely(/* !rl->length && */ new_length > rl->vcn)) {
1574 (rl - 1)->length = new_length - (rl - 1)->vcn;
1594 rl->length = new_length - rl->vcn;
1599 rl->vcn = new_length;
1601 } else /* if (unlikely(!rl->length && new_length == rl->vcn)) */ {
1652 while (likely(rl->length && start >= rl[1].vcn))
1656 while (likely(rl_end->length && end >= rl_end[1].vcn)) {
1666 if (!rl_end->length && end > rl_end->vcn)
1683 if (end <= rl[1].vcn) {
1689 rl->length = end - rl->vcn;
1693 rl->length = rl_end->vcn - rl->vcn;
1702 if (end > rl->vcn) {
1703 delta = end - rl->vcn;
1704 rl->vcn = end;
1731 if (start == rl->vcn) {
1747 if (end >= rl[1].vcn) {
1775 rl->vcn += length;
1793 rl->length = start - rl->vcn;
1800 rl->vcn = start;
1801 rl->length = rl[1].vcn - start;
1815 if (end >= rl[1].vcn) {
1820 if (rl[1].length && end >= rl[2].vcn) {
1822 rl->length = start - rl->vcn;
1824 rl->vcn = start;
1839 rl->length = start - rl->vcn;
1846 delta = rl->vcn - start;
1847 rl->vcn = start;
1876 rl->length = start - rl->vcn;
1878 rl->vcn = start;
1882 delta = end - rl->vcn;
1883 rl->vcn = end;