aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorJon Brassow <jbrassow@redhat.com>2009-12-10 18:52:09 -0500
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 18:52:09 -0500
commitd32a6ea65fbc33621f9c790da3dff10201640b2a (patch)
treea352ceb4ed92812bda57dd33806417da84adbc7b /drivers/md
parent7e201b35132a1f02c931a0a06760766c846bb49b (diff)
dm snapshot: consolidate insert exception functions
Consolidate the insert_*exception functions. 'insert_completed_exception' already contains all the logic to handle 'insert_exception' (via check for a hash_shift of 0), so remove redundant function. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-snap.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 48978ab42ae5..9135498213ef 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -390,13 +390,6 @@ static uint32_t exception_hash(struct exception_table *et, chunk_t chunk)
390 return (chunk >> et->hash_shift) & et->hash_mask; 390 return (chunk >> et->hash_shift) & et->hash_mask;
391} 391}
392 392
393static void insert_exception(struct exception_table *eh,
394 struct dm_snap_exception *e)
395{
396 struct list_head *l = &eh->table[exception_hash(eh, e->old_chunk)];
397 list_add(&e->hash_list, l);
398}
399
400static void remove_exception(struct dm_snap_exception *e) 393static void remove_exception(struct dm_snap_exception *e)
401{ 394{
402 list_del(&e->hash_list); 395 list_del(&e->hash_list);
@@ -457,10 +450,9 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe)
457 atomic_dec(&s->pending_exceptions_count); 450 atomic_dec(&s->pending_exceptions_count);
458} 451}
459 452
460static void insert_completed_exception(struct dm_snapshot *s, 453static void insert_exception(struct exception_table *eh,
461 struct dm_snap_exception *new_e) 454 struct dm_snap_exception *new_e)
462{ 455{
463 struct exception_table *eh = &s->complete;
464 struct list_head *l; 456 struct list_head *l;
465 struct dm_snap_exception *e = NULL; 457 struct dm_snap_exception *e = NULL;
466 458
@@ -518,7 +510,7 @@ static int dm_add_exception(void *context, chunk_t old, chunk_t new)
518 /* Consecutive_count is implicitly initialised to zero */ 510 /* Consecutive_count is implicitly initialised to zero */
519 e->new_chunk = new; 511 e->new_chunk = new;
520 512
521 insert_completed_exception(s, e); 513 insert_exception(&s->complete, e);
522 514
523 return 0; 515 return 0;
524} 516}
@@ -925,7 +917,7 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success)
925 * Add a proper exception, and remove the 917 * Add a proper exception, and remove the
926 * in-flight exception from the list. 918 * in-flight exception from the list.
927 */ 919 */
928 insert_completed_exception(s, e); 920 insert_exception(&s->complete, e);
929 921
930 out: 922 out:
931 remove_exception(&pe->e); 923 remove_exception(&pe->e);