PATCH] xfs: use roundup_pow_of_two in xlog_write_log_records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux