dm.c (026477c1141b67e98e3bd8bdedb7d4b88a3ecd09) | dm.c (aa129a2247b164173d45da8ad43cca5de9211403) |
---|---|
1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 6 unchanged lines hidden (view full) --- 15#include <linux/blkpg.h> 16#include <linux/bio.h> 17#include <linux/buffer_head.h> 18#include <linux/mempool.h> 19#include <linux/slab.h> 20#include <linux/idr.h> 21#include <linux/hdreg.h> 22#include <linux/blktrace_api.h> | 1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 6 unchanged lines hidden (view full) --- 15#include <linux/blkpg.h> 16#include <linux/bio.h> 17#include <linux/buffer_head.h> 18#include <linux/mempool.h> 19#include <linux/slab.h> 20#include <linux/idr.h> 21#include <linux/hdreg.h> 22#include <linux/blktrace_api.h> |
23#include <linux/smp_lock.h> |
|
23 24#define DM_MSG_PREFIX "core" 25 26static const char *_name = DM_NAME; 27 28static unsigned int major = 0; 29static unsigned int _major = 0; 30 --- 252 unchanged lines hidden (view full) --- 283 284static int dm_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo) 285{ 286 struct mapped_device *md = bdev->bd_disk->private_data; 287 288 return dm_get_geometry(md, geo); 289} 290 | 24 25#define DM_MSG_PREFIX "core" 26 27static const char *_name = DM_NAME; 28 29static unsigned int major = 0; 30static unsigned int _major = 0; 31 --- 252 unchanged lines hidden (view full) --- 284 285static int dm_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo) 286{ 287 struct mapped_device *md = bdev->bd_disk->private_data; 288 289 return dm_get_geometry(md, geo); 290} 291 |
292static int dm_blk_ioctl(struct inode *inode, struct file *file, 293 unsigned int cmd, unsigned long arg) 294{ 295 struct mapped_device *md; 296 struct dm_table *map; 297 struct dm_target *tgt; 298 int r = -ENOTTY; 299 300 /* We don't really need this lock, but we do need 'inode'. */ 301 unlock_kernel(); 302 303 md = inode->i_bdev->bd_disk->private_data; 304 305 map = dm_get_table(md); 306 307 if (!map || !dm_table_get_size(map)) 308 goto out; 309 310 /* We only support devices that have a single target */ 311 if (dm_table_get_num_targets(map) != 1) 312 goto out; 313 314 tgt = dm_table_get_target(map, 0); 315 316 if (dm_suspended(md)) { 317 r = -EAGAIN; 318 goto out; 319 } 320 321 if (tgt->type->ioctl) 322 r = tgt->type->ioctl(tgt, inode, file, cmd, arg); 323 324out: 325 dm_table_put(map); 326 327 lock_kernel(); 328 return r; 329} 330 |
|
291static inline struct dm_io *alloc_io(struct mapped_device *md) 292{ 293 return mempool_alloc(md->io_pool, GFP_NOIO); 294} 295 296static inline void free_io(struct mapped_device *md, struct dm_io *io) 297{ 298 mempool_free(io, md->io_pool); --- 1073 unchanged lines hidden (view full) --- 1372int dm_suspended(struct mapped_device *md) 1373{ 1374 return test_bit(DMF_SUSPENDED, &md->flags); 1375} 1376 1377static struct block_device_operations dm_blk_dops = { 1378 .open = dm_blk_open, 1379 .release = dm_blk_close, | 331static inline struct dm_io *alloc_io(struct mapped_device *md) 332{ 333 return mempool_alloc(md->io_pool, GFP_NOIO); 334} 335 336static inline void free_io(struct mapped_device *md, struct dm_io *io) 337{ 338 mempool_free(io, md->io_pool); --- 1073 unchanged lines hidden (view full) --- 1412int dm_suspended(struct mapped_device *md) 1413{ 1414 return test_bit(DMF_SUSPENDED, &md->flags); 1415} 1416 1417static struct block_device_operations dm_blk_dops = { 1418 .open = dm_blk_open, 1419 .release = dm_blk_close, |
1420 .ioctl = dm_blk_ioctl, |
|
1380 .getgeo = dm_blk_getgeo, 1381 .owner = THIS_MODULE 1382}; 1383 1384EXPORT_SYMBOL(dm_get_mapinfo); 1385 1386/* 1387 * module hooks 1388 */ 1389module_init(dm_init); 1390module_exit(dm_exit); 1391 1392module_param(major, uint, 0); 1393MODULE_PARM_DESC(major, "The major number of the device mapper"); 1394MODULE_DESCRIPTION(DM_NAME " driver"); 1395MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); 1396MODULE_LICENSE("GPL"); | 1421 .getgeo = dm_blk_getgeo, 1422 .owner = THIS_MODULE 1423}; 1424 1425EXPORT_SYMBOL(dm_get_mapinfo); 1426 1427/* 1428 * module hooks 1429 */ 1430module_init(dm_init); 1431module_exit(dm_exit); 1432 1433module_param(major, uint, 0); 1434MODULE_PARM_DESC(major, "The major number of the device mapper"); 1435MODULE_DESCRIPTION(DM_NAME " driver"); 1436MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); 1437MODULE_LICENSE("GPL"); |