diff mbox

[1/2] ext4: no need to cond_resched() in ext4_trim_all_free()

Message ID 1493282200-32257-1-git-send-email-lczerner@redhat.com
State Rejected, archived
Headers show

Commit Message

Lukas Czerner April 27, 2017, 8:36 a.m. UTC
There is no need to call cond_resched() in ext4_trim_all_free() since
blkdev_issue_discard() already takes care of that. So just remove it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 fs/ext4/mballoc.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Theodore Ts'o April 30, 2017, 4:26 a.m. UTC | #1
On Thu, Apr 27, 2017 at 10:36:40AM +0200, Lukas Czerner wrote:
> There is no need to call cond_resched() in ext4_trim_all_free() since
> blkdev_issue_discard() already takes care of that. So just remove it.

Actually, it could be needed.  If minblocks is a small value, say 2,
and every other block in file system is allocated, then we could be in
the while loop for a long time.  That's a pretty unusual case, but
it's good to have the need_resched() check there.

						- Ted
Lukas Czerner May 4, 2017, 11:19 a.m. UTC | #2
On Sun, Apr 30, 2017 at 12:26:05AM -0400, Theodore Ts'o wrote:
> On Thu, Apr 27, 2017 at 10:36:40AM +0200, Lukas Czerner wrote:
> > There is no need to call cond_resched() in ext4_trim_all_free() since
> > blkdev_issue_discard() already takes care of that. So just remove it.
> 
> Actually, it could be needed.  If minblocks is a small value, say 2,
> and every other block in file system is allocated, then we could be in
> the while loop for a long time.  That's a pretty unusual case, but
> it's good to have the need_resched() check there.
> 
> 						- Ted

Fair enough, it's unusuall case, but still possible. Let's keep it this
way.

Thanks!
-Lukas
diff mbox

Patch

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 354dc1a..4879766 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -5163,12 +5163,6 @@  ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
 			break;
 		}
 
-		if (need_resched()) {
-			ext4_unlock_group(sb, group);
-			cond_resched();
-			ext4_lock_group(sb, group);
-		}
-
 		if ((e4b.bd_info->bb_free - free_count) < minblocks)
 			break;
 	}