aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ocfs2_ioctl.h
diff options
context:
space:
mode:
authorTristan Ye <tristan.ye@oracle.com>2011-05-24 03:27:17 -0400
committerTristan Ye <tristan.ye@oracle.com>2011-05-25 00:18:07 -0400
commitd24a10b9f8ed548981696cd36e2b4f16e6f360b1 (patch)
tree4189d2be951b63a6ff480fdabd031605ce342e92 /fs/ocfs2/ocfs2_ioctl.h
parent3e5db17d4da7f45c454940096d9e429cca12ef9f (diff)
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>
Diffstat (limited to 'fs/ocfs2/ocfs2_ioctl.h')
-rw-r--r--fs/ocfs2/ocfs2_ioctl.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/ocfs2/ocfs2_ioctl.h b/fs/ocfs2/ocfs2_ioctl.h
index 6b4b39a83662..18b6770dc468 100644
--- a/fs/ocfs2/ocfs2_ioctl.h
+++ b/fs/ocfs2/ocfs2_ioctl.h
@@ -152,6 +152,28 @@ struct ocfs2_info_freeinode {
152 __u32 ifi_pad; 152 __u32 ifi_pad;
153}; 153};
154 154
155#define OCFS2_INFO_MAX_HIST (32)
156
157struct ocfs2_info_freefrag {
158 struct ocfs2_info_request iff_req;
159 struct ocfs2_info_freefrag_stats { /* (out) */
160 struct ocfs2_info_free_chunk_list {
161 __u32 fc_chunks[OCFS2_INFO_MAX_HIST];
162 __u32 fc_clusters[OCFS2_INFO_MAX_HIST];
163 } ffs_fc_hist;
164 __u32 ffs_clusters;
165 __u32 ffs_free_clusters;
166 __u32 ffs_free_chunks;
167 __u32 ffs_free_chunks_real;
168 __u32 ffs_min; /* Minimum free chunksize in clusters */
169 __u32 ffs_max;
170 __u32 ffs_avg;
171 __u32 ffs_pad;
172 } iff_ffs;
173 __u32 iff_chunksize; /* chunksize in clusters(in) */
174 __u32 iff_pad;
175};
176
155/* Codes for ocfs2_info_request */ 177/* Codes for ocfs2_info_request */
156enum ocfs2_info_type { 178enum ocfs2_info_type {
157 OCFS2_INFO_CLUSTERSIZE = 1, 179 OCFS2_INFO_CLUSTERSIZE = 1,
@@ -162,6 +184,7 @@ enum ocfs2_info_type {
162 OCFS2_INFO_FS_FEATURES, 184 OCFS2_INFO_FS_FEATURES,
163 OCFS2_INFO_JOURNAL_SIZE, 185 OCFS2_INFO_JOURNAL_SIZE,
164 OCFS2_INFO_FREEINODE, 186 OCFS2_INFO_FREEINODE,
187 OCFS2_INFO_FREEFRAG,
165 OCFS2_INFO_NUM_TYPES 188 OCFS2_INFO_NUM_TYPES
166}; 189};
167 190