mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
o It should build now
This commit is contained in:
parent
1655d99716
commit
2b83ef25c5
@ -45,7 +45,7 @@ typedef int (*dm_err_fn)(struct buffer_head *bh, int rw, void *context);
|
||||
* (ie. opened/closed).
|
||||
*/
|
||||
struct dm_dev *dm_table_get_device(struct dm_table *table, const char *path);
|
||||
void dm_table_put_device(struct dm_table *table, struct dm_dev d);
|
||||
void dm_table_put_device(struct dm_table *table, struct dm_dev *d);
|
||||
|
||||
/*
|
||||
* information about a target type
|
||||
|
@ -29,7 +29,7 @@ static struct inode_operations dm_dir_inode_operations;
|
||||
|
||||
struct vfsmount *_mnt;
|
||||
|
||||
static int dmfs_unlink(struct inode *dir, struct dentry *dentry);
|
||||
static int _unlink(struct inode *dir, struct dentry *dentry);
|
||||
|
||||
#define NOT_A_TABLE ((struct dm_table *) 1)
|
||||
|
||||
@ -133,8 +133,9 @@ static void close_error_file(struct file *out)
|
||||
fput(out);
|
||||
}
|
||||
|
||||
static void parse_error(const char *message, struct line_c *lc)
|
||||
static void parse_error(const char *message, void *private)
|
||||
{
|
||||
struct line_c *lc = (struct line_c *) private;
|
||||
char buffer[32];
|
||||
|
||||
#define emit(b, l) lc->out->f_op->write(lc->out, (b), (l), &lc->out->f_pos)
|
||||
@ -148,7 +149,7 @@ static void parse_error(const char *message, struct line_c *lc)
|
||||
#undef emit
|
||||
}
|
||||
|
||||
static int dmfs_release(struct inode *inode, struct file *f)
|
||||
static int _release(struct inode *inode, struct file *f)
|
||||
{
|
||||
/* FIXME: we should lock the inode to
|
||||
prevent someone else opening it while
|
||||
@ -166,7 +167,7 @@ static int dmfs_release(struct inode *inode, struct file *f)
|
||||
|
||||
/* free off the old table */
|
||||
if (table) {
|
||||
dm_put_table(table);
|
||||
dm_table_destroy(table);
|
||||
inode->u.generic_ip = 0;
|
||||
}
|
||||
|
||||
@ -179,10 +180,7 @@ static int dmfs_release(struct inode *inode, struct file *f)
|
||||
if (!(lc->out = open_error_file(lc->in)))
|
||||
return -ENOMEM;
|
||||
|
||||
table = dm_parse(extract_line, lc);
|
||||
if (table && table->err_msg)
|
||||
parse_error(table->err_msg, lc);
|
||||
|
||||
table = dm_parse(extract_line, lc, parse_error, lc);
|
||||
close_error_file(lc->out);
|
||||
|
||||
kfree(lc);
|
||||
@ -191,9 +189,10 @@ static int dmfs_release(struct inode *inode, struct file *f)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dmfs_put_inode(struct inode *inode)
|
||||
void _put_inode(struct inode *inode)
|
||||
{
|
||||
struct mapped_device *md = (struct mapped_device *) inode->u.generic_ip;
|
||||
struct mapped_device *md =
|
||||
(struct mapped_device *) inode->u.generic_ip;
|
||||
struct dm_table *table = (struct dm_table *) inode->u.generic_ip;
|
||||
|
||||
if (inode->i_mode & S_IFDIR) {
|
||||
@ -202,7 +201,7 @@ void dmfs_put_inode(struct inode *inode)
|
||||
|
||||
} else {
|
||||
if (table)
|
||||
dm_put_table(table);
|
||||
dm_table_destroy(table);
|
||||
|
||||
}
|
||||
|
||||
@ -210,7 +209,7 @@ void dmfs_put_inode(struct inode *inode)
|
||||
force_delete(inode);
|
||||
}
|
||||
|
||||
static int dmfs_statfs(struct super_block *sb, struct statfs *buf)
|
||||
static int _statfs(struct super_block *sb, struct statfs *buf)
|
||||
{
|
||||
buf->f_type = DM_MAGIC;
|
||||
buf->f_bsize = PAGE_CACHE_SIZE;
|
||||
@ -222,7 +221,7 @@ static int dmfs_statfs(struct super_block *sb, struct statfs *buf)
|
||||
* Lookup the data. This is trivial - if the dentry didn't already
|
||||
* exist, we know it is negative.
|
||||
*/
|
||||
static struct dentry *dmfs_lookup(struct inode *dir, struct dentry *dentry)
|
||||
static struct dentry *_lookup(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
d_add(dentry, NULL);
|
||||
return NULL;
|
||||
@ -232,7 +231,7 @@ static struct dentry *dmfs_lookup(struct inode *dir, struct dentry *dentry)
|
||||
* Read a page. Again trivial. If it didn't already exist
|
||||
* in the page cache, it is zero-filled.
|
||||
*/
|
||||
static int dmfs_readpage(struct file *file, struct page *page)
|
||||
static int _readpage(struct file *file, struct page *page)
|
||||
{
|
||||
if (!Page_Uptodate(page)) {
|
||||
memset(kmap(page), 0, PAGE_CACHE_SIZE);
|
||||
@ -248,14 +247,14 @@ static int dmfs_readpage(struct file *file, struct page *page)
|
||||
* Writing: just make sure the page gets marked dirty, so that
|
||||
* the page stealer won't grab it.
|
||||
*/
|
||||
static int dmfs_writepage(struct page *page)
|
||||
static int _writepage(struct page *page)
|
||||
{
|
||||
SetPageDirty(page);
|
||||
UnlockPage(page);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dmfs_prepare_write(struct file *file, struct page *page,
|
||||
static int _prepare_write(struct file *file, struct page *page,
|
||||
unsigned offset, unsigned to)
|
||||
{
|
||||
void *addr = kmap(page);
|
||||
@ -268,7 +267,7 @@ static int dmfs_prepare_write(struct file *file, struct page *page,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dmfs_commit_write(struct file *file, struct page *page,
|
||||
static int _commit_write(struct file *file, struct page *page,
|
||||
unsigned offset, unsigned to)
|
||||
{
|
||||
struct inode *inode = page->mapping->host;
|
||||
@ -280,7 +279,7 @@ static int dmfs_commit_write(struct file *file, struct page *page,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct inode *dmfs_get_inode(struct super_block *sb, int mode, int dev)
|
||||
struct inode *_get_inode(struct super_block *sb, int mode, int dev)
|
||||
{
|
||||
struct inode *inode = new_inode(sb);
|
||||
|
||||
@ -318,10 +317,10 @@ struct inode *dmfs_get_inode(struct super_block *sb, int mode, int dev)
|
||||
/*
|
||||
* File creation. Allocate an inode, and we're done..
|
||||
*/
|
||||
static int dmfs_mknod(struct inode *dir, struct dentry *dentry, int mode)
|
||||
static int _mknod(struct inode *dir, struct dentry *dentry, int mode)
|
||||
{
|
||||
int error = -ENOSPC;
|
||||
struct inode *inode = dmfs_get_inode(dir->i_sb, mode, 0);
|
||||
struct inode *inode = _get_inode(dir->i_sb, mode, 0);
|
||||
|
||||
if (inode) {
|
||||
d_instantiate(dentry, inode);
|
||||
@ -332,7 +331,7 @@ static int dmfs_mknod(struct inode *dir, struct dentry *dentry, int mode)
|
||||
return error;
|
||||
}
|
||||
|
||||
static int dmfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
|
||||
static int _mkdir(struct inode *dir, struct dentry *dentry, int mode)
|
||||
{
|
||||
int r;
|
||||
const char *name = (const char *) dentry->d_name.name;
|
||||
@ -345,7 +344,7 @@ static int dmfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
|
||||
if (IS_ERR(md))
|
||||
return PTR_ERR(md);
|
||||
|
||||
r = dmfs_mknod(dir, dentry, mode | S_IFDIR);
|
||||
r = _mknod(dir, dentry, mode | S_IFDIR);
|
||||
if (r) {
|
||||
dm_remove(md);
|
||||
return r;
|
||||
@ -357,17 +356,17 @@ static int dmfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dmfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
static int _rmdir(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
int r = dmfs_unlink(dir, dentry);
|
||||
int r = _unlink(dir, dentry);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int dmfs_create(struct inode *dir, struct dentry *dentry, int mode)
|
||||
static int _create(struct inode *dir, struct dentry *dentry, int mode)
|
||||
{
|
||||
int r;
|
||||
|
||||
if ((r = dmfs_mknod(dir, dentry, mode | S_IFREG)))
|
||||
if ((r = _mknod(dir, dentry, mode | S_IFREG)))
|
||||
return r;
|
||||
|
||||
dentry->d_inode->u.generic_ip = 0;
|
||||
@ -411,7 +410,7 @@ static int _empty(struct dentry *dentry)
|
||||
* This works for both directories and regular files.
|
||||
* (non-directories will always have empty subdirs)
|
||||
*/
|
||||
static int dmfs_unlink(struct inode *dir, struct dentry *dentry)
|
||||
static int _unlink(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
int retval = -ENOTEMPTY;
|
||||
|
||||
@ -431,7 +430,7 @@ static int dmfs_unlink(struct inode *dir, struct dentry *dentry)
|
||||
* it exists so that the VFS layer correctly free's it when it
|
||||
* gets overwritten.
|
||||
*/
|
||||
static int dmfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
static int _rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry)
|
||||
{
|
||||
struct inode *inode = new_dentry->d_inode;
|
||||
@ -461,52 +460,52 @@ static int dmfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dmfs_sync_file(struct file *file, struct dentry *dentry,
|
||||
static int _sync_file(struct file *file, struct dentry *dentry,
|
||||
int datasync)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct address_space_operations dm_aops = {
|
||||
readpage: dmfs_readpage,
|
||||
writepage: dmfs_writepage,
|
||||
prepare_write: dmfs_prepare_write,
|
||||
commit_write: dmfs_commit_write
|
||||
readpage: _readpage,
|
||||
writepage: _writepage,
|
||||
prepare_write: _prepare_write,
|
||||
commit_write: _commit_write
|
||||
};
|
||||
|
||||
static struct file_operations dm_file_operations = {
|
||||
read: generic_file_read,
|
||||
write: generic_file_write,
|
||||
fsync: dmfs_sync_file,
|
||||
release: dmfs_release,
|
||||
fsync: _sync_file,
|
||||
release: _release,
|
||||
};
|
||||
|
||||
static struct file_operations dm_dir_operations = {
|
||||
read: generic_read_dir,
|
||||
readdir: dcache_readdir,
|
||||
fsync: dmfs_sync_file,
|
||||
fsync: _sync_file,
|
||||
};
|
||||
|
||||
static struct inode_operations root_dir_inode_operations = {
|
||||
lookup: dmfs_lookup,
|
||||
mkdir: dmfs_mkdir,
|
||||
rmdir: dmfs_rmdir,
|
||||
rename: dmfs_rename,
|
||||
lookup: _lookup,
|
||||
mkdir: _mkdir,
|
||||
rmdir: _rmdir,
|
||||
rename: _rename,
|
||||
};
|
||||
|
||||
static struct inode_operations dm_dir_inode_operations = {
|
||||
create: dmfs_create,
|
||||
lookup: dmfs_lookup,
|
||||
unlink: dmfs_unlink,
|
||||
rename: dmfs_rename,
|
||||
create: _create,
|
||||
lookup: _lookup,
|
||||
unlink: _unlink,
|
||||
rename: _rename,
|
||||
};
|
||||
|
||||
static struct super_operations dm_ops = {
|
||||
statfs: dmfs_statfs,
|
||||
put_inode: dmfs_put_inode,
|
||||
statfs: _statfs,
|
||||
put_inode: _put_inode,
|
||||
};
|
||||
|
||||
static struct super_block *dmfs_read_super(struct super_block *sb, void *data,
|
||||
static struct super_block *_read_super(struct super_block *sb, void *data,
|
||||
int silent)
|
||||
{
|
||||
struct inode *inode;
|
||||
@ -516,7 +515,7 @@ static struct super_block *dmfs_read_super(struct super_block *sb, void *data,
|
||||
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
|
||||
sb->s_magic = DM_MAGIC;
|
||||
sb->s_op = &dm_ops;
|
||||
inode = dmfs_get_inode(sb, S_IFDIR | 0755, 0);
|
||||
inode = _get_inode(sb, S_IFDIR | 0755, 0);
|
||||
inode->i_op = &root_dir_inode_operations;
|
||||
if (!inode)
|
||||
return NULL;
|
||||
@ -530,9 +529,9 @@ static struct super_block *dmfs_read_super(struct super_block *sb, void *data,
|
||||
return sb;
|
||||
}
|
||||
|
||||
static DECLARE_FSTYPE(_fs_type, "dmfs", dmfs_read_super, FS_SINGLE);
|
||||
static DECLARE_FSTYPE(_fs_type, "dmfs", _read_super, FS_SINGLE);
|
||||
|
||||
int __init dmfs_init(void)
|
||||
int __init dm_fs_init(void)
|
||||
{
|
||||
int r;
|
||||
if ((r = register_filesystem(&_fs_type)))
|
||||
@ -541,14 +540,14 @@ int __init dmfs_init(void)
|
||||
_mnt = kern_mount(&_fs_type);
|
||||
|
||||
if (IS_ERR(_mnt)) {
|
||||
dmfs_exit();
|
||||
unregister_filesystem(&_fs_type);
|
||||
return PTR_ERR(_mnt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __exit dmfs_exit(void)
|
||||
void __exit dm_fs_exit(void)
|
||||
{
|
||||
unregister_filesystem(&_fs_type);
|
||||
}
|
||||
|
@ -124,6 +124,17 @@ struct dm_table *dm_table_create(void)
|
||||
return t;
|
||||
}
|
||||
|
||||
static void free_devices(struct list_head *devices)
|
||||
{
|
||||
struct list_head *tmp, *next;
|
||||
|
||||
for (tmp = devices->next; tmp != devices; tmp = next) {
|
||||
struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
|
||||
next = tmp->next;
|
||||
kfree(dd);
|
||||
}
|
||||
}
|
||||
|
||||
void dm_table_destroy(struct dm_table *t)
|
||||
{
|
||||
int i;
|
||||
@ -142,15 +153,10 @@ void dm_table_destroy(struct dm_table *t)
|
||||
|
||||
/* free the device list */
|
||||
if (t->devices) {
|
||||
struct dev_list *d, *n;
|
||||
|
||||
WARN("there are still devices present, someone isn't "
|
||||
"calling dm_table_remove_device");
|
||||
|
||||
for (d = t->devices; d; d = n) {
|
||||
n = d->next;
|
||||
kfree(d);
|
||||
}
|
||||
free_devices(t->devices);
|
||||
}
|
||||
|
||||
kfree(t);
|
||||
@ -234,7 +240,7 @@ int dm_table_add_device(struct dm_table *t, const char *path,
|
||||
if ((r = lookup_device(path, &dev)))
|
||||
return r;
|
||||
|
||||
dd = find_device(t->devices, kd);
|
||||
dd = find_device(t->devices, dev);
|
||||
if (!dd) {
|
||||
dd = kmalloc(sizeof(*dd), GFP_KERNEL);
|
||||
if (!dd)
|
||||
@ -243,7 +249,7 @@ int dm_table_add_device(struct dm_table *t, const char *path,
|
||||
dd->dev = dev;
|
||||
dd->bd = 0;
|
||||
atomic_set(&dd->count, 0);
|
||||
list_add(&dd->list, &t->devices);
|
||||
list_add(&dd->list, t->devices);
|
||||
}
|
||||
atomic_inc(&dd->count);
|
||||
*result = dd;
|
||||
@ -262,6 +268,7 @@ void dm_table_remove_device(struct dm_table *t, struct dm_dev *dd)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* adds a target to the map
|
||||
*/
|
||||
int dm_table_add_target(struct dm_table *t, offset_t high,
|
||||
|
@ -34,7 +34,7 @@ static inline struct tt_internal *__find_target_type(const char *name)
|
||||
|
||||
ti = list_entry(tmp, struct tt_internal, list);
|
||||
if (!strcmp(name, ti->tt.name))
|
||||
return t;
|
||||
return ti;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -45,13 +45,13 @@ static struct tt_internal *get_target_type(const char *name)
|
||||
struct tt_internal *ti;
|
||||
|
||||
read_lock(&_lock);
|
||||
ti = __get_target_type(name);
|
||||
ti = __find_target_type(name);
|
||||
if (ti->use == 0 && ti->tt.module)
|
||||
__MOD_INC_USE_COUNT(ti->tt.module);
|
||||
ti->use++;
|
||||
read_unlock(&_lock);
|
||||
|
||||
return t;
|
||||
return ti;
|
||||
}
|
||||
|
||||
static void load_module(const char *name)
|
||||
@ -60,7 +60,7 @@ static void load_module(const char *name)
|
||||
|
||||
/* Length check for strcat() below */
|
||||
if (strlen(name) > (DM_MOD_NAME_SIZE - 4))
|
||||
return NULL;
|
||||
return;
|
||||
|
||||
strcat(module_name, name);
|
||||
request_module(module_name);
|
||||
@ -80,24 +80,24 @@ struct target_type *dm_get_target_type(const char *name)
|
||||
|
||||
void dm_put_target_type(struct target_type *t)
|
||||
{
|
||||
struct tt_internal *ti = (struct target_type *) t;
|
||||
struct tt_internal *ti = (struct tt_internal *) t;
|
||||
|
||||
read_lock(&_lock);
|
||||
if (--ti->use == 0 && ti->tt.module)
|
||||
__MOD_DEC_USE_COUNT(t->tt.module);
|
||||
__MOD_DEC_USE_COUNT(ti->tt.module);
|
||||
|
||||
if (ti->use < 0)
|
||||
BUG();
|
||||
read_unlock(&_lock);
|
||||
}
|
||||
|
||||
static int alloc_target(struct target_type *t)
|
||||
static struct tt_internal *alloc_target(struct target_type *t)
|
||||
{
|
||||
struct tt_internal *ti = kmalloc(sizeof(*ti));
|
||||
struct tt_internal *ti = kmalloc(sizeof(*ti), GFP_KERNEL);
|
||||
|
||||
if (ti) {
|
||||
memset(ti, 0, sizeof(*ti));
|
||||
ti->tt = t;
|
||||
ti->tt = *t;
|
||||
}
|
||||
|
||||
return ti;
|
||||
@ -117,7 +117,6 @@ int dm_register_target(struct target_type *t)
|
||||
else
|
||||
list_add(&ti->list, &_targets);
|
||||
|
||||
out:
|
||||
write_unlock(&_lock);
|
||||
return rv;
|
||||
}
|
||||
@ -143,7 +142,8 @@ int dm_unregister_target(struct target_type *t)
|
||||
* up LV's that have holes in them.
|
||||
*/
|
||||
static int io_err_ctr(struct dm_table *t, offset_t b, offset_t l,
|
||||
struct text_region *args, void **context)
|
||||
struct text_region *args, void **context,
|
||||
dm_error_fn err, void *e_private)
|
||||
{
|
||||
*context = 0;
|
||||
return 0;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#define DEVICE_OFF(d) /* do-nothing */
|
||||
|
||||
#include <linux/blk.h>
|
||||
#include <linux/blkpg.h>
|
||||
|
||||
#define MAX_DEVICES 64
|
||||
#define DEFAULT_READ_AHEAD 64
|
||||
@ -44,6 +45,7 @@ int _version[3] = {0, 1, 0};
|
||||
|
||||
struct io_hook {
|
||||
struct mapped_device *md;
|
||||
struct target *target;
|
||||
int rw;
|
||||
|
||||
void (*end_io)(struct buffer_head * bh, int uptodate);
|
||||
@ -69,7 +71,9 @@ const char *_fs_dir = "device-mapper";
|
||||
static devfs_handle_t _dev_dir;
|
||||
|
||||
static int request(request_queue_t *q, int rw, struct buffer_head *bh);
|
||||
#if 0
|
||||
static int dm_user_bmap(struct inode *inode, struct lv_bmap *lvb);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* setup and teardown the driver
|
||||
@ -203,30 +207,6 @@ static int dm_blk_ioctl(struct inode *inode, struct file *file,
|
||||
return blk_ioctl(inode->i_dev, command, a);
|
||||
break;
|
||||
|
||||
case HDIO_GETGEO:
|
||||
{
|
||||
struct hd_geometry tmp = { heads:64, sectors:32 };
|
||||
|
||||
tmp.cylinders = VOLUME_SIZE(minor) / tmp.heads /
|
||||
tmp.sectors;
|
||||
|
||||
if (copy_to_user((char *) a, &tmp, sizeof (tmp)))
|
||||
return -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
case HDIO_GETGEO_BIG:
|
||||
{
|
||||
struct hd_big_geometry tmp = { heads:64, sectors:32 };
|
||||
|
||||
tmp.cylinders = VOLUME_SIZE(minor) / tmp.heads /
|
||||
tmp.sectors;
|
||||
|
||||
if (copy_to_user((char *) a, &tmp, sizeof (tmp)))
|
||||
return -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
case BLKGETSIZE:
|
||||
size = VOLUME_SIZE(minor);
|
||||
if (copy_to_user((void *) a, &size, sizeof (long)))
|
||||
@ -256,8 +236,10 @@ static int dm_blk_ioctl(struct inode *inode, struct file *file,
|
||||
case BLKRRPART:
|
||||
return -EINVAL;
|
||||
|
||||
#if 0
|
||||
case LV_BMAP:
|
||||
return dm_user_bmap(inode, (struct lv_bmap *)a);
|
||||
#endif
|
||||
|
||||
default:
|
||||
WARN("unknown block ioctl %d", command);
|
||||
@ -419,12 +401,10 @@ static inline int __find_node(struct dm_table *t, struct buffer_head *bh)
|
||||
return (KEYS_PER_NODE * n) + k;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* FIXME: Break this up! */
|
||||
static int dm_user_bmap(struct inode *inode, struct lv_bmap *lvb)
|
||||
{
|
||||
#if 1
|
||||
return -EINVAL;
|
||||
#else
|
||||
struct buffer_head bh;
|
||||
struct mapped_device *md;
|
||||
unsigned long block;
|
||||
@ -469,8 +449,8 @@ static int dm_user_bmap(struct inode *inode, struct lv_bmap *lvb)
|
||||
}
|
||||
|
||||
return err;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static int request(request_queue_t *q, int rw, struct buffer_head *bh)
|
||||
{
|
||||
@ -614,6 +594,19 @@ static void close_dev(struct dm_dev *d)
|
||||
d->bd = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close a list of devices.
|
||||
*/
|
||||
static void close_devices(struct list_head *devices)
|
||||
{
|
||||
struct list_head *tmp;
|
||||
|
||||
for (tmp = devices->next; tmp != devices; tmp = tmp->next) {
|
||||
struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
|
||||
close_dev(dd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a list of devices.
|
||||
*/
|
||||
@ -634,19 +627,6 @@ static int open_devices(struct list_head *devices)
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close a list of devices.
|
||||
*/
|
||||
static void close_devices(struct dm_list *devices)
|
||||
{
|
||||
struct list_head *tmp;
|
||||
|
||||
for (tmp = devices->next; tmp != devices; tmp = tmp->next) {
|
||||
struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
|
||||
close_dev(dd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct mapped_device *dm_find_by_minor(int minor)
|
||||
{
|
||||
@ -739,17 +719,18 @@ int dm_remove(struct mapped_device *md)
|
||||
* smallest hard sect size from the devices it
|
||||
* maps onto.
|
||||
*/
|
||||
static int __find_hardsect_size(struct dev_list *dl)
|
||||
static int __find_hardsect_size(struct list_head *devices)
|
||||
{
|
||||
int result = INT_MAX, size;
|
||||
int result = INT_MAX, size;
|
||||
struct list_head *tmp;
|
||||
|
||||
while(dl) {
|
||||
size = get_hardsect_size(dl->dev);
|
||||
if (size < result)
|
||||
result = size;
|
||||
dl = dl->next;
|
||||
}
|
||||
return result;
|
||||
for (tmp = devices->next; tmp != devices; tmp = tmp->next) {
|
||||
struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
|
||||
size = get_hardsect_size(dd->dev);
|
||||
if (size < result)
|
||||
result = size;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -886,7 +867,7 @@ void dm_suspend(struct mapped_device *md)
|
||||
} while (1);
|
||||
|
||||
current->state = TASK_RUNNING;
|
||||
remove_wait_queue(&md->map->wait, &wait);
|
||||
remove_wait_queue(&md->wait, &wait);
|
||||
close_devices(md->map->devices);
|
||||
|
||||
md->map = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user