@@ -121,88 +121,6 @@ struct async_submit_bio {
121
121
blk_status_t status ;
122
122
};
123
123
124
- /*
125
- * Lockdep class keys for extent_buffer->lock's in this root. For a given
126
- * eb, the lockdep key is determined by the btrfs_root it belongs to and
127
- * the level the eb occupies in the tree.
128
- *
129
- * Different roots are used for different purposes and may nest inside each
130
- * other and they require separate keysets. As lockdep keys should be
131
- * static, assign keysets according to the purpose of the root as indicated
132
- * by btrfs_root->root_key.objectid. This ensures that all special purpose
133
- * roots have separate keysets.
134
- *
135
- * Lock-nesting across peer nodes is always done with the immediate parent
136
- * node locked thus preventing deadlock. As lockdep doesn't know this, use
137
- * subclass to avoid triggering lockdep warning in such cases.
138
- *
139
- * The key is set by the readpage_end_io_hook after the buffer has passed
140
- * csum validation but before the pages are unlocked. It is also set by
141
- * btrfs_init_new_buffer on freshly allocated blocks.
142
- *
143
- * We also add a check to make sure the highest level of the tree is the
144
- * same as our lockdep setup here. If BTRFS_MAX_LEVEL changes, this code
145
- * needs update as well.
146
- */
147
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
148
- # if BTRFS_MAX_LEVEL != 8
149
- # error
150
- # endif
151
-
152
- #define DEFINE_LEVEL (stem , level ) \
153
- .names[level] = "btrfs-" stem "-0" #level,
154
-
155
- #define DEFINE_NAME (stem ) \
156
- DEFINE_LEVEL(stem, 0) \
157
- DEFINE_LEVEL(stem, 1) \
158
- DEFINE_LEVEL(stem, 2) \
159
- DEFINE_LEVEL(stem, 3) \
160
- DEFINE_LEVEL(stem, 4) \
161
- DEFINE_LEVEL(stem, 5) \
162
- DEFINE_LEVEL(stem, 6) \
163
- DEFINE_LEVEL(stem, 7)
164
-
165
- static struct btrfs_lockdep_keyset {
166
- u64 id ; /* root objectid */
167
- /* Longest entry: btrfs-free-space-00 */
168
- char names [BTRFS_MAX_LEVEL ][20 ];
169
- struct lock_class_key keys [BTRFS_MAX_LEVEL ];
170
- } btrfs_lockdep_keysets [] = {
171
- { .id = BTRFS_ROOT_TREE_OBJECTID , DEFINE_NAME ("root" ) },
172
- { .id = BTRFS_EXTENT_TREE_OBJECTID , DEFINE_NAME ("extent" ) },
173
- { .id = BTRFS_CHUNK_TREE_OBJECTID , DEFINE_NAME ("chunk" ) },
174
- { .id = BTRFS_DEV_TREE_OBJECTID , DEFINE_NAME ("dev" ) },
175
- { .id = BTRFS_CSUM_TREE_OBJECTID , DEFINE_NAME ("csum" ) },
176
- { .id = BTRFS_QUOTA_TREE_OBJECTID , DEFINE_NAME ("quota" ) },
177
- { .id = BTRFS_TREE_LOG_OBJECTID , DEFINE_NAME ("log" ) },
178
- { .id = BTRFS_TREE_RELOC_OBJECTID , DEFINE_NAME ("treloc" ) },
179
- { .id = BTRFS_DATA_RELOC_TREE_OBJECTID , DEFINE_NAME ("dreloc" ) },
180
- { .id = BTRFS_UUID_TREE_OBJECTID , DEFINE_NAME ("uuid" ) },
181
- { .id = BTRFS_FREE_SPACE_TREE_OBJECTID , DEFINE_NAME ("free-space" ) },
182
- { .id = 0 , DEFINE_NAME ("tree" ) },
183
- };
184
-
185
- #undef DEFINE_LEVEL
186
- #undef DEFINE_NAME
187
-
188
- void btrfs_set_buffer_lockdep_class (u64 objectid , struct extent_buffer * eb ,
189
- int level )
190
- {
191
- struct btrfs_lockdep_keyset * ks ;
192
-
193
- BUG_ON (level >= ARRAY_SIZE (ks -> keys ));
194
-
195
- /* find the matching keyset, id 0 is the default entry */
196
- for (ks = btrfs_lockdep_keysets ; ks -> id ; ks ++ )
197
- if (ks -> id == objectid )
198
- break ;
199
-
200
- lockdep_set_class_and_name (& eb -> lock ,
201
- & ks -> keys [level ], ks -> names [level ]);
202
- }
203
-
204
- #endif
205
-
206
124
/*
207
125
* Compute the csum of a btree block and store the result to provided buffer.
208
126
*/
0 commit comments