Lines Matching defs:smd
37 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
39 kfree(smd);
44 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
46 return sm_ll_extend(&smd->ll, extra_blocks);
51 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
53 *count = smd->old_ll.nr_blocks;
60 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
62 *count = (smd->old_ll.nr_blocks - smd->old_ll.nr_allocated) - smd->nr_allocated_this_transaction;
70 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
72 return sm_ll_lookup(&smd->ll, b, result);
95 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
97 r = sm_ll_insert(&smd->ll, b, count, &nr_allocations);
99 smd->nr_allocated_this_transaction += nr_allocations;
108 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
110 r = sm_ll_inc(&smd->ll, b, e, &nr_allocations);
112 smd->nr_allocated_this_transaction += nr_allocations;
121 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
123 r = sm_ll_dec(&smd->ll, b, e, &nr_allocations);
125 smd->nr_allocated_this_transaction += nr_allocations;
134 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
139 r = sm_ll_find_common_free_block(&smd->old_ll, &smd->ll, smd->begin, smd->ll.nr_blocks, b);
142 * There's no free block between smd->begin and the end of the metadata device.
143 * We search before smd->begin in case something has been freed.
145 r = sm_ll_find_common_free_block(&smd->old_ll, &smd->ll, 0, smd->begin, b);
150 smd->begin = *b + 1;
151 r = sm_ll_inc(&smd->ll, *b, *b + 1, &nr_allocations);
153 smd->nr_allocated_this_transaction += nr_allocations;
161 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
163 r = sm_ll_commit(&smd->ll);
167 memcpy(&smd->old_ll, &smd->ll, sizeof(smd->old_ll));
168 smd->nr_allocated_this_transaction = 0;
182 struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
185 root_le.nr_blocks = cpu_to_le64(smd->ll.nr_blocks);
186 root_le.nr_allocated = cpu_to_le64(smd->ll.nr_allocated);
187 root_le.bitmap_root = cpu_to_le64(smd->ll.bitmap_root);
188 root_le.ref_count_root = cpu_to_le64(smd->ll.ref_count_root);
221 struct sm_disk *smd;
223 smd = kmalloc(sizeof(*smd), GFP_KERNEL);
224 if (!smd)
227 smd->begin = 0;
228 smd->nr_allocated_this_transaction = 0;
229 memcpy(&smd->sm, &ops, sizeof(smd->sm));
231 r = sm_ll_new_disk(&smd->ll, tm);
235 r = sm_ll_extend(&smd->ll, nr_blocks);
239 r = sm_disk_commit(&smd->sm);
243 return &smd->sm;
246 kfree(smd);
255 struct sm_disk *smd;
257 smd = kmalloc(sizeof(*smd), GFP_KERNEL);
258 if (!smd)
261 smd->begin = 0;
262 smd->nr_allocated_this_transaction = 0;
263 memcpy(&smd->sm, &ops, sizeof(smd->sm));
265 r = sm_ll_open_disk(&smd->ll, tm, root_le, len);
269 r = sm_disk_commit(&smd->sm);
273 return &smd->sm;
276 kfree(smd);