Skip to contentSkip to conversation

ext4: fix log printing of ext4_mb_regular_allocator()

PATCH Superseded brookxu 3 participants 5 messages Aug 7, 2020 – Aug 14, 2020 ext4 file system

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

brookxu

author
#0 lore raw

PATCH 1/1 ext4: fix log printing of ext4_mb_regular_allocator()

Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.

---
 fs/ext4/mballoc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/mballoc.c +1 -2
index 5d4a1be..b0da525 100644
@@ -2324,15 +2324,14 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
 		 * We've been searching too long. Let's try to allocate
 		 * the best chunk we've found so far
 		 */
-
 		ext4_mb_try_best_found(ac, &e4b);
 		if (ac->ac_status != AC_STATUS_FOUND) {
 			/*
 			 * Someone more lucky has already allocated it.
 			 * The only thing we can do is just take first
 			 * found block(s)
-			printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n");
 			 */
+			mb_debug(sb, "EXT4-fs: someone won our chunk\n");
 			ac->ac_b_ex.fe_group = 0;
 			ac->ac_b_ex.fe_start = 0;
 			ac->ac_b_ex.fe_len = 0;
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · brookxu

Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.

The debug message would probably be more useful if it included some actual information (PID, status, fe_group, fe_start, fe_len), but that isn't necessarily a problem with this patch itself.

Quoted 26 lines

---
fs/ext4/mballoc.c | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/mballoc.c +1 -3
index 5d4a1be..b0da525 100644
@@ -2324,15 +2324,14 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
 		 * We've been searching too long. Let's try to allocate
 		 * the best chunk we've found so far
 		 */
-
 		ext4_mb_try_best_found(ac, &e4b);
 		if (ac->ac_status != AC_STATUS_FOUND) {
 			/*
 			 * Someone more lucky has already allocated it.
 			 * The only thing we can do is just take first
 			 * found block(s)
-			printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n");
 			 */
+			mb_debug(sb, "EXT4-fs: someone won our chunk\n");
 			ac->ac_b_ex.fe_group = 0;
 			ac->ac_b_ex.fe_start = 0;
 			ac->ac_b_ex.fe_len = 0;
--
Quoted 1 line

1.8.3.1

Cheers, Andreas

author
#2 lore raw

This suggestion is good, I try to update it in the next version.

thanks.

Andreas Dilger wrote on 2020/8/13 3:36:

Quoted 49 lines · brookxu
Quoted 5 lines

Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.

The debug message would probably be more useful if it included some actual information (PID, status, fe_group, fe_start, fe_len), but that isn't necessarily a problem with this patch itself.

Quoted 26 lines

---
fs/ext4/mballoc.c | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/mballoc.c +1 -3
index 5d4a1be..b0da525 100644
@@ -2324,15 +2324,14 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
 		 * We've been searching too long. Let's try to allocate
 		 * the best chunk we've found so far
 		 */
-
 		ext4_mb_try_best_found(ac, &e4b);
 		if (ac->ac_status != AC_STATUS_FOUND) {
 			/*
 			 * Someone more lucky has already allocated it.
 			 * The only thing we can do is just take first
 			 * found block(s)
-			printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n");
 			 */
+			mb_debug(sb, "EXT4-fs: someone won our chunk\n");
 			ac->ac_b_ex.fe_group = 0;
 			ac->ac_b_ex.fe_start = 0;
 			ac->ac_b_ex.fe_len = 0;
--
Quoted 1 line

1.8.3.1

Cheers, Andreas

#3 lore raw
In reply to brookxu
Quoted 16 lines · brookxu

Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.

---
  fs/ext4/mballoc.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/mballoc.c +0 -0
index 5d4a1be..b0da525 100644
@@ -2324,15 +2324,14 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
  		 * We've been searching too long. Let's try to allocate
  		 * the best chunk we've found so far
  		 */

fs/ext4/mballoc.c static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac, · line 2334

Quoted 10 lines
fs/ext4/mballoc.c +1 -2
-
  		ext4_mb_try_best_found(ac, &e4b);
  		if (ac->ac_status != AC_STATUS_FOUND) {
  			/*
  			 * Someone more lucky has already allocated it.
  			 * The only thing we can do is just take first
  			 * found block(s)
-			printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n");
  			 */
+			mb_debug(sb, "EXT4-fs: someone won our chunk\n");

mb_debug() already adds "EXT4-fs" string. So we need not add that here. but maybe we can add "sbi->s_mb_lost_chunks" in this msg, which may be helpful debug msg if too many lost chunks.

Quoted 4 lines
fs/ext4/mballoc.c +0 -0
  			ac->ac_b_ex.fe_group = 0;
  			ac->ac_b_ex.fe_start = 0;
  			ac->ac_b_ex.fe_len = 0;
author
#4 lore raw

This maybe a problem, I try to update it in the next version, thank you.

Ritesh Harjani wrote on 2020/8/13 22:04:

Quoted 39 lines · brookxu
Quoted 16 lines

Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.

---
  fs/ext4/mballoc.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/mballoc.c +0 -0
index 5d4a1be..b0da525 100644
@@ -2324,15 +2324,14 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
            * We've been searching too long. Let's try to allocate
            * the best chunk we've found so far
            */

fs/ext4/mballoc.c static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac, · line 2334

Quoted 10 lines
fs/ext4/mballoc.c +1 -2
-
           ext4_mb_try_best_found(ac, &e4b);
           if (ac->ac_status != AC_STATUS_FOUND) {
               /*
                * Someone more lucky has already allocated it.
                * The only thing we can do is just take first
                * found block(s)
-            printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n");
                */
+            mb_debug(sb, "EXT4-fs: someone won our chunk\n");

mb_debug() already adds "EXT4-fs" string. So we need not add that here. but maybe we can add "sbi->s_mb_lost_chunks" in this msg, which may be helpful debug msg if too many lost chunks.

Quoted 4 lines
fs/ext4/mballoc.c +0 -0
               ac->ac_b_ex.fe_group = 0;
               ac->ac_b_ex.fe_start = 0;
               ac->ac_b_ex.fe_len = 0;