* bugfix ntfs_attr_truncate: determine what we need to do with attribute (expand or shrink) from
na->data_size not from na->initialized_size * revert code and comment update about highest in ntfs_non_resident_attr_{shrink,expand}, because I fixed that bug (Logical change 1.478)edge.strict_endians
parent
99517ab2b8
commit
a40f1c30b6
|
@ -3017,11 +3017,10 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize)
|
|||
/*
|
||||
* Reminder: It is ok for a->highest_vcn to be -1 for zero
|
||||
* length files.
|
||||
* FIXME: We may not update a->highest_vcn if it equal to 0.
|
||||
* But bug in runlist mapping code prevent us from doing so.
|
||||
* Find and remove this bug.
|
||||
* Reminder: We may not update a->highest_vcn if it equal to 0.
|
||||
*/
|
||||
a->highest_vcn = scpu_to_le64(first_free_vcn - 1);
|
||||
if (a->highest_vcn)
|
||||
a->highest_vcn = scpu_to_le64(first_free_vcn - 1);
|
||||
/* Get the size for the new mapping pairs array. */
|
||||
mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl);
|
||||
if (mp_size <= 0) {
|
||||
|
@ -3365,11 +3364,10 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
|
|||
na->allocated_size = first_free_vcn << vol->cluster_size_bits;
|
||||
a->allocated_size = scpu_to_le64(na->allocated_size);
|
||||
/*
|
||||
* FIXME: We may not update a->highest_vcn if it equal to 0.
|
||||
* But bug in runlist mapping code prevent us from doing so.
|
||||
* Find and remove this bug.
|
||||
* Reminder: We may not update a->highest_vcn if it equal to 0.
|
||||
*/
|
||||
a->highest_vcn = scpu_to_le64(first_free_vcn - 1);
|
||||
if (a->highest_vcn)
|
||||
a->highest_vcn = scpu_to_le64(first_free_vcn - 1);
|
||||
}
|
||||
/* Update the attribute record and the ntfs attribute structure. */
|
||||
na->data_size = newsize;
|
||||
|
@ -3460,7 +3458,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
|
|||
return -1;
|
||||
}
|
||||
if (NAttrNonResident(na)) {
|
||||
if (newsize > na->initialized_size)
|
||||
if (newsize > na->data_size)
|
||||
return ntfs_non_resident_attr_expand(na, newsize);
|
||||
else
|
||||
return ntfs_non_resident_attr_shrink(na, newsize);
|
||||
|
|
Loading…
Reference in New Issue