]> Pileus Git - ~andy/linux/commit
Ocfs2: Add a new code 'OCFS2_INFO_FREEFRAG' for o2info ioctl.
authorTristan Ye <tristan.ye@oracle.com>
Tue, 24 May 2011 07:27:17 +0000 (15:27 +0800)
committerTristan Ye <tristan.ye@oracle.com>
Wed, 25 May 2011 04:18:07 +0000 (12:18 +0800)
commitd24a10b9f8ed548981696cd36e2b4f16e6f360b1
tree4189d2be951b63a6ff480fdabd031605ce342e92
parent3e5db17d4da7f45c454940096d9e429cca12ef9f
Ocfs2: Add a new code 'OCFS2_INFO_FREEFRAG' for o2info ioctl.

This new code is a bit more complicated than former ones, the goal is to
show user all statistics required to take a deep insight into filesystem
on how the disk is being fragmentaed.

The goal is achieved by scaning global bitmap from (cluster)group to group
to figure out following factors in the filesystem:

        - How many free chunks in a fixed size as user requested.
        - How many real free chunks in all size.
        - Min/Max/Avg size(in) clusters of free chunks.
        - How do free chunks distribute(in size) in terms of a histogram,
          just like following:
          ---------------------------------------------------------
          Extent Size Range :  Free extents  Free Clusters  Percent
             32K...   64K-  :             1             1    0.00%
              1M...    2M-  :             9           288    0.03%
              8M...   16M-  :             2           831    0.09%
             32M...   64M-  :             1          2047    0.23%
            128M...  256M-  :             1          8191    0.92%
            256M...  512M-  :             2         21706    2.43%
            512M... 1024M-  :            27        858623   96.29%
          ---------------------------------------------------------

Userspace ioctl() call eventually gets the above info returned by passing
a 'struct ocfs2_info_freefrag' with the chunk_size being specified first.

Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
fs/ocfs2/ioctl.c
fs/ocfs2/ocfs2_ioctl.h