Whamcloud - gitweb
3e1c779923290c5188c6a8153959ab91c12cb6fd
[doc/protocol.git] / struct_lov_mds_md.txt
1 MDS Lock Value Block
2 ^^^^^^^^^^^^^^^^^^^^
3 [[struct-lov-mds-md]]
4
5 The 'lov_mds_md' structure contains the layout of a resource.  In
6 replies to lock requests and other situations requiring layout
7 information from an MDT the 'lov_mds_md' information provides details
8 about the layout of a file across the OSTs.  There may be different
9 types of layouts for different files, either 'lov_mds_md_v1' or
10 'lov_mds_md_v3' as of Lustre 2.7, though they are very similar in
11 structure. In an intent request (as opposed to a reply and as yet
12 unimplemanted) it will modify the layout. It will not be included
13 (zero length) in requests in current releases.
14
15 [source,c]
16 ----
17 struct lov_mds_md_v1 {
18         __u32 lmm_magic;
19         __u32 lmm_pattern;
20         struct ost_id   lmm_oi;
21         __u32 lmm_stripe_size;
22         __u16 lmm_stripe_count;
23         __u16 lmm_layout_gen;
24         struct lov_ost_data_v1 lmm_objects[0];
25 };
26
27 struct lov_mds_md_v3 {
28         __u32 lmm_magic;
29         __u32 lmm_pattern;
30         struct ost_id   lmm_oi;
31         __u32 lmm_stripe_size;
32         __u16 lmm_stripe_count;
33         __u16 lmm_layout_gen;
34         char  lmm_pool_name[16];
35         struct lov_ost_data_v1 lmm_objects[0];
36 };
37 ----
38
39 The 'lmm_magic' field is filled in with the magic value that describes
40 the type of layout in use for a particular file.  The rest of the layout
41 structure may vary depending on the magic value, but the 'lmm_magic'
42 value must be the first member of any valid file layout.  The values
43 LOV_MAGIC_V1 (0x0BD10BD0) and LOV_MAGIC_V3 (0x0BD30BD0) are most
44 commonly used when the structure is in use. If the structure is in a
45 buffer of an RPC without the magic number in place, then the rest of
46 the structure is ignored.
47
48 The 'lmm_pattern' field describes the layout pattern within a particular
49 LOV_MAGIC layout type.  Currently in Lustre 2.7 the most common pattern
50 is LOV_PATTERN_RAID0 (0x001).  The high 16 bits of the 'lmm_pattern' field
51 may also contain flags that modify the layout. LOV_PATTERN_F_HOLE means
52 that there is a hole (missing object) within the layout, which is normally
53 caused by corruption or loss of the file layout that had to be rebuilt
54 by LFSCK.  LOV_PATTERN_F_RELEASED is used by HSM to indicate that the
55 file data is not resident in the filesystem, but rather in an external
56 archive, so the layout is only a stub that describes the layout to use
57 when the file is restored.
58
59 The 'lmm_oi' field gives the identifier of the MDT object to which this
60 file belongs.  See <<struct-ost-id>> for more details.
61
62 The 'lmm_stripe_size' field give the stripe size for the layout in bytes.
63 This is how many bytes will be on a particular OST object before going
64 to the next stripe.
65
66 The 'lmm_stripe_count' field gives how many OST objects the file is striped
67 over.
68
69 The 'lmm_layout_gen' field is updated as the layout of the obeject is
70 updated. If the 'lmm_layout_gen' is modified, then clients can detect
71 the layout has changed when refreshing the layout after having lost the
72 layout lock.
73
74 The 'lmm_pool_name' field is only in LOV_MAGIC_V3 layouts, and contains
75 the name of the OST pool used during the creation of the layout.
76
77 For instantiated layouts, 'lmm_objects' array contains 'lmm_stripe_count'
78 'lov_ost_data_v1' structures with the per-stripe data for each OST object
79 in the layout.  For uninstantiated layout templates, there will not be any
80 entries in the 'lmm_objects' array, which can be determined by the overall
81 layout size.
82
83 [source,c]
84 ----
85 struct lov_ost_data_v1 {          /* per-stripe data structure (little-endian)*/
86         struct ost_id l_ost_oi;   /* OST object ID */
87         __u32 l_ost_gen;          /* generation of this l_ost_idx */
88         __u32 l_ost_idx;          /* OST index in LOV (lov_tgt_desc->tgts) */
89 };
90 ----
91 [[struct-lov-ost-data-v1]]
92
93 The 'lov_ost_data_v1' structure is used for both LOV_MAGIC_V1 and
94 LOV_MAGIC_V3 types to describe the OST objects allocated to this
95 layout, one per object.
96
97 'l_ost_id' identifies the object on the OST specified by 'l_ost_idx'.
98 It may contain a OST object ID or a FID.  The 'l_ost_gen' field is
99 currently unused.
100
101 include::struct_ost_id.txt[]