Skip to contentSkip to conversation

remove EXT4_GET_BLOCKS_KEEP_SIZE flag, etc.

PATCH Applied Eric Whitney 3 participants 7 messages Apr 15, 2020 – May 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover remove EXT4_GET_BLOCKS_KEEP_SIZE flag, etc.

Some code was left behind after removing EXT4_EOFBLOCKS_FL and the code associated with it in order to minimize the amount of change in that earlier patch and to make it easier to revert in the event that proved necessary. The first patch in this series cleans that up. While writing that patch I noticed that there were some ext4_map_blocks() flag translations missing, and the second patch in the series fixes that. I've bundled them together here to aid merging, as there's a common dependency in ext4.h.

Eric Whitney (2):
ext4: remove EXT4_GET_BLOCKS_KEEP_SIZE flag
ext4: translate a few more map flags to strings in tracepoints

 fs/ext4/ext4.h              |  2 --
 fs/ext4/extents.c           |  4 ----
 fs/ext4/inode.c             | 12 ++++--------
 include/trace/events/ext4.h |  6 ++++--
 4 files changed, 8 insertions(+), 16 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 ext4: remove EXT4_GET_BLOCKS_KEEP_SIZE flag

The eofblocks code was removed in the 5.7 release by "ext4: remove EOFBLOCKS_FL and associated code" (4337ecd1fe99). The ext4_map_blocks() flag used to trigger it can now be removed as well.

---
 fs/ext4/ext4.h              |  2 --
 fs/ext4/extents.c           |  4 ----
 fs/ext4/inode.c             | 12 ++++--------
 include/trace/events/ext4.h |  1 -
 4 files changed, 4 insertions(+), 15 deletions(-)
fs/ext4/ext4.h +0 -2
index 91eb4381cae5..c8d060627448 100644
@@ -609,8 +609,6 @@ enum {
 #define EXT4_GET_BLOCKS_METADATA_NOFAIL		0x0020
 	/* Don't normalize allocation size (used for fallocate) */
 #define EXT4_GET_BLOCKS_NO_NORMALIZE		0x0040
-	/* Request will not result in inode size update (user for fallocate) */
-#define EXT4_GET_BLOCKS_KEEP_SIZE		0x0080
 	/* Convert written extents to unwritten */
 #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN	0x0100
 	/* Write zeros to newly created written extents */
fs/ext4/extents.c +0 -4
index 031752cfb6f7..18ede2f9e4ad 100644
@@ -4507,8 +4507,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 	}
 
 	flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT;
-	if (mode & FALLOC_FL_KEEP_SIZE)
-		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
 
 	/* Wait all existing dio workers, newcomers will block on i_mutex */
 	inode_dio_wait(inode);
@@ -4647,8 +4645,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 
 	max_blocks = EXT4_MAX_BLOCKS(len, offset, blkbits);
 	flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT;
-	if (mode & FALLOC_FL_KEEP_SIZE)
-		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
 
 	inode_lock(inode);
 
fs/ext4/inode.c +4 -8
index e416096fc081..97562c51c1c9 100644
@@ -432,11 +432,9 @@ static void ext4_map_blocks_es_recheck(handle_t *handle,
 	 */
 	down_read(&EXT4_I(inode)->i_data_sem);
 	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
-		retval = ext4_ext_map_blocks(handle, inode, map, flags &
-					     EXT4_GET_BLOCKS_KEEP_SIZE);
+		retval = ext4_ext_map_blocks(handle, inode, map, 0);
 	} else {
-		retval = ext4_ind_map_blocks(handle, inode, map, flags &
-					     EXT4_GET_BLOCKS_KEEP_SIZE);
+		retval = ext4_ind_map_blocks(handle, inode, map, 0);
 	}
 	up_read((&EXT4_I(inode)->i_data_sem));
 
@@ -541,11 +539,9 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
 	 */
 	down_read(&EXT4_I(inode)->i_data_sem);
 	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
