Lines Matching refs:drl

485  * @drl:	original runlist to be worked on
486 * @srl: new runlist to be merged into @drl
488 * First we sanity check the two runlists @srl and @drl to make sure that they
490 * runlist @drl or completely within a hole (or unmapped region) in @drl.
492 * It is up to the caller to serialize access to the runlists @drl and @srl.
507 * runlists @drl and @srl are deallocated before returning so you cannot use
517 runlist_element *ntfs_runlists_merge(runlist_element *drl,
522 int dins; /* Index into @drl at which to insert @srl. */
531 ntfs_debug_dump_runlist(drl);
538 return drl;
539 if (IS_ERR(srl) || IS_ERR(drl))
543 if (unlikely(!drl)) {
544 drl = srl;
546 if (unlikely(drl[0].vcn)) {
548 for (dend = 0; likely(drl[dend].length); dend++)
551 drl = ntfs_rl_realloc(drl, dend, dend + 1);
552 if (IS_ERR(drl))
553 return drl;
555 ntfs_rl_mm(drl, 1, 0, dend);
556 drl[0].vcn = 0;
557 drl[0].lcn = LCN_RL_NOT_MAPPED;
558 drl[0].length = drl[1].vcn;
576 * Skip forward in @drl until we reach the position where @srl needs to
577 * be inserted. If we reach the end of @drl, @srl just needs to be
578 * appended to @drl.
580 for (; drl[di].length; di++) {
581 if (drl[di].vcn + drl[di].length > srl[sstart].vcn)
587 if ((drl[di].vcn == srl[si].vcn) && (drl[di].lcn >= 0) &&
596 for (dend = di; drl[dend].length; dend++)
605 for (dfinal = dend; dfinal >= 0 && drl[dfinal].lcn < LCN_HOLE; dfinal--)
611 int ds = dend + 1; /* Number of elements in drl & srl */
614 start = ((drl[dins].lcn < LCN_RL_NOT_MAPPED) || /* End of file */
615 (drl[dins].vcn == srl[sstart].vcn)); /* Start of hole */
616 finish = ((drl[dins].lcn >= LCN_RL_NOT_MAPPED) && /* End of file */
617 ((drl[dins].vcn + drl[dins].length) <= /* End of hole */
621 if (finish && !drl[dins].length)
623 if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn))
633 drl = ntfs_rl_replace(drl, ds, srl + sstart, ss, dins);
635 drl = ntfs_rl_insert(drl, ds, srl + sstart, ss, dins);
638 drl = ntfs_rl_append(drl, ds, srl + sstart, ss, dins);
640 drl = ntfs_rl_split(drl, ds, srl + sstart, ss, dins);
642 if (IS_ERR(drl)) {
644 return drl;
649 for (ds = dend; drl[ds].length; ds++)
651 /* We only need to care if @srl ended after @drl. */
652 if (drl[ds].vcn <= marker_vcn) {
655 if (drl[ds].vcn == marker_vcn) {
659 drl[ds].lcn);
660 drl[ds].lcn = LCN_ENOENT;
665 * @drl or extend an existing one before adding the
668 if (drl[ds].lcn == LCN_ENOENT) {
672 if (drl[ds].lcn != LCN_RL_NOT_MAPPED) {
675 drl = ntfs_rl_realloc_nofail(drl, ds,
682 drl[ds].vcn = drl[ds - 1].vcn +
683 drl[ds - 1].length;
684 drl[ds].lcn = LCN_RL_NOT_MAPPED;
688 drl[ds].length = marker_vcn - drl[ds].vcn;
692 drl = ntfs_rl_realloc_nofail(drl, ds, ds + 1);
693 drl[ds].vcn = marker_vcn;
694 drl[ds].lcn = LCN_ENOENT;
695 drl[ds].length = (s64)0;
703 ntfs_debug_dump_runlist(drl);
704 return drl;