- ctx->open_attrs[ctx->num_open_attrs++] = attr;
- ntfs_attr_truncate_solid(attr, blob->size);
+
+ /*
+ * Note: there are problems with trying to combine compression with
+ * sparseness when extracting. For example, doing ntfs_attr_truncate()
+ * at the end to extend the attribute to its final size actually extends
+ * to a compression block size boundary rather than to the requested
+ * size. Until these problems are solved, we always write the full data
+ * to compressed attributes. We also don't attempt to preallocate space
+ * for compressed attributes, since we don't know how much space they
+ * are going to actually need.
+ */
+ ctx->is_sparse_attr[ctx->num_open_attrs] = false;
+ if (!(na->data_flags & ATTR_COMPRESSION_MASK)) {
+ if (inode->i_attributes & FILE_ATTRIBUTE_SPARSE_FILE) {
+ ctx->is_sparse_attr[ctx->num_open_attrs] = true;
+ ctx->any_sparse_attrs = true;
+ } else {
+ ntfs_attr_truncate_solid(na, blob->size);
+ }
+ }
+ ctx->open_attrs[ctx->num_open_attrs++] = na;