: dm-exception-store-move-chunk_fields.patch
PATCH 1/1 : dm-exception-store-move-chunk_fields.patch
brassow
Move chunk fields from snapshot to exception store.
Signed-off-by Jonathan Brassow <[email protected]>
drivers/md/dm-exception-store.c +6 -0
@@ -143,6 +143,8 @@ int dm_exception_store_type_unregister(sEXPORT_SYMBOL (dm_exception_store_type_unregister);int dm_exception_store_create (const char *type_name,struct dm_target *ti, +chunk_t chunk_size,chunk_t chunk_mask, +chunk_t chunk_shift,struct dm_exception_store **store) {int r =0 ;
@@ -162,6 +164,10 @@ int dm_exception_store_create(const char tmp_store->type = type; tmp_store->ti = ti; + tmp_store->chunk_size = chunk_size; + tmp_store->chunk_mask = chunk_mask; + tmp_store->chunk_shift = chunk_shift; + r = type->ctr (tmp_store,0 ,NULL );if (r) {put_type (type);
drivers/md/dm-exception-store.h +7 -0
@@ -99,6 +99,11 @@ struct dm_exception_store {struct dm_snapshot *snap; +/* Size of data blocks saved - must be a power of 2 */ +chunk_t chunk_size; +chunk_t chunk_mask; +chunk_t chunk_shift; +void *context; };
@@ -149,6 +154,8 @@ int dm_exception_store_type_register(strint dm_exception_store_type_unregister (struct dm_exception_store_type *type);int dm_exception_store_create (const char *type_name,struct dm_target *ti, +chunk_t chunk_size,chunk_t chunk_mask, +chunk_t chunk_shift,struct dm_exception_store **store);void dm_exception_store_destroy (struct dm_exception_store *store);
drivers/md/dm-snap-persistent.c +22 -22
124 lines not on this page · raw message
drivers/md/dm-snap-transient.c +2 -2
@@ -42,11 +42,11 @@ static int transient_prepare_exception(sstruct transient_c *tc = store->context;sector_t size =get_dev_size (store->snap->cow->bdev); -if (size < (tc->next_free + store->snap->chunk_size)) +if (size < (tc->next_free + store->chunk_size))return -1 ; e->new_chunk =sector_to_chunk (store->snap, tc->next_free); - tc->next_free += store->snap->chunk_size; + tc->next_free += store->chunk_size;return 0 ; }
drivers/md/dm-snap.c +24 -20
141 lines not on this page · raw message
drivers/md/dm-snap.h +2 -7
@@ -32,11 +32,6 @@ struct dm_snapshot {/* List of snapshots per Origin */ struct list_head list; -/* Size of data blocks saved - must be a power of 2 */ -chunk_t chunk_size; -chunk_t chunk_mask; -chunk_t chunk_shift; -/* You can't use a snapshot if this is 0 (e.g. if full) */ int valid;
@@ -84,12 +79,12 @@ static inline sector_t get_dev_size(strustatic inline chunk_t sector_to_chunk (struct dm_snapshot *s,sector_t sector) { -return (sector & ~s->chunk_mask) >> s->chunk_shift; +return (sector & ~s->store->chunk_mask) >> s->store->chunk_shift; }static inline sector_t chunk_to_sector (struct dm_snapshot *s,chunk_t chunk) { -return chunk << s->chunk_shift; +return chunk << s->store->chunk_shift; }static inline int bdev_equal (struct block_device *lhs,struct block_device *rhs)