12 #include <linux/export.h>
13 #include <linux/slab.h>
16 #define DM_MSG_PREFIX "transaction manager"
29 #define HASH_MASK (HASH_SIZE - 1)
47 unsigned bucket = dm_hash_block(b,
HASH_MASK);
57 spin_unlock(&tm->
lock);
77 spin_unlock(&tm->
lock);
97 spin_unlock(&tm->lock);
141 wipe_shadow_table(tm);
154 r = dm_sm_commit(tm->
sm);
167 wipe_shadow_table(tm);
183 r = dm_sm_new_block(tm->
sm, &new_block);
189 dm_sm_dec_block(tm->
sm, new_block);
197 insert_shadow(tm, new_block);
208 struct dm_block *orig_block;
210 r = dm_sm_new_block(tm->
sm, &
new);
214 r = dm_sm_dec_block(tm->
sm, orig);
251 r = dm_sm_count_is_more_than_one(tm->
sm, orig, inc_children);
255 if (is_shadow(tm, orig) && !*inc_children)
258 r = __shadow_block(tm, orig, v, result);
269 struct dm_block **
blk)
291 dm_sm_inc_block(tm->
sm, b);
302 dm_sm_dec_block(tm->
sm, b);
312 return dm_sm_get_count(tm->
sm, b, result);
327 void *sm_root,
size_t sm_len)
335 *tm = dm_tm_create(bm, *sm);
345 DMERR(
"couldn't create metadata space map");
352 DMERR(
"couldn't open metadata space map");
369 return dm_tm_create_internal(bm, sb_location, tm, sm, 1,
NULL, 0);
374 void *sm_root,
size_t root_len,
378 return dm_tm_create_internal(bm, sb_location, tm, sm, 0, sm_root, root_len);