linux-fsdevel.vger.kernel.org archive mirror
 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>
Subject: [PATCH 5/6] fs/ntfs3: Create MFT zone only if length is large enough
Date: Wed, 13 Jul 2022 19:47:14 +0300	[thread overview]
Message-ID: <1282d35f-ed0d-e020-a4e5-8700744e2c3b@paragon-software.com> (raw)
In-Reply-To: <2101d95b-be41-6e6d-e019-bc70f816b2e8@paragon-software.com>

Also removed uninformative print

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
  fs/ntfs3/fsntfs.c | 11 +++--------
  1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index e6f5bf684da4..d09213ae9755 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -806,12 +806,6 @@ int ntfs_refresh_zone(struct ntfs_sb_info *sbi)
  
  	/* Try to allocate clusters after last MFT run. */
  	zlen = wnd_find(wnd, sbi->zone_max, lcn_s, 0, &lcn_s);
-	if (!zlen) {
-		ntfs_notice(sbi->sb, "MftZone: unavailable");
-		return 0;
-	}
-
-	/* Truncate too large zone. */
  	wnd_zone_set(wnd, lcn_s, zlen);
  
  	return 0;
@@ -2473,8 +2467,9 @@ void mark_as_free_ex(struct ntfs_sb_info *sbi, CLST lcn, CLST len, bool trim)
  	if (zlen == zone_len) {
  		/* MFT zone already has maximum size. */
  	} else if (!zone_len) {
-		/* Create MFT zone. */
-		wnd_zone_set(wnd, lcn, zlen);
+		/* Create MFT zone only if 'zlen' is large enough. */
+		if (zlen == sbi->zone_max)
+			wnd_zone_set(wnd, lcn, zlen);
  	} else {
  		CLST zone_lcn = wnd_zone_bit(wnd);
  
-- 
2.37.0



  parent reply	other threads:[~2022-07-13 16:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 16:44 [PATCH 0/6] fs/ntfs3: Refactoring of several functions Konstantin Komarov
2022-07-13 16:45 ` [PATCH 1/6] fs/ntfs3: New function ntfs_bad_inode Konstantin Komarov
2022-07-13 16:45 ` [PATCH 2/6] fs/ntfs3: Refactoring attr_set_size to restore after errors Konstantin Komarov
2022-07-13 16:46 ` [PATCH 3/6] fs/ntfs3: Refactoring attr_punch_hole " Konstantin Komarov
2022-07-13 18:58   ` Joe Perches
2022-07-13 16:46 ` [PATCH 4/6] fs/ntfs3: Refactoring attr_insert_range " Konstantin Komarov
2022-07-13 16:47 ` Konstantin Komarov [this message]
2022-07-13 16:47 ` [PATCH 6/6] fs/ntfs3: Make ni_ins_new_attr return error Konstantin Komarov

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=1282d35f-ed0d-e020-a4e5-8700744e2c3b@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).