Skip to contentSkip to conversation

ext4: remove unneeded call to ext4_es_remove_extent in punch hole

PATCH In review Ashish Sangwan 2 participants 5 messages Apr 27, 2013 – Apr 29, 2013 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: remove unneeded call to ext4_es_remove_extent in punch hole

From: Ashish Sangwan <[email protected]>

During punch hole, before removing extents we make sure that the blocks are commited to disk by calling filemap_write_and_wait_range. So, the extents cannot be present on extent status tree.

---
 fs/ext4/inode.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
fs/ext4/inode.c +0 -6
index 50cced9..944eb15 100644
@@ -3749,13 +3749,6 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
 	down_write(&EXT4_I(inode)->i_data_sem);
 	ext4_discard_preallocations(inode);
 
-	ret = ext4_es_remove_extent(inode, first_block,
-				    stop_block - first_block);
-	if (ret) {
-		up_write(&EXT4_I(inode)->i_data_sem);
-		goto out_stop;
-	}
#1 lore raw
Quoted 8 lines · Ashish Sangwan

From: Ashish Sangwan <[email protected]>

During punch hole, before removing extents we make sure that the blocks are commited to disk by calling filemap_write_and_wait_range. So, the extents cannot be present on extent status tree.

Hi Ashish,

I guess that this patch is against mainline kernel, right? The commit log is right before we use extent status tree to track all extent information. In dev branch of ext4 tree, we track all extent status in status tree. So we need to remove extent from status tree in punch hole.

Thanks,
- Zheng

Quoted 29 lines
---
 fs/ext4/inode.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
fs/ext4/inode.c +0 -7
index 50cced9..944eb15 100644
@@ -3749,13 +3749,6 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
 	down_write(&EXT4_I(inode)->i_data_sem);
 	ext4_discard_preallocations(inode);
 
-	ret = ext4_es_remove_extent(inode, first_block,
-				    stop_block - first_block);
-	if (ret) {
-		up_write(&EXT4_I(inode)->i_data_sem);
-		goto out_stop;
-	}
-
 	if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
 		ret = ext4_ext_remove_space(inode, first_block,
 					    stop_block - 1);
Signature · 6 lines
1.7.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 7 lines · Zheng Liu
Quoted 6 lines · Ashish Sangwan

From: Ashish Sangwan <[email protected]>

During punch hole, before removing extents we make sure that the blocks are commited to disk by calling filemap_write_and_wait_range. So, the extents cannot be present on extent status tree.

Quoted 6 lines
Quoted 2 lines

Hi Ashish,

I guess that this patch is against mainline kernel, right?

True

Quoted 5 lines

The commit
log is right before we use extent status tree to track all extent information. In dev branch of ext4 tree, we track all extent status in status tree. So we need to remove extent from status tree in punch hole.

I was of the opinion that filemap_write_and_wait_range will remove the extent from status tree if its still there.
ok, I will check the dev branch.

Thanks,
Ashish

Quoted 33 lines

Thanks,
- Zheng

Quoted 29 lines
---
 fs/ext4/inode.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
fs/ext4/inode.c +0 -8
index 50cced9..944eb15 100644
@@ -3749,13 +3749,6 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
      down_write(&EXT4_I(inode)->i_data_sem);
      ext4_discard_preallocations(inode);
 
-     ret = ext4_es_remove_extent(inode, first_block,
-                                 stop_block - first_block);
-     if (ret) {
-             up_write(&EXT4_I(inode)->i_data_sem);
-             goto out_stop;
-     }
-
      if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
              ret = ext4_ext_remove_space(inode, first_block,
                                          stop_block - 1);
--

1.7.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 8 lines · Ashish Sangwan
Quoted 5 lines

The commit
log is right before we use extent status tree to track all extent information. In dev branch of ext4 tree, we track all extent status in status tree. So we need to remove extent from status tree in punch hole.

I was of the opinion that filemap_write_and_wait_range will remove the extent from status tree if its still there.
ok, I will check the dev branch.

Ah, please bear with me. In mainline kernel 3.9-rcX, we have used status tree to track all extent status. You could also check 3.9-rcX kernel. Please let me know if I miss something.

Thanks,
- Zheng

#4 lore raw
Quoted 6 lines · Zheng Liu
Quoted 5 lines · Ashish Sangwan
Quoted 5 lines

The commit
log is right before we use extent status tree to track all extent information. In dev branch of ext4 tree, we track all extent status in status tree. So we need to remove extent from status tree in punch hole.

Quoted 7 lines
Quoted 3 lines

I was of the opinion that filemap_write_and_wait_range will remove the extent from status tree if its still there.
ok, I will check the dev branch.

Ah, please bear with me. In mainline kernel 3.9-rcX, we have used status tree to track all extent status. You could also check 3.9-rcX kernel. Please let me know if I miss something.

Hi Zheng,

Ok, I understood your point.
Currently, after step 2 of extent status tree, it houses _all_ the extents and not just delayed extents.
This patch is not required now.

Regards,
Ashish

Quoted 3 lines

Thanks,
- Zheng