[Top] [All Lists]

[RFC] xfs: remedy small writes during wrapped-log recovery

To: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
Subject: [RFC] xfs: remedy small writes during wrapped-log recovery
From: "Michael L. Semon" <mlsemon35@xxxxxxxxx>
Date: Fri, 09 Jan 2015 15:02:53 -0500
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=e6iynjrZXWDIo3QQ6UqJFV04KOKuwzbIQ+2O1vPtSok=; b=ZpdjJI82a8ulT0zWxBqhJLNIntHnjwpZhebOgdlv1y1vXuWfhdghKICRR2oOdp2DQw LXZRDRvC7UkHKJCSAs6dXdqN5rFO+VdOWTyxKK13sLBlWEOIIjQ7FOuT+Tcd1P7xLsXE ZHJOhFu8s5caGT+J29oG95hVxV/W3uWG7QHvPDbrdmn36DRXrH0i7DCTK7ImAQeVRxls 9/dH1AkH4w72pGDDpub6jPtT7lH8xN518AX1i1ovjUiRE4N0/eGc3hXlxAieui8WZ+sB jyNTo14IsexcJY8SGn7nA9lpI96plVsxsZxG1lkR9ug00b2HYHUbixv1DKEEJlFs/yXs egVw==
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
Hi!  I like this patch and am confident with it on x86.  However,
a) it has no x86_64 coverage; and b) xfstests xfs/306 in particular
emits more of this output:

    buffer_io_error: nnnn callbacks suppressed

Might someone evaluate this patch or the intent of the patch?

The intent:

For XFS filesystems that don't change much, such as the /boot and
alternate / partitions here, mount times were about 17s instead of
0.4s while the log is in a wrapped state, write caches off.  This 
patch fixes the issue on v4- and v5-superblock XFS filesystems.

xfs_repair can solve this issue short-term and also cut wrapped-log 
mount time in half short-term for v5 file systems.  Don't know if 
that's a mkfs.xfs issue or just coincidence.

A bisect still needs to be done to determine when the slow mount 
behavior started.  It could very well be that somebody fixed the 
buffer_io_error messages that I saw long ago, and the solution made 
some mounts here rather miserable.



The patch:

xlog_write_log_records() has an algorithm to "Greedily allocate a
buffer big enough...," starting with ffs(blocks), adding two sensible
checks, and then feeding it to a loop with checks of its own.

However, when blocks is an odd number, the number that becomes nbblks
to the xlog_bwrite() function ends up being 2 (1 << 1).  The most
obvious effect is that when the log wraps, a write of two odd-sized
log regions on an 8-GB XFS filesystem will take around 2049 calls 
to xlog_bwrite() instead of the "two separate I/Os" suggested in

Fix this by changing the ffs(blocks) to fls(blocks).

There is a similar ffs(blocks) check in xlog_find_verify_cycle().
This was not investigated.

Signed-off-by: Michael L. Semon <mlsemon35@xxxxxxxxx>
 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 a5a945f..13381eb 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1242,7 +1242,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 = 1 << fls(blocks);
        while (bufblks > log->l_logBBsize)
                bufblks >>= 1;
        while (!(bp = xlog_get_bp(log, bufblks))) {

<Prev in Thread] Current Thread [Next in Thread>