Fix ntfs_non_resident_attr_expand bug, that occured if we enlarge
sparse or compressed file, but do not need to allocate new clusters to perfrom this.edge.strict_endians
parent
1ce16eddb7
commit
73474b68db
|
@ -44,7 +44,10 @@ xx/xx/2005 - 1.12.2-WIP
|
|||
key after it is decrypted (this is ifdeffed out by default). (Anton)
|
||||
- fflush() ntfs_log_ streams. (Christophe)
|
||||
- Working with regular files needs no longer the --force option,
|
||||
except for mkntfs. (Szaka)
|
||||
except for mkntfs. (Szaka)
|
||||
- Fix ntfs_non_resident_attr_expand bug, that occured if we enlarge
|
||||
sparse or compressed file, but do not need to allocate new clusters to
|
||||
perfrom this. (Yura)
|
||||
|
||||
10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs.
|
||||
|
||||
|
|
|
@ -4619,8 +4619,10 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
|
|||
runlist *rl, *rln;
|
||||
int err;
|
||||
|
||||
ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", (unsigned long
|
||||
long)na->ni->mft_no, na->type);
|
||||
ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, new size %lld, "
|
||||
"current size %lld.\n",
|
||||
(unsigned long long)na->ni->mft_no, na->type,
|
||||
(long long)newsize, (long long)na->data_size);
|
||||
|
||||
vol = na->ni->vol;
|
||||
|
||||
|
@ -4761,24 +4763,26 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
|
|||
}
|
||||
a = ctx->attr;
|
||||
|
||||
/* Update allocated size only if it is changed. */
|
||||
/* Update allocated and compressed size only if we changed runlist. */
|
||||
if ((na->allocated_size >> vol->cluster_size_bits) < first_free_vcn) {
|
||||
na->allocated_size = first_free_vcn << vol->cluster_size_bits;
|
||||
a->allocated_size = cpu_to_sle64(na->allocated_size);
|
||||
}
|
||||
|
||||
/* Update compressed_size if present. */
|
||||
if (NAttrSparse(na) || NAttrCompressed(na)) {
|
||||
s64 new_compr_size;
|
||||
/* Update compressed_size if present. */
|
||||
if (NAttrSparse(na) || NAttrCompressed(na)) {
|
||||
s64 new_compr_size;
|
||||
|
||||
new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl);
|
||||
if (new_compr_size == -1) {
|
||||
err = errno;
|
||||
ntfs_log_trace("BUG! Leaving inconstant metadata.\n");
|
||||
goto put_err_out;
|
||||
new_compr_size = ntfs_rl_get_compressed_size(vol,
|
||||
na->rl);
|
||||
if (new_compr_size == -1) {
|
||||
err = errno;
|
||||
ntfs_log_trace("BUG! Leaving inconstant "
|
||||
"metadata.\n");
|
||||
goto put_err_out;
|
||||
}
|
||||
na->compressed_size = new_compr_size;
|
||||
a->compressed_size = cpu_to_sle64(new_compr_size);
|
||||
}
|
||||
na->compressed_size = new_compr_size;
|
||||
a->compressed_size = cpu_to_sle64(new_compr_size);
|
||||
}
|
||||
|
||||
/* Update data size. */
|
||||
|
|
Loading…
Reference in New Issue