• Steven Whitehouse's avatar
    GFS2: Cache last hash bucket for glock seq_files · ba1ddcb6
    Steven Whitehouse authored
    For the glocks and glstats seq_files, which are exposed via debugfs
    we should cache the most recent hash bucket, along with the offset
    into that bucket. This allows us to restart from that point, rather
    than having to begin at the beginning each time.
    This is an idea from Eric Dumazet, however I've slightly extended it
    so that if the position from which we are due to start is at any
    point beyond the last cached point, we start from the last cached
    point, plus whatever is the appropriate offset. I don't really expect
    people to be lseeking around these files, but if they did so with only
    positive offsets, then we'd still get some of the benefit of using a
    cached offset.
    With my simple test of around 200k entries in the file, I'm seeing
    an approx 10x speed up.
    Cc: Eric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
glock.c 51.4 KB