Lines Matching defs:lvm

52 	struct lv_map *lvm;
64 if (!(lvm = dm_pool_alloc(mem, sizeof(*lvm))))
67 lvm->lv = ll->lv;
68 if (!(lvm->map = dm_pool_zalloc(mem, sizeof(*lvm->map)
72 if (!dm_hash_insert(maps, ll->lv->name, lvm))
87 struct lv_map *lvm;
92 if (!(lvm = dm_hash_lookup(maps, strrchr((char *)ll->lvd.lv_name, '/')
100 lvm->stripes = ll->lvd.lv_stripes;
101 lvm->stripe_size = ll->lvd.lv_stripesize;
103 lvs[ll->lvd.lv_number] = lvm;
114 struct lv_map *lvms[MAX_LV], *lvm;
134 lvm = lvms[lv_num];
136 if (!lvm) {
148 if (le >= lvm->lv->le_count) {
154 if (lvm->map[le].pv) {
160 lvm->map[le].pv = pv;
161 lvm->map[le].pe = i;
169 static int _check_single_map(struct lv_map *lvm)
173 for (i = 0; i < lvm->lv->le_count; i++) {
174 if (!lvm->map[i].pv) {
176 "mapping table.", lvm->lv->name);
187 struct lv_map *lvm;
190 lvm = (struct lv_map *) dm_hash_get_data(maps, n);
192 if (!_check_single_map(lvm))
198 static uint32_t _area_length(struct lv_map *lvm, uint32_t le)
204 while ((lvm->map[le + len].pv == lvm->map[le].pv) &&
205 (lvm->map[le].pv &&
206 lvm->map[le + len].pe == lvm->map[le].pe + len));
211 static int _read_linear(struct cmd_context *cmd, struct lv_map *lvm)
220 while (le < lvm->lv->le_count) {
221 len = _area_length(lvm, le);
223 if (!(seg = alloc_lv_segment(cmd->mem, segtype, lvm->lv, le,
229 if (!set_lv_segment_area_pv(seg, 0, lvm->map[le].pv,
230 lvm->map[le].pe))
233 dm_list_add(&lvm->lv->segments, &seg->list);
241 static int _check_stripe(struct lv_map *lvm, uint32_t area_count,
251 if ((lvm->map[base_le + st * total_area_len + area_len].pv !=
252 lvm->map[base_le + st * total_area_len].pv) ||
253 (lvm->map[base_le + st * total_area_len].pv &&
254 lvm->map[base_le + st * total_area_len + area_len].pe !=
255 lvm->map[base_le + st * total_area_len].pe + area_len))
261 static int _read_stripes(struct cmd_context *cmd, struct lv_map *lvm)
271 if (lvm->lv->le_count % lvm->stripes) {
274 lvm->stripes, lvm->lv->le_count, lvm->lv->name);
277 total_area_len = lvm->lv->le_count / lvm->stripes;
289 while (_check_stripe(lvm, lvm->stripes,
293 if (!(seg = alloc_lv_segment(cmd->mem, segtype, lvm->lv,
294 lvm->stripes * first_area_le,
295 lvm->stripes * area_len,
296 0, lvm->stripe_size, NULL,
297 lvm->stripes,
308 lvm->map[first_area_le + st * total_area_len].pv,
309 lvm->map[first_area_le + st * total_area_len].pe))
312 dm_list_add(&lvm->lv->segments, &seg->list);
320 static int _build_segments(struct cmd_context *cmd, struct lv_map *lvm)
322 return (lvm->stripes > 1 ? _read_stripes(cmd, lvm) :
323 _read_linear(cmd, lvm));
329 struct lv_map *lvm;
332 lvm = (struct lv_map *) dm_hash_get_data(maps, n);
333 if (!_build_segments(cmd, lvm))