]> Git Repo - linux.git/commitdiff
xfs: use roundup_pow_of_two instead of ffs during xlog_find_tail
authorWang Jianchao <[email protected]>
Wed, 13 Sep 2023 01:38:01 +0000 (09:38 +0800)
committerChandan Babu R <[email protected]>
Wed, 13 Sep 2023 05:08:20 +0000 (10:38 +0530)
In our production environment, we find that mounting a 500M /boot
which is umount cleanly needs ~6s. One cause is that ffs() is
used by xlog_write_log_records() 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. Things are similar in xlog_find_verify_cycle().

The code is able to handed bigger buffer very well, we can use
roundup_pow_of_two() to replace ffs() directly to avoid small
and sychronous IOs.

Reviewed-by: Dave Chinner <[email protected]>
Signed-off-by: Wang Jianchao <[email protected]>
Signed-off-by: Chandan Babu R <[email protected]>
fs/xfs/xfs_log_recover.c

index 82c81d20459d147ce6f18574037b2850863d0176..13b94d2e605bd9ddb852f76eeeea0bd956a595e0 100644 (file)
@@ -329,7 +329,7 @@ xlog_find_verify_cycle(
         * try a smaller size.  We need to be able to read at least
         * a log sector, or we're out of luck.
         */
-       bufblks = 1 << ffs(nbblks);
+       bufblks = roundup_pow_of_two(nbblks);
        while (bufblks > log->l_logBBsize)
                bufblks >>= 1;
        while (!(buffer = xlog_alloc_buffer(log, bufblks))) {
@@ -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))) {
This page took 0.065936 seconds and 4 git commands to generate.