dm.c (d58168763f74d1edbc296d7038c60efe6493fdd4) dm.c (784aae735d9b0bba3f8b9faef4c8b30df3bf0128)
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"
9#include "dm-bio-list.h"
10#include "dm-uevent.h"
11

--- 150 unchanged lines hidden (view full) ---

162 /*
163 * freeze/thaw support require holding onto a super block
164 */
165 struct super_block *frozen_sb;
166 struct block_device *suspended_bdev;
167
168 /* forced geometry settings */
169 struct hd_geometry geometry;
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"
9#include "dm-bio-list.h"
10#include "dm-uevent.h"
11

--- 150 unchanged lines hidden (view full) ---

162 /*
163 * freeze/thaw support require holding onto a super block
164 */
165 struct super_block *frozen_sb;
166 struct block_device *suspended_bdev;
167
168 /* forced geometry settings */
169 struct hd_geometry geometry;
170
171 /* sysfs handle */
172 struct kobject kobj;
170};
171
172#define MIN_IOS 256
173static struct kmem_cache *_io_cache;
174static struct kmem_cache *_tio_cache;
175static struct kmem_cache *_rq_tio_cache;
176static struct kmem_cache *_rq_bio_info_cache;
177

--- 1102 unchanged lines hidden (view full) ---

1280int dm_create(int minor, struct mapped_device **result)
1281{
1282 struct mapped_device *md;
1283
1284 md = alloc_dev(minor);
1285 if (!md)
1286 return -ENXIO;
1287
173};
174
175#define MIN_IOS 256
176static struct kmem_cache *_io_cache;
177static struct kmem_cache *_tio_cache;
178static struct kmem_cache *_rq_tio_cache;
179static struct kmem_cache *_rq_bio_info_cache;
180

--- 1102 unchanged lines hidden (view full) ---

1283int dm_create(int minor, struct mapped_device **result)
1284{
1285 struct mapped_device *md;
1286
1287 md = alloc_dev(minor);
1288 if (!md)
1289 return -ENXIO;
1290
1291 dm_sysfs_init(md);
1292
1288 *result = md;
1289 return 0;
1290}
1291
1292static struct mapped_device *dm_find_md(dev_t dev)
1293{
1294 struct mapped_device *md;
1295 unsigned minor = MINOR(dev);

--- 59 unchanged lines hidden (view full) ---

1355 idr_replace(&_minor_idr, MINOR_ALLOCED,
1356 MINOR(disk_devt(dm_disk(md))));
1357 set_bit(DMF_FREEING, &md->flags);
1358 spin_unlock(&_minor_lock);
1359 if (!dm_suspended(md)) {
1360 dm_table_presuspend_targets(map);
1361 dm_table_postsuspend_targets(map);
1362 }
1293 *result = md;
1294 return 0;
1295}
1296
1297static struct mapped_device *dm_find_md(dev_t dev)
1298{
1299 struct mapped_device *md;
1300 unsigned minor = MINOR(dev);

--- 59 unchanged lines hidden (view full) ---

1360 idr_replace(&_minor_idr, MINOR_ALLOCED,
1361 MINOR(disk_devt(dm_disk(md))));
1362 set_bit(DMF_FREEING, &md->flags);
1363 spin_unlock(&_minor_lock);
1364 if (!dm_suspended(md)) {
1365 dm_table_presuspend_targets(map);
1366 dm_table_postsuspend_targets(map);
1367 }
1368 dm_sysfs_exit(md);
1363 dm_table_put(map);
1364 __unbind(md);
1365 free_dev(md);
1366 }
1367}
1368EXPORT_SYMBOL_GPL(dm_put);
1369
1370static int dm_wait_for_completion(struct mapped_device *md)

--- 323 unchanged lines hidden (view full) ---

1694 * The gendisk is only valid as long as you have a reference
1695 * count on 'md'.
1696 */
1697struct gendisk *dm_disk(struct mapped_device *md)
1698{
1699 return md->disk;
1700}
1701
1369 dm_table_put(map);
1370 __unbind(md);
1371 free_dev(md);
1372 }
1373}
1374EXPORT_SYMBOL_GPL(dm_put);
1375
1376static int dm_wait_for_completion(struct mapped_device *md)

--- 323 unchanged lines hidden (view full) ---

1700 * The gendisk is only valid as long as you have a reference
1701 * count on 'md'.
1702 */
1703struct gendisk *dm_disk(struct mapped_device *md)
1704{
1705 return md->disk;
1706}
1707
1708struct kobject *dm_kobject(struct mapped_device *md)
1709{
1710 return &md->kobj;
1711}
1712
1713/*
1714 * struct mapped_device should not be exported outside of dm.c
1715 * so use this check to verify that kobj is part of md structure
1716 */
1717struct mapped_device *dm_get_from_kobject(struct kobject *kobj)
1718{
1719 struct mapped_device *md;
1720
1721 md = container_of(kobj, struct mapped_device, kobj);
1722 if (&md->kobj != kobj)
1723 return NULL;
1724
1725 dm_get(md);
1726 return md;
1727}
1728
1702int dm_suspended(struct mapped_device *md)
1703{
1704 return test_bit(DMF_SUSPENDED, &md->flags);
1705}
1706
1707int dm_noflush_suspending(struct dm_target *ti)
1708{
1709 struct mapped_device *md = dm_table_get_md(ti->table);

--- 29 unchanged lines hidden ---
1729int dm_suspended(struct mapped_device *md)
1730{
1731 return test_bit(DMF_SUSPENDED, &md->flags);
1732}
1733
1734int dm_noflush_suspending(struct dm_target *ti)
1735{
1736 struct mapped_device *md = dm_table_get_md(ti->table);

--- 29 unchanged lines hidden ---