-		retval = ext4_ext_map_blocks(handle, inode, map, flags &
-					     EXT4_GET_BLOCKS_KEEP_SIZE);
+		retval = ext4_ext_map_blocks(handle, inode, map, 0);
 	} else {
-		retval = ext4_ind_map_blocks(handle, inode, map, flags &
-					     EXT4_GET_BLOCKS_KEEP_SIZE);
+		retval = ext4_ind_map_blocks(handle, inode, map, 0);
 	}
 	if (retval > 0) {
 		unsigned int status;
include/trace/events/ext4.h +0 -1
index 19c87661eeec..40ff8a2fc763 100644
@@ -45,7 +45,6 @@ struct partial_cluster;
 	{ EXT4_GET_BLOCKS_CONVERT,		"CONVERT" },		\
 	{ EXT4_GET_BLOCKS_METADATA_NOFAIL,	"METADATA_NOFAIL" },	\
 	{ EXT4_GET_BLOCKS_NO_NORMALIZE,		"NO_NORMALIZE" },	\
-	{ EXT4_GET_BLOCKS_KEEP_SIZE,		"KEEP_SIZE" },		\
 	{ EXT4_GET_BLOCKS_ZERO,			"ZERO" })
 
 /*
Signature · 1 line
2.11.0
reviewer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] ext4: remove EXT4_GET_BLOCKS_KEEP_SIZE flag

Quoted 5 lines · Eric Whitney

The eofblocks code was removed in the 5.7 release by "ext4: remove EOFBLOCKS_FL and associated code" (4337ecd1fe99). The ext4_map_blocks() flag used to trigger it can now be removed as well.

Looks good to me. You can add:

Honza

Quoted 89 lines
---
 fs/ext4/ext4.h              |  2 --
 fs/ext4/extents.c           |  4 ----
 fs/ext4/inode.c             | 12 ++++--------
 include/trace/events/ext4.h |  1 -
 4 files changed, 4 insertions(+), 15 deletions(-)
fs/ext4/ext4.h +0 -2
index 91eb4381cae5..c8d060627448 100644
@@ -609,8 +609,6 @@ enum {
 #define EXT4_GET_BLOCKS_METADATA_NOFAIL		0x0020
 	/* Don't normalize allocation size (used for fallocate) */
 #define EXT4_GET_BLOCKS_NO_NORMALIZE		0x0040
-	/* Request will not result in inode size update (user for fallocate) */
-#define EXT4_GET_BLOCKS_KEEP_SIZE		0x0080
 	/* Convert written extents to unwritten */
 #define EXT4_GET_BLOCKS_CONVERT_UNWRITTEN	0x0100
 	/* Write zeros to newly created written extents */
fs/ext4/extents.c +0 -4
index 031752cfb6f7..18ede2f9e4ad 100644
@@ -4507,8 +4507,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 	}
 
 	flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT;
-	if (mode & FALLOC_FL_KEEP_SIZE)
-		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
 
 	/* Wait all existing dio workers, newcomers will block on i_mutex */
 	inode_dio_wait(inode);
@@ -4647,8 +4645,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 
 	max_blocks = EXT4_MAX_BLOCKS(len, offset, blkbits);
 	flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT;
-	if (mode & FALLOC_FL_KEEP_SIZE)
-		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
 
 	inode_lock(inode);
 
fs/ext4/inode.c +4 -8
index e416096fc081..97562c51c1c9 100644
@@ -432,11 +432,9 @@ static void ext4_map_blocks_es_recheck(handle_t *handle,
 	 */
 	down_read(&EXT4_I(inode)->i_data_sem);
 	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
-		retval = ext4_ext_map_blocks(handle, inode, map, flags &
-					     EXT4_GET_BLOCKS_KEEP_SIZE);
+		retval = ext4_ext_map_blocks(handle, inode, map, 0);
 	} else {
-		retval = ext4_ind_map_blocks(handle, inode, map, flags &
-					     EXT4_GET_BLOCKS_KEEP_SIZE);
+		retval = ext4_ind_map_blocks(handle, inode, map, 0);
 	}
 	up_read((&EXT4_I(inode)->i_data_sem));
 
@@ -541,11 +539,9 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
 	 */
 	down_read(&EXT4_I(inode)->i_data_sem);
 	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
