Lines Matching refs:runlist

3  * NTFS runlist handling code.
24 * ntfs_rl_mm - runlist memmove
25 * @base: base runlist array
30 * It is up to the caller to serialize access to the runlist @base.
39 * ntfs_rl_mc - runlist memory copy
40 * @dstbase: destination runlist array
42 * @srcbase: source runlist array
58 * @rl: original runlist
59 * @old_size: number of runlist elements in the original runlist @rl
60 * @new_size: number of runlist elements we need space for
66 * It is up to the caller to serialize access to the runlist @rl.
99 * @rl: original runlist
100 * @old_size: number of runlist elements in the original runlist @rl
101 * @new_size: number of runlist elements we need space for
110 * It is up to the caller to serialize access to the runlist @rl.
140 * @dst: original runlist
141 * @src: new runlist to test for mergeability with @dst
176 * @dst: original, destination runlist
177 * @src: new runlist to merge with @dst
179 * Merge the two runlists, writing into the destination runlist @dst. The
181 * destination runlist.
191 * ntfs_rl_append - append a runlist after a given element
192 * @dst: destination runlist to append to
194 * @src: source runlist to append from
199 * Append the runlist @src after element @loc in @dst. Merge the right end of
200 * the new runlist, if necessary. Adjust the size of the hole before the
201 * appended runlist.
205 * On success, return a pointer to the new, combined, runlist. Note, both
207 * the pointers for anything any more. (Strictly speaking the returned runlist
256 * ntfs_rl_insert - insert a runlist into another
257 * @dst: destination runlist to insert into
259 * @src: source runlist to insert from
264 * Insert the runlist @src before element @loc in the runlist @dst. Merge the
265 * left end of the new runlist, if necessary. Adjust the size of the hole
266 * after the inserted runlist.
270 * On success, return a pointer to the new, combined, runlist. Note, both
272 * the pointers for anything any more. (Strictly speaking the returned runlist
313 * original runlist.
352 * ntfs_rl_replace - overwrite a runlist element with another runlist
353 * @dst: destination runlist to replace in
355 * @src: source runlist to replace with
360 * Replace the runlist element @dst at @loc with @src. Merge the left and
361 * right ends of the inserted runlist, if necessary.
365 * On success, return a pointer to the new, combined, runlist. Note, both
367 * the pointers for anything any more. (Strictly speaking the returned runlist
438 * ntfs_rl_split - insert a runlist into the centre of a hole
439 * @dst: destination runlist with a hole
441 * @src: source runlist to insert
446 * Split the runlist @dst at @loc into two and insert @new in between the two
452 * On success, return a pointer to the new, combined, runlist. Note, both
454 * the pointers for anything any more. (Strictly speaking the returned runlist
488 * @d_runlist: destination runlist structure to merge into
489 * @srl: source runlist to merge from
491 * @new_rl_count: on success, set to the new combined runlist size
494 * are sensible and can be merged. The runlist @srl must be either after the
495 * runlist @drl or completely within a hole (or unmapped region) in @drl.
508 * It can also be appended to the end of the runlist, which is just a variant
511 * On success, return a pointer to the new, combined, runlist. Note, both
513 * the pointers for anything any more. (Strictly speaking the returned runlist
518 struct runlist_element *ntfs_runlists_merge(struct runlist *d_runlist,
553 /* Complete the source runlist if necessary. */
555 /* Scan to the end of the source runlist. */
559 /* Insert start element at the front of the runlist. */
576 /* Skip any unmapped start element(s) in the source runlist. */
580 /* Can't have an entirely unmapped source runlist. */
667 * We need to create an unmapped runlist element in
676 /* Add an unmapped runlist element. */
708 ntfs_debug("Merged runlist:");
714 * ntfs_mapping_pairs_decompress - convert mapping pairs array to runlist
717 * @old_runlist: optional runlist to merge the decompressed runlist into
718 * @new_rl_count: on success, set to the new runlist size
720 * It is up to the caller to serialize access to the runlist @old_rl.
722 * Decompress the attribute @attr's mapping pairs array into a runlist. On
723 * success, return the decompressed runlist.
725 * If @old_rl is not NULL, decompressed runlist is inserted into the
726 * appropriate place in @old_rl and the resultant, combined runlist is
732 const struct attr_record *attr, struct runlist *old_runlist,
738 struct runlist_element *rl, *new_rl; /* The output runlist. */
741 int rlsize; /* Size of runlist buffer. */
742 u16 rlpos; /* Current runlist position in units of struct runlist_elements. */
771 /* Current position in runlist array. */
773 /* Allocate first page and set current runlist size to one page. */
803 /* Enter the current vcn into the current runlist element. */
831 * Enter the current run length into the current runlist
897 /* Enter the current lcn into the runlist element. */
900 /* Get to the next runlist element, skipping zero-sized holes */
910 * vcn in the runlist - 1, or something has gone badly wrong.
918 /* Setup not mapped runlist element if this is the base extent. */
927 * attribute so simply terminate the runlist with LCN_ENOENT).
932 * the highest cluster, the runlist is either corrupt
955 /* Setup terminating runlist element. */
958 /* If no existing runlist was specified, we are done. */
980 * ntfs_rl_vcn_to_lcn - convert a vcn into a lcn given a runlist
981 * @rl: runlist to use for conversion
985 * cluster number (lcn) of a device using the runlist @rl to map vcns to their
988 * It is up to the caller to serialize access to the runlist @rl.
995 * LCN_RL_NOT_MAPPED This is part of the runlist which has not been
996 * inserted into the runlist yet.
999 * Locking: - The caller must have locked the runlist (for reading or writing).
1001 * runlist.
1008 * If rl is NULL, assume that we have found an unmapped runlist. The
1037 * ntfs_rl_find_vcn_nolock - find a vcn in a runlist
1038 * @rl: runlist to search
1041 * Find the virtual cluster number @vcn in the runlist @rl and return the
1042 * address of the runlist element containing the @vcn on success.
1045 * the runlist.
1047 * Locking: The runlist must be locked on entry.
1100 * @rl: runlist to calculate the mapping pairs array size for
1105 * Walk the locked runlist @rl and calculate the size in bytes of the mapping
1106 * pairs array corresponding to the runlist @rl, starting at vcn @first_vcn and
1109 * A @last_vcn of -1 means end of runlist and in that case the size of the
1110 * mapping pairs array corresponding to the runlist starting at vcn @first_vcn
1111 * and finishing at the end of the runlist is determined.
1141 /* Skip to runlist element containing @first_vcn. */
1185 /* Go to next runlist element. */
1244 * This is used when building the mapping pairs array of a runlist to compress
1285 * ntfs_mapping_pairs_build - build the mapping pairs array from a runlist
1289 * @rl: runlist to build the mapping pairs array from
1293 * @stop_rl: on return, set to the runlist element where encoding stopped
1296 * Create the mapping pairs array from the locked runlist @rl, starting at vcn
1301 * A @last_vcn of -1 means end of runlist and in that case the mapping pairs
1302 * array corresponding to the runlist starting at vcn @first_vcn and finishing
1303 * at the end of the runlist is created.
1318 * -EIO - The runlist is corrupt.
1349 /* Skip to runlist element containing @first_vcn. */
1409 /* Go to next runlist element. */
1482 * ntfs_rl_truncate_nolock - truncate a runlist starting at a specified vcn
1484 * @runlist: runlist to truncate
1485 * @new_length: the new length of the runlist in VCNs
1487 * Truncate the runlist described by @runlist as well as the memory buffer
1488 * holding the runlist elements to a length of @new_length VCNs.
1490 * If @new_length lies within the runlist, the runlist elements with VCNs of
1492 * zero, the runlist is discarded and set to NULL.
1494 * If @new_length lies beyond the runlist, a sparse runlist element is added to
1495 * the end of the runlist @runlist or if the last runlist element is a sparse
1498 * Note, no checking is done for unmapped runlist elements. It is assumed that
1503 * Locking: The caller must hold @runlist->lock for writing.
1505 int ntfs_rl_truncate_nolock(const struct ntfs_volume *vol, struct runlist *const runlist,
1513 if (!runlist || new_length < 0)
1516 rl = runlist->rl;
1520 /* Find @new_length in the runlist. */
1524 * If not at the end of the runlist we need to shrink it.
1525 * If at the end of the runlist we need to expand it.
1531 ntfs_debug("Shrinking runlist.");
1532 /* Determine the runlist size. */
1536 old_size = trl - runlist->rl + 1;
1540 * If a run was partially truncated, make the following runlist
1552 runlist->count = rl - runlist->rl + 1;
1555 int new_size = rl - runlist->rl + 1;
1557 rl = ntfs_rl_realloc(runlist->rl, old_size, new_size);
1560 "Failed to shrink runlist buffer. This just wastes a bit of memory temporarily so we ignore it and return success.");
1562 runlist->rl = rl;
1565 ntfs_debug("Expanding runlist.");
1567 * If there is a previous runlist element and it is a sparse
1568 * one, extend it. Otherwise need to add a new, sparse runlist
1571 if ((rl > runlist->rl) && ((rl - 1)->lcn == LCN_HOLE))
1574 /* Determine the runlist size. */
1575 old_size = rl - runlist->rl + 1;
1577 rl = ntfs_rl_realloc(runlist->rl, old_size,
1580 ntfs_error(vol->sb, "Failed to expand runlist buffer, aborting.");
1583 runlist->rl = rl;
1585 * Set @rl to the same runlist element in the new
1586 * runlist as before in the old runlist.
1589 /* Add a new, sparse runlist element. */
1592 /* Add a new terminator runlist element. */
1595 runlist->count = old_size + 1;
1608 * ntfs_rl_sparse - check whether runlist have sparse regions or not.
1609 * @rl: runlist to check
1623 pr_err("%s: bad runlist\n", __func__);
1634 * @rl: runlist to calculate for
1649 ntfs_error(vol->sb, "%s: bad runlist, rlc->lcn : %lld",