diff options
Diffstat (limited to 'drivers/md/dm-snap.c')
-rw-r--r-- | drivers/md/dm-snap.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 57f1bf7f3b7a..3a53a5a9bec8 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -296,6 +296,7 @@ static void __insert_origin(struct origin *o) | |||
296 | */ | 296 | */ |
297 | static int register_snapshot(struct dm_snapshot *snap) | 297 | static int register_snapshot(struct dm_snapshot *snap) |
298 | { | 298 | { |
299 | struct dm_snapshot *l; | ||
299 | struct origin *o, *new_o; | 300 | struct origin *o, *new_o; |
300 | struct block_device *bdev = snap->origin->bdev; | 301 | struct block_device *bdev = snap->origin->bdev; |
301 | 302 | ||
@@ -319,7 +320,11 @@ static int register_snapshot(struct dm_snapshot *snap) | |||
319 | __insert_origin(o); | 320 | __insert_origin(o); |
320 | } | 321 | } |
321 | 322 | ||
322 | list_add_tail(&snap->list, &o->snapshots); | 323 | /* Sort the list according to chunk size, largest-first smallest-last */ |
324 | list_for_each_entry(l, &o->snapshots, list) | ||
325 | if (l->store->chunk_size < snap->store->chunk_size) | ||
326 | break; | ||
327 | list_add_tail(&snap->list, &l->list); | ||
323 | 328 | ||
324 | up_write(&_origins_lock); | 329 | up_write(&_origins_lock); |
325 | return 0; | 330 | return 0; |