aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/runlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ntfs/runlist.c')
-rw-r--r--fs/ntfs/runlist.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/fs/ntfs/runlist.c b/fs/ntfs/runlist.c
index eb52b801512b..9afd72c7ad0d 100644
--- a/fs/ntfs/runlist.c
+++ b/fs/ntfs/runlist.c
@@ -149,10 +149,10 @@ static inline runlist_element *ntfs_rl_realloc_nofail(runlist_element *rl,
149 * 149 *
150 * It is up to the caller to serialize access to the runlists @dst and @src. 150 * It is up to the caller to serialize access to the runlists @dst and @src.
151 * 151 *
152 * Return: TRUE Success, the runlists can be merged. 152 * Return: true Success, the runlists can be merged.
153 * FALSE Failure, the runlists cannot be merged. 153 * false Failure, the runlists cannot be merged.
154 */ 154 */
155static inline BOOL ntfs_are_rl_mergeable(runlist_element *dst, 155static inline bool ntfs_are_rl_mergeable(runlist_element *dst,
156 runlist_element *src) 156 runlist_element *src)
157{ 157{
158 BUG_ON(!dst); 158 BUG_ON(!dst);
@@ -160,19 +160,19 @@ static inline BOOL ntfs_are_rl_mergeable(runlist_element *dst,
160 160
161 /* We can merge unmapped regions even if they are misaligned. */ 161 /* We can merge unmapped regions even if they are misaligned. */
162 if ((dst->lcn == LCN_RL_NOT_MAPPED) && (src->lcn == LCN_RL_NOT_MAPPED)) 162 if ((dst->lcn == LCN_RL_NOT_MAPPED) && (src->lcn == LCN_RL_NOT_MAPPED))
163 return TRUE; 163 return true;
164 /* If the runs are misaligned, we cannot merge them. */ 164 /* If the runs are misaligned, we cannot merge them. */
165 if ((dst->vcn + dst->length) != src->vcn) 165 if ((dst->vcn + dst->length) != src->vcn)
166 return FALSE; 166 return false;
167 /* If both runs are non-sparse and contiguous, we can merge them. */ 167 /* If both runs are non-sparse and contiguous, we can merge them. */
168 if ((dst->lcn >= 0) && (src->lcn >= 0) && 168 if ((dst->lcn >= 0) && (src->lcn >= 0) &&
169 ((dst->lcn + dst->length) == src->lcn)) 169 ((dst->lcn + dst->length) == src->lcn))
170 return TRUE; 170 return true;
171 /* If we are merging two holes, we can merge them. */ 171 /* If we are merging two holes, we can merge them. */
172 if ((dst->lcn == LCN_HOLE) && (src->lcn == LCN_HOLE)) 172 if ((dst->lcn == LCN_HOLE) && (src->lcn == LCN_HOLE))
173 return TRUE; 173 return true;
174 /* Cannot merge. */ 174 /* Cannot merge. */
175 return FALSE; 175 return false;
176} 176}
177 177
178/** 178/**
@@ -218,7 +218,7 @@ static inline void __ntfs_rl_merge(runlist_element *dst, runlist_element *src)
218static inline runlist_element *ntfs_rl_append(runlist_element *dst, 218static inline runlist_element *ntfs_rl_append(runlist_element *dst,
219 int dsize, runlist_element *src, int ssize, int loc) 219 int dsize, runlist_element *src, int ssize, int loc)
220{ 220{
221 BOOL right = FALSE; /* Right end of @src needs merging. */ 221 bool right = false; /* Right end of @src needs merging. */
222 int marker; /* End of the inserted runs. */ 222 int marker; /* End of the inserted runs. */
223 223
224 BUG_ON(!dst); 224 BUG_ON(!dst);
@@ -285,8 +285,8 @@ static inline runlist_element *ntfs_rl_append(runlist_element *dst,
285static inline runlist_element *ntfs_rl_insert(runlist_element *dst, 285static inline runlist_element *ntfs_rl_insert(runlist_element *dst,
286 int dsize, runlist_element *src, int ssize, int loc) 286 int dsize, runlist_element *src, int ssize, int loc)
287{ 287{
288 BOOL left = FALSE; /* Left end of @src needs merging. */ 288 bool left = false; /* Left end of @src needs merging. */
289 BOOL disc = FALSE; /* Discontinuity between @dst and @src. */ 289 bool disc = false; /* Discontinuity between @dst and @src. */
290 int marker; /* End of the inserted runs. */ 290 int marker; /* End of the inserted runs. */
291 291
292 BUG_ON(!dst); 292 BUG_ON(!dst);
@@ -382,8 +382,8 @@ static inline runlist_element *ntfs_rl_replace(runlist_element *dst,
382 int dsize, runlist_element *src, int ssize, int loc) 382 int dsize, runlist_element *src, int ssize, int loc)
383{ 383{
384 signed delta; 384 signed delta;
385 BOOL left = FALSE; /* Left end of @src needs merging. */ 385 bool left = false; /* Left end of @src needs merging. */
386 BOOL right = FALSE; /* Right end of @src needs merging. */ 386 bool right = false; /* Right end of @src needs merging. */
387 int tail; /* Start of tail of @dst. */ 387 int tail; /* Start of tail of @dst. */
388 int marker; /* End of the inserted runs. */ 388 int marker; /* End of the inserted runs. */
389 389
@@ -620,8 +620,8 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl,
620 ; 620 ;
621 621
622 { 622 {
623 BOOL start; 623 bool start;
624 BOOL finish; 624 bool finish;
625 int ds = dend + 1; /* Number of elements in drl & srl */ 625 int ds = dend + 1; /* Number of elements in drl & srl */
626 int ss = sfinal - sstart + 1; 626 int ss = sfinal - sstart + 1;
627 627
@@ -635,7 +635,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl,
635 if (finish && !drl[dins].length) 635 if (finish && !drl[dins].length)
636 ss++; 636 ss++;
637 if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn)) 637 if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn))
638 finish = FALSE; 638 finish = false;
639#if 0 639#if 0
640 ntfs_debug("dfinal = %i, dend = %i", dfinal, dend); 640 ntfs_debug("dfinal = %i, dend = %i", dfinal, dend);
641 ntfs_debug("sstart = %i, sfinal = %i, send = %i", sstart, sfinal, send); 641 ntfs_debug("sstart = %i, sfinal = %i, send = %i", sstart, sfinal, send);
@@ -1134,7 +1134,7 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol,
1134{ 1134{
1135 LCN prev_lcn; 1135 LCN prev_lcn;
1136 int rls; 1136 int rls;
1137 BOOL the_end = FALSE; 1137 bool the_end = false;
1138 1138
1139 BUG_ON(first_vcn < 0); 1139 BUG_ON(first_vcn < 0);
1140 BUG_ON(last_vcn < -1); 1140 BUG_ON(last_vcn < -1);
@@ -1168,7 +1168,7 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol,
1168 s64 s1 = last_vcn + 1; 1168 s64 s1 = last_vcn + 1;
1169 if (unlikely(rl[1].vcn > s1)) 1169 if (unlikely(rl[1].vcn > s1))
1170 length = s1 - rl->vcn; 1170 length = s1 - rl->vcn;
1171 the_end = TRUE; 1171 the_end = true;
1172 } 1172 }
1173 delta = first_vcn - rl->vcn; 1173 delta = first_vcn - rl->vcn;
1174 /* Header byte + length. */ 1174 /* Header byte + length. */
@@ -1204,7 +1204,7 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol,
1204 s64 s1 = last_vcn + 1; 1204 s64 s1 = last_vcn + 1;
1205 if (unlikely(rl[1].vcn > s1)) 1205 if (unlikely(rl[1].vcn > s1))
1206 length = s1 - rl->vcn; 1206 length = s1 - rl->vcn;
1207 the_end = TRUE; 1207 the_end = true;
1208 } 1208 }
1209 /* Header byte + length. */ 1209 /* Header byte + length. */
1210 rls += 1 + ntfs_get_nr_significant_bytes(length); 1210 rls += 1 + ntfs_get_nr_significant_bytes(length);
@@ -1327,7 +1327,7 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst,
1327 LCN prev_lcn; 1327 LCN prev_lcn;
1328 s8 *dst_max, *dst_next; 1328 s8 *dst_max, *dst_next;
1329 int err = -ENOSPC; 1329 int err = -ENOSPC;
1330 BOOL the_end = FALSE; 1330 bool the_end = false;
1331 s8 len_len, lcn_len; 1331 s8 len_len, lcn_len;
1332 1332
1333 BUG_ON(first_vcn < 0); 1333 BUG_ON(first_vcn < 0);
@@ -1370,7 +1370,7 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst,
1370 s64 s1 = last_vcn + 1; 1370 s64 s1 = last_vcn + 1;
1371 if (unlikely(rl[1].vcn > s1)) 1371 if (unlikely(rl[1].vcn > s1))
1372 length = s1 - rl->vcn; 1372 length = s1 - rl->vcn;
1373 the_end = TRUE; 1373 the_end = true;
1374 } 1374 }
1375 delta = first_vcn - rl->vcn; 1375 delta = first_vcn - rl->vcn;
1376 /* Write length. */ 1376 /* Write length. */
@@ -1422,7 +1422,7 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst,
1422 s64 s1 = last_vcn + 1; 1422 s64 s1 = last_vcn + 1;
1423 if (unlikely(rl[1].vcn > s1)) 1423 if (unlikely(rl[1].vcn > s1))
1424 length = s1 - rl->vcn; 1424 length = s1 - rl->vcn;
1425 the_end = TRUE; 1425 the_end = true;
1426 } 1426 }
1427 /* Write length. */ 1427 /* Write length. */
1428 len_len = ntfs_write_significant_bytes(dst + 1, dst_max, 1428 len_len = ntfs_write_significant_bytes(dst + 1, dst_max,
@@ -1541,7 +1541,7 @@ int ntfs_rl_truncate_nolock(const ntfs_volume *vol, runlist *const runlist,
1541 */ 1541 */
1542 if (rl->length) { 1542 if (rl->length) {
1543 runlist_element *trl; 1543 runlist_element *trl;
1544 BOOL is_end; 1544 bool is_end;
1545 1545
1546 ntfs_debug("Shrinking runlist."); 1546 ntfs_debug("Shrinking runlist.");
1547 /* Determine the runlist size. */ 1547 /* Determine the runlist size. */
@@ -1555,11 +1555,11 @@ int ntfs_rl_truncate_nolock(const ntfs_volume *vol, runlist *const runlist,
1555 * If a run was partially truncated, make the following runlist 1555 * If a run was partially truncated, make the following runlist
1556 * element a terminator. 1556 * element a terminator.
1557 */ 1557 */
1558 is_end = FALSE; 1558 is_end = false;
1559 if (rl->length) { 1559 if (rl->length) {
1560 rl++; 1560 rl++;
1561 if (!rl->length) 1561 if (!rl->length)
1562 is_end = TRUE; 1562 is_end = true;
1563 rl->vcn = new_length; 1563 rl->vcn = new_length;
1564 rl->length = 0; 1564 rl->length = 0;
1565 } 1565 }
@@ -1648,7 +1648,7 @@ int ntfs_rl_punch_nolock(const ntfs_volume *vol, runlist *const runlist,
1648 s64 delta; 1648 s64 delta;
1649 runlist_element *rl, *rl_end, *rl_real_end, *trl; 1649 runlist_element *rl, *rl_end, *rl_real_end, *trl;
1650 int old_size; 1650 int old_size;
1651 BOOL lcn_fixup = FALSE; 1651 bool lcn_fixup = false;
1652 1652
1653 ntfs_debug("Entering for start 0x%llx, length 0x%llx.", 1653 ntfs_debug("Entering for start 0x%llx, length 0x%llx.",
1654 (long long)start, (long long)length); 1654 (long long)start, (long long)length);
@@ -1862,7 +1862,7 @@ split_end:
1862 if (rl->lcn >= 0) { 1862 if (rl->lcn >= 0) {
1863 rl->lcn -= delta; 1863 rl->lcn -= delta;
1864 /* Need this in case the lcn just became negative. */ 1864 /* Need this in case the lcn just became negative. */
1865 lcn_fixup = TRUE; 1865 lcn_fixup = true;
1866 } 1866 }
1867 rl->length += delta; 1867 rl->length += delta;
1868 goto split_end; 1868 goto split_end;