[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY8PR05MB93787EA896549E9F08766754CDF1A@CY8PR05MB9378.namprd05.prod.outlook.com>
Date: Tue, 12 Sep 2023 14:17:13 +0800
From: Wang Jianchao <jianchwa@...look.com>
To: djwong@...nel.org
Cc: linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: PATCH] xfs: use roundup_pow_of_two in xlog_write_log_records
In our production environment, we find that mounting a 500M and
clean /boot needs ~6 seconds sometimes. The one cause is that
xlog_write_log_records() uses ffs to decide the buffer size. It
can cause a lot of small IO easily when xlog_clear_stale_blocks()
needs to wrap around the end of log area and log head block is
not power of two. As xlog_write_log_records() has handled bigger
buffer very well, we can use roundup_pow_of_two instead of ffs to
decide buffer size.
Signed-off-by: Wang Jianchao <jianchwa@...look.com>
---
fs/xfs/xfs_log_recover.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 82c81d20459d..9368fefe1d0a 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1528,7 +1528,7 @@ xlog_write_log_records(
* a smaller size. We need to be able to write at least a
* log sector, or we're out of luck.
*/
- bufblks = 1 << ffs(blocks);
+ bufblks = roundup_pow_of_two(blocks);
while (bufblks > log->l_logBBsize)
bufblks >>= 1;
while (!(buffer = xlog_alloc_buffer(log, bufblks))) {
--
2.34.1
Powered by blists - more mailing lists