Changes by: cha0smaster
Update of /cvsroot/linux-ntfs/ntfsprogs/libntfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12158/libntfs
Modified Files:
attrib.c
Log Message:
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.
Index: attrib.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/attrib.c,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -p -r1.188 -r1.189
--- attrib.c 26 Oct 2005 22:54:57 -0000 1.188
+++ attrib.c 27 Oct 2005 21:20:30 -0000 1.189
@@ -4619,8 +4619,10 @@ static int ntfs_non_resident_attr_expand
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
}
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;
- 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;
+ /* 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;
+ }
+ 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. */
|