-		retval = ext4_ext_map_blocks(handle, inode, map, flags &
-					     EXT4_GET_BLOCKS_KEEP_SIZE);
+		retval = ext4_ext_map_blocks(handle, inode, map, 0);
 	} else {
-		retval = ext4_ind_map_blocks(handle, inode, map, flags &
-					     EXT4_GET_BLOCKS_KEEP_SIZE);
+		retval = ext4_ind_map_blocks(handle, inode, map, 0);
 	}
 	if (retval > 0) {
 		unsigned int status;
include/trace/events/ext4.h +0 -1
index 19c87661eeec..40ff8a2fc763 100644
@@ -45,7 +45,6 @@ struct partial_cluster;
 	{ EXT4_GET_BLOCKS_CONVERT,		"CONVERT" },		\
 	{ EXT4_GET_BLOCKS_METADATA_NOFAIL,	"METADATA_NOFAIL" },	\
 	{ EXT4_GET_BLOCKS_NO_NORMALIZE,		"NO_NORMALIZE" },	\
-	{ EXT4_GET_BLOCKS_KEEP_SIZE,		"KEEP_SIZE" },		\
 	{ EXT4_GET_BLOCKS_ZERO,			"ZERO" })
 
 /*
Signature · 1 line
2.11.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#3 lore raw

Re: [PATCH 1/2] ext4: remove EXT4_GET_BLOCKS_KEEP_SIZE flag

Quoted 10 lines · Jan Kara
Quoted 5 lines · Eric Whitney

The eofblocks code was removed in the 5.7 release by "ext4: remove EOFBLOCKS_FL and associated code" (4337ecd1fe99). The ext4_map_blocks() flag used to trigger it can now be removed as well.

Looks good to me. You can add:

Applied, thanks.

- Ted

#4 lore raw

PATCH 2/2 ext4: translate a few more map flags to strings in tracepoints

In reply to Eric Whitney

As new ext4_map_blocks() flags have been added, not all have gotten flag bit to string translations to make tracepoint output more readable. Fix that, and go one step further by adding a translation for the EXT4_EX_NOCACHE flag as well. The EXT4_EX_FORCE_CACHE flag can never be set in a tracepoint in the current code, so there's no need to bother with a translation for it right now.

---
 include/trace/events/ext4.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/trace/events/ext4.h +4 -1
index 40ff8a2fc763..280475c1cecc 100644
@@ -45,7 +45,10 @@ struct partial_cluster;
 	{ EXT4_GET_BLOCKS_CONVERT,		"CONVERT" },		\
 	{ EXT4_GET_BLOCKS_METADATA_NOFAIL,	"METADATA_NOFAIL" },	\
 	{ EXT4_GET_BLOCKS_NO_NORMALIZE,		"NO_NORMALIZE" },	\
-	{ EXT4_GET_BLOCKS_ZERO,			"ZERO" })
+	{ EXT4_GET_BLOCKS_CONVERT_UNWRITTEN,	"CONVERT_UNWRITTEN" },  \
+	{ EXT4_GET_BLOCKS_ZERO,			"ZERO" },		\
+	{ EXT4_GET_BLOCKS_IO_SUBMIT,		"IO_SUBMIT" },		\
+	{ EXT4_EX_NOCACHE,			"EX_NOCACHE" })
 
 /*
  * __print_flags() requires that all enum values be wrapped in the
Signature · 1 line
2.11.0
reviewer Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] ext4: translate a few more map flags to strings in tracepoints

Quoted 8 lines · Eric Whitney

As new ext4_map_blocks() flags have been added, not all have gotten flag bit to string translations to make tracepoint output more readable. Fix that, and go one step further by adding a translation for the EXT4_EX_NOCACHE flag as well. The EXT4_EX_FORCE_CACHE flag can never be set in a tracepoint in the current code, so there's no need to bother with a translation for it right now.

Looks good to me. You can add:

Honza

Quoted 23 lines
---
 include/trace/events/ext4.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/trace/events/ext4.h +4 -1
index 40ff8a2fc763..280475c1cecc 100644
@@ -45,7 +45,10 @@ struct partial_cluster;
 	{ EXT4_GET_BLOCKS_CONVERT,		"CONVERT" },		\
 	{ EXT4_GET_BLOCKS_METADATA_NOFAIL,	"METADATA_NOFAIL" },	\
 	{ EXT4_GET_BLOCKS_NO_NORMALIZE,		"NO_NORMALIZE" },	\
-	{ EXT4_GET_BLOCKS_ZERO,			"ZERO" })
+	{ EXT4_GET_BLOCKS_CONVERT_UNWRITTEN,	"CONVERT_UNWRITTEN" },  \
+	{ EXT4_GET_BLOCKS_ZERO,			"ZERO" },		\
+	{ EXT4_GET_BLOCKS_IO_SUBMIT,		"IO_SUBMIT" },		\
+	{ EXT4_EX_NOCACHE,			"EX_NOCACHE" })
 
 /*
  * __print_flags() requires that all enum values be wrapped in the
Signature · 1 line
2.11.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#6 lore raw

Re: [PATCH 2/2] ext4: translate a few more map flags to strings in tracepoints

Quoted 8 lines · Jan Kara
Quoted 7 lines · Eric Whitney

As new ext4_map_blocks() flags have been added, not all have gotten flag bit to string translations to make tracepoint output more readable. Fix that, and go one step further by adding a translation for the EXT4_EX_NOCACHE flag as well. The EXT4_EX_FORCE_CACHE flag can never be set in a tracepoint in the current code, so there's no need to bother with a translation for it right now.

Quoted 5 lines
Quoted 1 line

Looks good to me. You can add:

Applied, thanks.

- Ted