From 63eacb74267a5a2776a215b529ab1a6f6939b80b Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Sun, 2 Jul 2017 21:30:08 +0300 Subject: [PATCH] sbin/hammer: Move cache to tailq end when get_buffer_data() has a valid cache This is the same as what get_buffer() does when new allocation is not needed. This hasn't been done in get_buffer_data() when the given non NULL buffer is the one to look for. This seems to make newfs_hammer a bit faster, as the i/o size is normally large enough to invoke eviction of HAMMER userspace buffer cache while running, starting from the head of the tailq. -- before this commit # for x in 1 2 3 4 5; do > (time newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null) 2>&1 | grep real > done real 0m20.291s real 0m20.574s real 0m22.347s real 0m21.562s real 0m20.991s -- with this commit # for x in 1 2 3 4 5; do > (time newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null) 2>&1 | grep real > done real 0m18.023s real 0m18.064s real 0m18.104s real 0m17.646s real 0m18.310s --- sbin/hammer/ondisk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/hammer/ondisk.c b/sbin/hammer/ondisk.c index a35613b5c2..ac56980a1d 100644 --- a/sbin/hammer/ondisk.c +++ b/sbin/hammer/ondisk.c @@ -478,6 +478,8 @@ get_buffer_data(hammer_off_t buf_offset, buffer_info_t *bufferp, int isnew) if (isnew > 0 || (xor & ~HAMMER_BUFMASK64)) { rel_buffer(*bufferp); *bufferp = NULL; + } else { + hammer_cache_used(&(*bufferp)->cache); } } -- 2.11.4.GIT