Whamcloud - gitweb
2b25d8be087500fcce18540aaf34759d8214ef13
[doc/protocol.git] / obd_statfs.txt
1 OBD Statfs
2 ^^^^^^^^^^
3 [[struct-obd-statfs]]
4
5 An 'obd_statfs' structure conveys file-system-wide information for the
6 back-end file system of a given target (MDT or OST).
7
8 ----
9 struct obd_statfs {
10         __u64  os_type;
11         __u64  os_blocks;
12         __u64  os_bfree;
13         __u64  os_bavail;
14         __u64  os_files;
15         __u64  os_ffree;
16         __u8   os_fsid[40];
17         __u32  os_bsize;
18         __u32  os_namelen;
19         __u64  os_maxbytes;
20         __u32  os_state;
21         __u32  os_fprecreated;
22         __u32  os_spare2;
23         __u32  os_spare3;
24         __u32  os_spare4;
25         __u32  os_spare5;
26         __u32  os_spare6;
27         __u32  os_spare7;
28         __u32  os_spare8;
29         __u32  os_spare9;
30 };
31 ----
32
33 Most of the fields correspond directly to the 'struct statfs' fields
34 returned by a 'statfs()' system call and have the same meaning. The
35 values are for the back-end storage of the target in question (MDT or
36 OST).
37
38 Teh 'os_type' field gives the type of the target's back-end file
39 system:
40
41 .Back-end file types ('os_type') for Lustre targets
42 [options="header"]
43 |====
44 | f_type                     | value
45 | EXT?_SUPER_MAGIC (ldiskfs) | 0xEF53
46 | ZFS_SUPER_MAGIC            | 0x2fc12fc1
47 |====
48
49 The 'os_blocks' field is the total number of blocks in the target, in
50 units of os_bsize.
51
52 The 'os_bfree' field is the number of blocks not currently in use.
53
54 The 'os_bavail' is the number of blocks available to be allocated to
55 new files.
56
57 The 'os_files' field is the total number of files on the target, both
58 allocated and free.  For some OSD types this is a static number, and
59 for others this is dynamic based on os_ffree and the amount of free
60 space.
61
62 The 'os_ffree' field is the current number of files that could be
63 created based on current usage.  For some OSD types this is a function
64 of the free space in the device and may increase or decrease as free
65 space changes.
66
67 The 'os_fsid' is intended to be the target backing device UUID in
68 ASCII format.  The current osd-ldiskfs and osd-zfs implementations
69 don't fill this in.
70
71 The 'os_bsize' field is the block size in bytes. This is for computing
72 the total, free, and available space in combination with os_blocks,
73 os_bfree, and os_bavail respectively.  It does not necessarily
74 represent the minimum or optimal IO size.
75
76 The 'os_namelen' field gives the maximum name length for files on the
77 back-end file system.
78
79 The 'os_maxbytes' field is the maximum size of a single object
80 (i.e. the maximum byte offset that can be written to).  This is the
81 same value as the 'ocd_maxbytes' field of the 'obd_connect_data'
82 structure.
83
84 The 'os_state' field encodes the status of the underlying back-end
85 file system. It can be:
86
87 .Back-end file system state
88 [options="header"]
89 |====
90 | os_state flag     | value
91 | OS_STATE_DEGRADED | 0x1
92 | OS_STATE_READONLY | 0x2
93 |====
94
95 In normal operation the 'os_state' value is returned as 0x0.  If the
96 back-end file system has a RAID configuration that is degraded or
97 rebuilding the state is returned with the OS_STATE_DEGRADED (0x1) flag
98 set. If the file system has been set to read-only, for whatever
99 reason, then the state is returned with the OS_STATE_READONLY (0x2)
100 flag set, for example if it was explicitly mounted read-only, or
101 corruption has been detected at runtime in the backing filesystem.
102
103 The 'os_fprecreated' field counts the number of pre-created objects
104 available on an OST. The 'os_fprecreated' value counts as "used"
105 inodes, so it reduces 'os_ffree'. Lustre places a hard limit of
106 2*OST_MAX_PRECREATE (2*20000) on the number of precreates it will
107 allow for an OST. There are currently no precreated objects on an MDT
108 so it is just 0 in that case.