Blame SOURCES/0095-fs-ntfs3-Keep-prealloc-for-all-types-of-files.patch

Kmods SIG 8b815c
From ce46ae0c3e31400dc89d1e4620a812647cab9c72 Mon Sep 17 00:00:00 2001
Kmods SIG 8b815c
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Kmods SIG 8b815c
Date: Fri, 1 Oct 2021 18:48:49 +0300
Kmods SIG 8b815c
Subject: [Backport ce46ae0c3e31] src: Keep prealloc for all types of
Kmods SIG 8b815c
 files
Kmods SIG 8b815c
Kmods SIG 8b815c
Before we haven't kept prealloc for sparse files because we thought that
Kmods SIG 8b815c
it will speed up create / write operations.
Kmods SIG 8b815c
It lead to situation, when user reserved some space for sparse file,
Kmods SIG 8b815c
filled volume, and wasn't able to write in reserved file.
Kmods SIG 8b815c
With this commit we keep prealloc.
Kmods SIG 8b815c
Now xfstest generic/274 pass.
Kmods SIG 8b815c
Fixes: be71b5cba2e6 ("src: Add attrib operations")
Kmods SIG 8b815c
Kmods SIG 8b815c
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Kmods SIG 8b815c
---
Kmods SIG 8b815c
 src/attrib.c | 8 +-------
Kmods SIG 8b815c
 1 file changed, 1 insertion(+), 7 deletions(-)
Kmods SIG 8b815c
Kmods SIG 8b815c
diff --git a/src/attrib.c b/src/attrib.c
Kmods SIG 8b815c
index 8a00fa978f5f9c3d496bd333bf1ace72d9194f37..e8c00dda42adbbff372908fdcb3d7d6814567cdf 100644
Kmods SIG 8b815c
--- a/src/attrib.c
Kmods SIG 8b815c
+++ b/src/attrib.c
Kmods SIG 8b815c
@@ -447,11 +447,8 @@ int attr_set_size(struct ntfs_inode *ni, enum ATTR_TYPE type,
Kmods SIG 8b815c
 again_1:
Kmods SIG 8b815c
 	align = sbi->cluster_size;
Kmods SIG 8b815c
 
Kmods SIG 8b815c
-	if (is_ext) {
Kmods SIG 8b815c
+	if (is_ext)
Kmods SIG 8b815c
 		align <<= attr_b->nres.c_unit;
Kmods SIG 8b815c
-		if (is_attr_sparsed(attr_b))
Kmods SIG 8b815c
-			keep_prealloc = false;
Kmods SIG 8b815c
-	}
Kmods SIG 8b815c
 
Kmods SIG 8b815c
 	old_valid = le64_to_cpu(attr_b->nres.valid_size);
Kmods SIG 8b815c
 	old_size = le64_to_cpu(attr_b->nres.data_size);
Kmods SIG 8b815c
@@ -461,9 +458,6 @@ int attr_set_size(struct ntfs_inode *ni, enum ATTR_TYPE type,
Kmods SIG 8b815c
 	new_alloc = (new_size + align - 1) & ~(u64)(align - 1);
Kmods SIG 8b815c
 	new_alen = new_alloc >> cluster_bits;
Kmods SIG 8b815c
 
Kmods SIG 8b815c
-	if (keep_prealloc && is_ext)
Kmods SIG 8b815c
-		keep_prealloc = false;
Kmods SIG 8b815c
-
Kmods SIG 8b815c
 	if (keep_prealloc && new_size < old_size) {
Kmods SIG 8b815c
 		attr_b->nres.data_size = cpu_to_le64(new_size);
Kmods SIG 8b815c
 		mi_b->dirty = true;
Kmods SIG 8b815c
-- 
Kmods SIG 8b815c
2.31.1
Kmods SIG 8b815c