]> git.ipfire.org Git - people/arne_f/kernel.git/commit
xfs: bulkstat chunk-formatter has issues
authorDave Chinner <dchinner@redhat.com>
Thu, 6 Nov 2014 21:30:58 +0000 (08:30 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 18:10:40 +0000 (10:10 -0800)
commita88cdfe5ad49b966914379bef61e0ac3cfe65a2c
tree6ba2062115f71d7fe87032afdab29f92bc898526
parent8ee218f083fc71c742d4319a43d73e791f3d0e8b
xfs: bulkstat chunk-formatter has issues

commit 2b831ac6bc87d3cbcbb1a8816827b6923403e461 upstream.

The loop construct has issues:
- clustidx is completely unused, so remove it.
- the loop tries to be smart by terminating when the
  "freecount" tells it that all inodes are free. Just drop
  it as in most cases we have to scan all inodes in the
  chunk anyway.
- move the "user buffer left" condition check to the only
  point where we consume space int eh user buffer.
- move the initialisation of agino out of the loop, leaving
  just a simple loop control logic using the clusteridx.

Also, double handling of the user buffer variables leads to problems
tracking the current state - use the cursor variables directly
rather than keeping local copies and then having to update the
cursor before returning.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_itable.c