Lines Matching defs:vcn
605 * @vcn: map runlist part containing this vcn
607 * Map the part of a runlist containing the @vcn of the ntfs attribute @na.
611 int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn)
616 ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, vcn 0x%llx.\n",
617 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type), (long long)vcn);
619 lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn);
629 vcn, NULL, 0, ctx)) {
655 static int ntfs_attr_map_partial_runlist(ntfs_attr *na, VCN vcn)
674 /* Get the last vcn in the attribute. */
677 needed = vcn;
805 /* Get the last vcn in the attribute. */
810 /* Get the lowest vcn for the next extent. */
858 * ntfs_attr_vcn_to_lcn - convert a vcn into a lcn given an ntfs attribute
860 * @vcn: vcn to convert
862 * Convert the virtual cluster number @vcn of an attribute into a logical
866 * If the @vcn is not mapped yet, attempt to map the attribute extent
867 * containing the @vcn and retry the vcn to lcn conversion.
874 * -3 = LCN_ENOENT There is no such vcn in the attribute.
878 LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn)
883 if (!na || !NAttrNonResident(na) || vcn < 0)
889 /* Convert vcn to lcn. If that fails map the runlist and retry once. */
890 lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn);
893 if (!is_retry && !ntfs_attr_map_runlist(na, vcn)) {
909 * ntfs_attr_find_vcn - find a vcn in the runlist of an ntfs attribute
911 * @vcn: vcn to find
913 * Find the virtual cluster number @vcn in the runlist of the ntfs attribute
914 * @na and return the the address of the runlist element containing the @vcn.
924 * ENOENT There is no such vcn in the runlist.
928 runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn)
933 if (!na || !NAttrNonResident(na) || vcn < 0) {
938 ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, vcn %llx\n",
940 (long long)vcn);
945 if (vcn < rl[0].vcn)
948 if (vcn < rl[1].vcn) {
970 /* The @vcn is in an unmapped region, map the runlist and retry. */
971 if (!is_retry && !ntfs_attr_map_runlist(na, vcn)) {
1107 /* Find the runlist element containing the vcn. */
1111 * If the vcn is not present it is an out of bounds read.
1123 * a partial final vcn is taken care of by the @count capping of read
1126 ofs = pos - (rl->vcn << vol->cluster_size_bits);
1129 rl = ntfs_attr_find_vcn(na, rl->vcn);
1139 ofs = pos + total - (rl->vcn << vol->cluster_size_bits);
1167 ntfs_log_trace("Reading %lld bytes from vcn %lld, lcn %lld, ofs"
1168 " %lld.\n", (long long)to_read, (long long)rl->vcn,
1325 cur_vcn = (*rl)->vcn;
1326 from_vcn = (*rl)->vcn + (*ofs >> vol->cluster_size_bits);
1361 while (rlc->vcn) {
1373 lcn_seek_from = rlc->lcn + (from_vcn - rlc->vcn);
1383 lcn_seek_from = rlc->lcn - (rlc->vcn - from_vcn);
1392 + 1 + (*rl)->vcn - from_vcn;
1404 if ((from_vcn & -na->compression_block_clusters) <= (*rl)->vcn)
1405 alloc_vcn = (*rl)->vcn;
1481 if ((*rl)->vcn < cur_vcn) {
1486 *ofs += (cur_vcn - (*rl)->vcn) << vol->cluster_size_bits;
1488 if ((*rl)->vcn > cur_vcn) {
1492 *ofs -= ((*rl)->vcn - cur_vcn) << vol->cluster_size_bits;
1541 int beginwrite = (pos >> cluster_size_bits) - rl->vcn;
1543 | (na->compression_block_clusters - 1)) + 1 - rl->vcn;
1584 rl[1].vcn = rl[0].vcn + rl[0].length;
1585 rl[2].vcn = rl[1].vcn
1611 rl[1].vcn = rl[0].vcn + rl[0].length;
1618 rl[1].vcn = rl[0].vcn + rl[0].length;
1648 rl[2].vcn = rl[1].vcn;
1651 rl[1].vcn -= na->compression_block_clusters;
1655 if (pos >= (rl[1].vcn << cluster_size_bits)) {
1660 if ((*update_from == -1) || ((*prl)->vcn < *update_from))
1661 *update_from = (*prl)->vcn;
1693 endblock = (((pos + count - 1) >> cluster_size_bits) | (na->compression_block_clusters - 1)) + 1 - rl->vcn;
1795 zrl[1].vcn = zrl->vcn + zrl->length;
1810 while (zrl->vcn > (pos >> cluster_size_bits))
1820 if ((*update_from == -1) || ((*prl)->vcn < *update_from))
1821 *update_from = (*prl)->vcn;
2104 /* Find the runlist element containing the vcn. */
2108 * If the vcn is not present it is an out of bounds write.
2176 ofs = pos - (rl->vcn << vol->cluster_size_bits);
2179 * partial final vcn is taken care of by the @count capping of write
2184 rl = ntfs_attr_find_vcn(na, rl->vcn);
2194 ofs = pos + total - (rl->vcn << vol->cluster_size_bits);
2202 hole_end = rl->vcn + rl->length;
2226 ntfs_log_trace("Writing %lld bytes to vcn %lld, lcn %lld, ofs "
2227 "%lld.\n", (long long)to_write, (long long)rl->vcn,
2232 s64 wend = (rl->vcn << vol->cluster_size_bits) + ofs + to_write;
2484 /* Find the runlist element containing the terminal vcn. */
2488 * If the vcn is not present it is an out of bounds write.
2500 * partial final vcn is taken care of by the @count capping of write
2527 ofs = na->initialized_size - (rl->vcn << vol->cluster_size_bits);
2530 rl = ntfs_attr_find_vcn(na, rl->vcn);
2540 ofs = na->initialized_size - (rl->vcn << vol->cluster_size_bits);
2999 * @lowest_vcn: lowest vcn to find (optional, non-resident attributes only)
3614 * @lowest_vcn: lowest vcn to find (optional, non-resident attributes only)
4217 * @lowest_vcn: lowest vcn of the new attribute extent
4225 * EEXIST - Attribute of such type, with same lowest vcn and with same
6011 * @stop_vcn properly, i.e. to the lowest vcn of record that
6038 * extent as need to delete (by setting highest vcn to
6125 /* Update lowest vcn. */
6144 stop_vcn = stop_rl->vcn;
6268 stop_vcn = stop_rl->vcn;
6570 rl[0].vcn = (na->allocated_size >>
6575 rl[1].vcn = first_free_vcn;