fs/ntfs3: Fix fiemap + fix shrink file size (to remove preallocated space)
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Mon, 25 Oct 2021 15:31:28 +0000 (18:31 +0300)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Wed, 24 Nov 2021 12:13:26 +0000 (15:13 +0300)
commit3880f2b816a7e4ca889b7e8a42e6c62c5706ed36
tree9de183c6f0ecd74200dc34ea6f2f47429479e2a2
parent9186d472ee780fabf74424756c4c00545166157e
fs/ntfs3: Fix fiemap + fix shrink file size (to remove preallocated space)

Two problems:
1. ntfs3_setattr can't truncate preallocated space;
2. if allocated fragment "cross" valid size, then fragment splits into two parts:
- normal part;
- unwritten part (here we must return FIEMAP_EXTENT_LAST).
Before this commit we returned FIEMAP_EXTENT_LAST for whole fragment.
Fixes xfstest generic/092
Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/file.c
fs/ntfs3/frecord.c