All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: <ntfs3@lists.linux.dev>
Cc: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<kari.argillander@gmail.com>
Subject: [PATCH 1/4] fs/ntfs3: Keep preallocated only if option prealloc enabled
Date: Tue, 26 Oct 2021 19:40:57 +0300	[thread overview]
Message-ID: <19b0fc31-a28f-69aa-27dc-e6514a10643e@paragon-software.com> (raw)
In-Reply-To: <a57c1c49-4ef3-15ee-d2cd-d77fb4246b3c@paragon-software.com>

If size of file was reduced, we still kept allocated blocks.
This commit makes ntfs3 work as other fs like btrfs.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=214719
Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")

Reported-by: Ganapathi Kamath <hgkamath@hotmail.com>
Tested-by: Ganapathi Kamath <hgkamath@hotmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
 fs/ntfs3/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 43b1451bff53..3ac0482c6880 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -494,7 +494,7 @@ static int ntfs_truncate(struct inode *inode, loff_t new_size)
 
 	down_write(&ni->file.run_lock);
 	err = attr_set_size(ni, ATTR_DATA, NULL, 0, &ni->file.run, new_size,
-			    &new_valid, true, NULL);
+			    &new_valid, ni->mi.sbi->options->prealloc, NULL);
 	up_write(&ni->file.run_lock);
 
 	if (new_valid < ni->i_valid)
-- 
2.33.0



  reply	other threads:[~2021-10-26 16:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 16:40 [PATCH v2 0/4] fs/ntfs3: Various fixes for xattr and files Konstantin Komarov
2021-10-26 16:40 ` Konstantin Komarov [this message]
2021-10-26 18:17   ` [PATCH 1/4] fs/ntfs3: Keep preallocated only if option prealloc enabled Kari Argillander
2021-10-26 16:41 ` [PATCH 2/4] fs/ntfs3: Restore ntfs_xattr_get_acl and ntfs_xattr_set_acl functions Konstantin Komarov
2021-10-26 20:37   ` Kari Argillander
2021-10-27 11:41   ` kernel test robot
2021-10-27 11:41     ` kernel test robot
2021-10-26 16:41 ` [PATCH 3/4] fs/ntfs3: Update i_ctime when xattr is added Konstantin Komarov
2021-10-26 20:41   ` Kari Argillander
2021-11-15 15:50     ` Konstantin Komarov
2021-10-26 16:42 ` [PATCH 4/4] fs/ntfs3: Optimize locking in ntfs_save_wsl_perm Konstantin Komarov
2021-10-26 18:08   ` Kari Argillander
  -- strict thread matches above, loose matches on Subject: below --
2021-10-22 15:53 [PATCH 0/4] fs/ntfs3: Various fixes for xattr and files Konstantin Komarov
2021-10-22 15:54 ` [PATCH 1/4] fs/ntfs3: Keep preallocated only if option prealloc enabled Konstantin Komarov
2021-10-23  9:55   ` Kari Argillander
2021-10-24  8:35     ` Ganapathi Kamath
2021-10-24 10:43       ` Kari Argillander
2021-10-24 11:13         ` Ganapathi Kamath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19b0fc31-a28f-69aa-27dc-e6514a10643e@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=kari.argillander@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.