ntfs: accept standard sparse compression unit
Hyunchul Lee
maintainerPATCH 1/1 ntfs: accept standard sparse compression unit
Windows native sparse-file inspection shows that a non-resident $DATA attribute can be marked sparse and record the standard compression unit
(4) even when the file is not compressed.
Signed-off-by Hyunchul Lee <[email protected]>
--- fs/ntfs/inode.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/ntfs/inode.c +10 -3
@@ -1148,14 +1148,21 @@ static int ntfs_read_locked_inode(struct inode *vi) goto unm_err_out; } +/* +* Windows stores the standard compression unit in +* sparse attributes even when the data is not compressed. +*/ if (NInoSparse (ni) && a->data.non_resident.compression_unit && a->data.non_resident.compression_unit != - vol->sparse_compression_unit) { + vol->sparse_compression_unit && + a->data.non_resident.compression_unit != +STANDARD_COMPRESSION_UNIT ) {ntfs_error (vi->i_sb, -"Found non-standard compression unit (%u instead of 0 or %d). Cannot handle this." , +"Found non-standard compression unit (%u instead of 0, %d, or %d). Cannot handle this." , a->data.non_resident.compression_unit, - vol->sparse_compression_unit); + vol->sparse_compression_unit, +STANDARD_COMPRESSION_UNIT ); err = -EOPNOTSUPP ; goto unm_err_out; }
Signature · 1 line
2.43.0
Quoted 28 lines · Hyunchul Lee
Windows native sparse-file inspection shows that a non-resident $DATA attribute can be marked sparse and record the standard compression unit
(4) even when the file is not compressed.Signed-off-by Hyunchul Lee <[email protected]>--- fs/ntfs/inode.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)fs/ntfs/inode.c +7
-1@@ -1148,14 +1148,21 @@ static int ntfs_read_locked_inode(struct inode *vi) goto unm_err_out; } +/* +* Windows stores the standard compression unit in +* sparse attributes even when the data is not compressed. +*/ if (NInoSparse (ni) && a->data.non_resident.compression_unit && a->data.non_resident.compression_unit != - vol->sparse_compression_unit) { + vol->sparse_compression_unit && + a->data.non_resident.compression_unit != +STANDARD_COMPRESSION_UNIT ) {
fs/ntfs/inode.c static int ntfs_read_locked_inode(struct inode *vi) · line 1168
Quoted 10 lines
fs/ntfs/inode.c +3
-2ntfs_error (vi->i_sb, -"Found non-standard compression unit (%u instead of 0 or %d). Cannot handle this." , +"Found non-standard compression unit (%u instead of 0, %d, or %d). Cannot handle this." , a->data.non_resident.compression_unit, - vol->sparse_compression_unit); + vol->sparse_compression_unit, +STANDARD_COMPRESSION_UNIT ); err = -EOPNOTSUPP ; goto unm_err_out; }
Looks good to me.
Reviewed-by Baolin Liu <[email protected]>
Quoted 6 lines · Hyunchul Lee
Windows native sparse-file inspection shows that a non-resident $DATA attribute can be marked sparse and record the standard compression unit
(4) even when the file is not compressed.Signed-off-by Hyunchul Lee <[email protected]>
Applied it to #ntfs-next.
Thanks!