Lines Matching defs:drl
506 static runlist_element *ntfs_runlists_merge_i(runlist_element *drl,
511 int dins; /* Index into @drl at which to insert @srl. */
519 ntfs_debug_runlist_dump(drl);
525 return drl;
528 if (!drl) {
529 drl = srl;
531 if (drl[0].vcn) {
533 for (dend = 0; drl[dend].length; dend++)
536 drl = ntfs_rl_realloc(drl, dend, dend + 1);
537 if (!drl)
538 return drl;
540 ntfs_rl_mm(drl, 1, 0, dend);
541 drl[0].vcn = 0;
542 drl[0].lcn = LCN_RL_NOT_MAPPED;
543 drl[0].length = drl[1].vcn;
565 * Skip forward in @drl until we reach the position where @srl needs to
566 * be inserted. If we reach the end of @drl, @srl just needs to be
567 * appended to @drl.
569 for (; drl[di].length; di++) {
570 if (drl[di].vcn + drl[di].length > srl[sstart].vcn)
576 if ((drl[di].vcn == srl[si].vcn) && (drl[di].lcn >= 0) &&
586 for (dend = di; drl[dend].length; dend++)
595 for (dfinal = dend; dfinal >= 0 && drl[dfinal].lcn < LCN_HOLE; dfinal--)
601 int ds = dend + 1; /* Number of elements in drl & srl */
604 start = ((drl[dins].lcn < LCN_RL_NOT_MAPPED) || /* End of file */
605 (drl[dins].vcn == srl[sstart].vcn)); /* Start of hole */
606 finish = ((drl[dins].lcn >= LCN_RL_NOT_MAPPED) && /* End of file */
607 ((drl[dins].vcn + drl[dins].length) <= /* End of hole */
611 if (finish && !drl[dins].length)
613 if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn))
623 drl = ntfs_rl_replace(drl, ds, srl + sstart, ss, dins);
625 drl = ntfs_rl_insert(drl, ds, srl + sstart, ss, dins);
628 drl = ntfs_rl_append(drl, ds, srl + sstart, ss, dins);
630 drl = ntfs_rl_split(drl, ds, srl + sstart, ss, dins);
632 if (!drl) {
634 return drl;
639 for (ds = dend; drl[ds].length; ds++)
641 /* We only need to care if @srl ended after @drl. */
642 if (drl[ds].vcn <= marker_vcn) {
645 if (drl[ds].vcn == marker_vcn) {
648 (long long)drl[ds].lcn);
649 drl[ds].lcn = (LCN)LCN_ENOENT;
654 * @drl or extend an existing one before adding the
657 if (drl[ds].lcn == (LCN)LCN_ENOENT) {
661 if (drl[ds].lcn != (LCN)LCN_RL_NOT_MAPPED) {
667 drl = ntfs_rl_realloc(drl, ds, ds + 2);
668 if (!drl)
675 drl[ds].vcn = drl[ds - 1].vcn +
676 drl[ds - 1].length;
677 drl[ds].lcn = (LCN)LCN_RL_NOT_MAPPED;
681 drl[ds].length = marker_vcn - drl[ds].vcn;
688 drl = ntfs_rl_realloc(drl, ds, ds + 1);
689 if (!drl)
692 drl[ds].vcn = marker_vcn;
693 drl[ds].lcn = (LCN)LCN_ENOENT;
694 drl[ds].length = (s64)0;
702 ntfs_debug_runlist_dump(drl);
703 return drl;
710 return drl;
715 * @drl: original runlist to be worked on
716 * @srl: new runlist to be merged into @drl
718 * First we sanity check the two runlists @srl and @drl to make sure that they
720 * runlist @drl or completely within a hole (or unmapped region) in @drl.
735 * runlists @drl and @srl are deallocated before returning so you cannot use
745 runlist_element *ntfs_runlists_merge(runlist_element *drl,
751 rl = ntfs_runlists_merge_i(drl, srl);
1836 * @drl:
1843 static runlist_element * test_rl_runlists_merge(runlist_element *drl, runlist_element *srl)
1848 test_rl_dump_runlist(drl);
1852 res = ntfs_runlists_merge(drl, srl);