[PATCH 6/6] ext4: remove mballoc's NOFREE flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux