gfs2: Add read/write page 'fault_stats'

Since merge c03098d4b9ad7, gfs2 has page faults disabled when reading
from and writing to user-space buffers.  When parts of those buffers are
not resident, we allow the inode glock to be stolen while faulting those
buffers in.  This is necessary for deadlock avoidance.  This can lead to
the following change in behavior:

* A small amount of performance degradation when memory is highly
  fragmented.

* Lock contention will now more commonly lead to short buffered
  reads and writes, which must be handled in user space.

* During direct I/O reads and writes, again on lock contention,
  the inode glock may be dropped and re-acquired.  Direct I/O
  was never guaranteed to be atomic with respect to other read /
  write operations, but the above merge allows for even more
  non-atomicity.

To allow diagnosing problems with those changes more easily, add a
'fault_stats' debugfs file with the following statistics:

    read 0 0 0 0
    write 0 0 0 0

In each line, the first pair of numbers refers to buffered I/O while the
second pair refers to direct I/O.  In each pair, the first number is the
number of times pages were faulted in.  The second number in each line
is the number of short operations (i.e., the inode glock was lost before
the entire operation could be completed).  The fourth number in each
line is the number of "split" operations (i.e., the inode glock wasn't
held over the duration of the entire operation).

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
4 files changed