linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Whitney <enwlinux@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, Eric Whitney <enwlinux@gmail.com>
Subject: [PATCH 6/6] ext4: remove mballoc's NOFREE flags
Date: Tue, 12 Sep 2023 22:11:48 -0400	[thread overview]
Message-ID: <20230913021148.1181646-7-enwlinux@gmail.com> (raw)
In-Reply-To: <20230913021148.1181646-1-enwlinux@gmail.com>

ext4_remove_space() no longer relies on the NOFREE_FIRST_CLUSTER and
NOFREE_LAST_CLUSTER flags used to condition the behavior of
ext4_free_blocks() when applied to clusters.  Remove everything
related to those flags.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
 fs/ext4/ext4.h              |  4 +---
 fs/ext4/mballoc.c           | 25 ++++---------------------
 include/trace/events/ext4.h |  4 +---
 3 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 9418359b1d9d..32c803f7dc56 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -736,9 +736,7 @@ enum {
 #define EXT4_FREE_BLOCKS_FORGET			0x0002
 #define EXT4_FREE_BLOCKS_VALIDATED		0x0004
 #define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE		0x0008
-#define EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER	0x0010
-#define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER	0x0020
-#define EXT4_FREE_BLOCKS_RERESERVE_CLUSTER      0x0040
+#define EXT4_FREE_BLOCKS_RERESERVE_CLUSTER      0x0010
 
 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
 /*
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index c91db9f57524..f9096ab49bfb 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -6681,35 +6681,18 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
 	/*
 	 * If the extent to be freed does not begin on a cluster
 	 * boundary, we need to deal with partial clusters at the
-	 * beginning and end of the extent.  Normally we will free
-	 * blocks at the beginning or the end unless we are explicitly
-	 * requested to avoid doing so.
+	 * beginning and end of the extent.
 	 */
 	overflow = EXT4_PBLK_COFF(sbi, block);
 	if (overflow) {
-		if (flags & EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER) {
-			overflow = sbi->s_cluster_ratio - overflow;
-			block += overflow;
-			if (count > overflow)
-				count -= overflow;
-			else
-				return;
-		} else {
-			block -= overflow;
-			count += overflow;
-		}
+		block -= overflow;
+		count += overflow;
 		/* The range changed so it's no longer validated */
 		flags &= ~EXT4_FREE_BLOCKS_VALIDATED;
 	}
 	overflow = EXT4_LBLK_COFF(sbi, count);
 	if (overflow) {
-		if (flags & EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER) {
-			if (count > overflow)
-				count -= overflow;
-			else
-				return;
-		} else
-			count += sbi->s_cluster_ratio - overflow;
+		count += sbi->s_cluster_ratio - overflow;
 		/* The range changed so it's no longer validated */
 		flags &= ~EXT4_FREE_BLOCKS_VALIDATED;
 	}
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index b474ded2623d..786987154893 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -71,9 +71,7 @@ TRACE_DEFINE_ENUM(BH_Boundary);
 	{ EXT4_FREE_BLOCKS_METADATA,		"METADATA" },	\
 	{ EXT4_FREE_BLOCKS_FORGET,		"FORGET" },	\
 	{ EXT4_FREE_BLOCKS_VALIDATED,		"VALIDATED" },	\
-	{ EXT4_FREE_BLOCKS_NO_QUOT_UPDATE,	"NO_QUOTA" },	\
-	{ EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER,"1ST_CLUSTER" },\
-	{ EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER,	"LAST_CLUSTER" })
+	{ EXT4_FREE_BLOCKS_NO_QUOT_UPDATE,	"NO_QUOTA" })
 
 TRACE_DEFINE_ENUM(ES_WRITTEN_B);
 TRACE_DEFINE_ENUM(ES_UNWRITTEN_B);
-- 
2.30.2


      parent reply	other threads:[~2023-09-13  2:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13  2:11 [PATCH 0/6] improve cluster and block removal code Eric Whitney
2023-09-13  2:11 ` [PATCH 1/6] ext4: consolidate code used to free clusters Eric Whitney
2023-09-13  2:11 ` [PATCH 2/6] ext4: rework partial cluster definition and related tracepoints Eric Whitney
2023-09-13  2:11 ` [PATCH 3/6] ext4: rework partial cluster handling to use lblk more consistently Eric Whitney
2023-09-13  2:11 ` [PATCH 4/6] ext4: consolidate partial cluster initialization Eric Whitney
2023-09-13  2:11 ` [PATCH 5/6] ext4: simplify and improve efficiency of cluster removal code Eric Whitney
2023-09-13  2:11 ` Eric Whitney [this message]

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=20230913021148.1181646-7-enwlinux@gmail.com \
    --to=enwlinux@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).