aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/attrib.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ntfs/attrib.c')
-rw-r--r--fs/ntfs/attrib.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index a92b9e9db91d..7a568eb7d80f 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -1695,7 +1695,9 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size)
1695 a->data.non_resident.initialized_size = 1695 a->data.non_resident.initialized_size =
1696 cpu_to_sle64(attr_size); 1696 cpu_to_sle64(attr_size);
1697 if (NInoSparse(ni) || NInoCompressed(ni)) { 1697 if (NInoSparse(ni) || NInoCompressed(ni)) {
1698 a->data.non_resident.compression_unit = 4; 1698 a->data.non_resident.compression_unit = 0;
1699 if (NInoCompressed(ni) || vol->major_ver < 3)
1700 a->data.non_resident.compression_unit = 4;
1699 a->data.non_resident.compressed_size = 1701 a->data.non_resident.compressed_size =
1700 a->data.non_resident.allocated_size; 1702 a->data.non_resident.allocated_size;
1701 } else 1703 } else
@@ -1714,13 +1716,20 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size)
1714 ni->allocated_size = new_size; 1716 ni->allocated_size = new_size;
1715 if (NInoSparse(ni) || NInoCompressed(ni)) { 1717 if (NInoSparse(ni) || NInoCompressed(ni)) {
1716 ni->itype.compressed.size = ni->allocated_size; 1718 ni->itype.compressed.size = ni->allocated_size;
1717 ni->itype.compressed.block_size = 1U << 1719 if (a->data.non_resident.compression_unit) {
1718 (a->data.non_resident.compression_unit + 1720 ni->itype.compressed.block_size = 1U << (a->data.
1719 vol->cluster_size_bits); 1721 non_resident.compression_unit +
1720 ni->itype.compressed.block_size_bits = 1722 vol->cluster_size_bits);
1721 ffs(ni->itype.compressed.block_size) - 1; 1723 ni->itype.compressed.block_size_bits =
1722 ni->itype.compressed.block_clusters = 1U << 1724 ffs(ni->itype.compressed.block_size) -
1723 a->data.non_resident.compression_unit; 1725 1;
1726 ni->itype.compressed.block_clusters = 1U <<
1727 a->data.non_resident.compression_unit;
1728 } else {
1729 ni->itype.compressed.block_size = 0;
1730 ni->itype.compressed.block_size_bits = 0;
1731 ni->itype.compressed.block_clusters = 0;
1732 }
1724 vi->i_blocks = ni->itype.compressed.size >> 9; 1733 vi->i_blocks = ni->itype.compressed.size >> 9;
1725 } else 1734 } else
1726 vi->i_blocks = ni->allocated_size >> 9; 1735 vi->i_blocks = ni->allocated_size >> 9;