Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1856850pxb; Fri, 22 Oct 2021 08:57:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS15zFHanfvLgLWZQMPy96S3vUrMEl/UjAG2pIzxdhdl1lAx7uKCJ2MwekDKYJkP+gDQM6 X-Received: by 2002:a63:5604:: with SMTP id k4mr430996pgb.340.1634918245255; Fri, 22 Oct 2021 08:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634918245; cv=none; d=google.com; s=arc-20160816; b=OluZj415BD3IPmkVwsWXuxhiiGOiaZOFqVNbxS2bXR9Roc6gmVIskTQ8ikH2Igt/Fz J/SjhVldq/7hcapm3nT7ZctwPcCTsBDnloUpYfemkfOSw2yd291Rf3YzFNOwDj6I29p1 an1vSWWQifCBvHcOlWEWQBJxasSEbNELSa8JSyKG7fJOxiFzsS2/ohN8xZ11YCgL/Zh+ /9ehIOtG16c3R+osfnmZBkRcZGCJiJuQk510Rp5sHFa2ZxH81ELKFK04azx4pZqtBBP3 6bvBm/cS+W3niNF4MZ1sojU4hEk7UvezonEjktmoEWuxMOCNybyqH2De05/KW6SUEnTd KGbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=KjXp0HECCDmxLZTX1hu71cOXhB6Xk/q6EuXO/P1++88=; b=lQSOv18+kLblpB+w7TuQF534jASOMTKvsjMTcrVPusQE9iof1UcdvHKoXTTnOrATps 66yoecnTkbm1OZCbZXk7JxuaEUT9qPyyApSFgb84wYpyEuVMHeYfoQkUjBAuQGQScyGT E5fmFlvjPTQEw/pR0ikl8+syHhhsEepMYAkmOFOLcQprlzQkbK7kTrhsVSakGGZl9C6t fD05yS8ADoVCpYJoyXF5n2Jg16gdXKzKCFRonOyBDrkWO6mgMM2CDd1efUjTJl9ega28 kS6xfya7D+sGtYrDV2iA8EH4QN/tc0ITsk6suxuDye5pr3JIULSeVlBcVUaDcJep29ID XceA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=k5rtf73A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kb10si14464395pjb.46.2021.10.22.08.57.10; Fri, 22 Oct 2021 08:57:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=k5rtf73A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233460AbhJVP47 (ORCPT + 99 others); Fri, 22 Oct 2021 11:56:59 -0400 Received: from relayfre-01.paragon-software.com ([176.12.100.13]:39286 "EHLO relayfre-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233151AbhJVP4w (ORCPT ); Fri, 22 Oct 2021 11:56:52 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 967B9120; Fri, 22 Oct 2021 18:54:32 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1634918072; bh=KjXp0HECCDmxLZTX1hu71cOXhB6Xk/q6EuXO/P1++88=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=k5rtf73AEE7Pb5/aiNeJRqvV3QG07RDbPvBIGmlZiihq5jN+S1KRh1vs7JNEsYd7z kmkSSk9inUQQnM3+vXRzhR0G++q/5lY4/QISEe+pq4sxJwmknN4cpAjhOqopLz/Dq6 YlkoNyA0x+aMTdgvnUarGEYI1Znw0+jDtCLfem6c= Received: from [192.168.211.69] (192.168.211.69) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 22 Oct 2021 18:54:32 +0300 Message-ID: Date: Fri, 22 Oct 2021 18:54:31 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: [PATCH 1/4] fs/ntfs3: Keep preallocated only if option prealloc enabled Content-Language: en-US From: Konstantin Komarov To: CC: , References: <09b42386-3e6d-df23-12c2-23c2718f766b@paragon-software.com> In-Reply-To: <09b42386-3e6d-df23-12c2-23c2718f766b@paragon-software.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.69] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If size of file was reduced, we still kept allocated blocks. This commit makes ntfs3 work as other fs like btrfs. https://bugzilla.kernel.org/show_bug.cgi?id=214719 Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") Reported-by: Ganapathi Kamath Signed-off-by: Konstantin Komarov --- 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