From: Jonathan Brassow Coding style clean up of dm-snap[-persistent].c Signed-off-by: Jonathan Brassow Reviewed-by: Mikulas Patocka Reviewed-by: Mike Snitzer --- drivers/md/dm-snap-persistent.c | 8 ++++---- drivers/md/dm-snap.c | 28 ++++++++++++++++------------ 2 files changed, 20 insertions(+), 16 deletions(-) Index: linux-2.6.32-rc1/drivers/md/dm-snap-persistent.c =================================================================== --- linux-2.6.32-rc1.orig/drivers/md/dm-snap-persistent.c +++ linux-2.6.32-rc1/drivers/md/dm-snap-persistent.c @@ -420,7 +420,7 @@ static int insert_exceptions(struct psto int *full) { int r; - unsigned int i; + unsigned i; struct disk_exception de; /* presume the area is full */ @@ -535,7 +535,7 @@ static int persistent_read_metadata(stru ps->exceptions_per_area = (ps->store->chunk_size << SECTOR_SHIFT) / sizeof(struct disk_exception); ps->callbacks = dm_vcalloc(ps->exceptions_per_area, - sizeof(*ps->callbacks)); + sizeof(*ps->callbacks)); if (!ps->callbacks) return -ENOMEM; @@ -611,7 +611,7 @@ static void persistent_commit_exception( void (*callback) (void *, int success), void *callback_context) { - unsigned int i; + unsigned i; struct pstore *ps = get_info(store); struct disk_exception de; struct commit_callback *cb; @@ -642,7 +642,7 @@ static void persistent_commit_exception( * If we completely filled the current area, then wipe the next one. */ if ((ps->current_committed == ps->exceptions_per_area) && - zero_disk_area(ps, ps->current_area + 1)) + zero_disk_area(ps, ps->current_area + 1)) ps->valid = 0; /* Index: linux-2.6.32-rc1/drivers/md/dm-snap.c =================================================================== --- linux-2.6.32-rc1.orig/drivers/md/dm-snap.c +++ linux-2.6.32-rc1/drivers/md/dm-snap.c @@ -287,6 +287,7 @@ static struct origin *__lookup_origin(st static void __insert_origin(struct origin *o) { struct list_head *sl = &_origins[origin_hash(o->bdev)]; + list_add_tail(&o->hash_list, sl); } @@ -349,7 +350,7 @@ static void unregister_snapshot(struct d static int init_exception_table(struct exception_table *et, uint32_t size, unsigned hash_shift) { - unsigned int i; + unsigned i; et->hash_shift = hash_shift; et->hash_mask = size - 1; @@ -363,7 +364,8 @@ static int init_exception_table(struct e return 0; } -static void exit_exception_table(struct exception_table *et, struct kmem_cache *mem) +static void exit_exception_table(struct exception_table *et, + struct kmem_cache *mem) { struct list_head *slot; struct dm_snap_exception *ex, *next; @@ -389,6 +391,7 @@ static void insert_exception(struct exce struct dm_snap_exception *e) { struct list_head *l = &eh->table[exception_hash(eh, e->old_chunk)]; + list_add(&e->hash_list, l); } @@ -591,7 +594,7 @@ static int init_hash_tables(struct dm_sn /* * Construct a snapshot mapping:

*/ -static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) +static int snapshot_ctr(struct dm_target *ti, unsigned argc, char **argv) { struct dm_snapshot *s; int i; @@ -622,8 +625,7 @@ static int snapshot_ctr(struct dm_target s = kmalloc(sizeof(*s), GFP_KERNEL); if (!s) { - ti->error = "Cannot allocate snapshot context private " - "structure"; + ti->error = "Cannot allocate snapshot private structure"; r = -ENOMEM; goto bad_snap; } @@ -920,7 +922,7 @@ static void pending_complete(struct dm_s */ insert_completed_exception(s, e); - out: +out: remove_exception(&pe->e); snapshot_bios = bio_list_get(&pe->snapshot_bios); origin_bios = put_pending_exception(pe); @@ -983,7 +985,7 @@ static void start_copy(struct dm_snap_pe /* Hand over to kcopyd */ dm_kcopyd_copy(s->kcopyd_client, - &src, 1, &dest, 0, copy_callback, pe); + &src, 1, &dest, 0, copy_callback, pe); } static struct dm_snap_pending_exception * @@ -1133,9 +1135,9 @@ static int snapshot_map(struct dm_target map_context->ptr = track_chunk(s, chunk); } - out_unlock: +out_unlock: up_write(&s->lock); - out: +out: return r; } @@ -1161,7 +1163,7 @@ static void snapshot_resume(struct dm_ta } static int snapshot_status(struct dm_target *ti, status_type_t type, - char *result, unsigned int maxlen) + char *result, unsigned maxlen) { unsigned sz = 0; struct dm_snapshot *snap = ti->private; @@ -1359,7 +1361,7 @@ static int do_origin(struct dm_dev *orig * The context for an origin is merely a 'struct dm_dev *' * pointing to the real device. */ -static int origin_ctr(struct dm_target *ti, unsigned int argc, char **argv) +static int origin_ctr(struct dm_target *ti, unsigned argc, char **argv) { int r; struct dm_dev *dev; @@ -1385,6 +1387,7 @@ static int origin_ctr(struct dm_target * static void origin_dtr(struct dm_target *ti) { struct dm_dev *dev = ti->private; + dm_put_device(ti, dev); } @@ -1392,6 +1395,7 @@ static int origin_map(struct dm_target * union map_info *map_context) { struct dm_dev *dev = ti->private; + bio->bi_bdev = dev->bdev; if (unlikely(bio_empty_barrier(bio))) @@ -1417,7 +1421,7 @@ static void origin_resume(struct dm_targ } static int origin_status(struct dm_target *ti, status_type_t type, char *result, - unsigned int maxlen) + unsigned maxlen) { struct dm_dev *dev = ti->private;