1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-11 09:18:25 +03:00

o Changed dm_create() to return a struct mapped_device rather than an int

o Changed dm_remove() to accept a struct mapped_device argument rather than
   a name
 o We no longer have to look up devices by name, the dcache handles that
   nicely for us
 o Fixed a bug where we were freeing a structure before we'd finished with
   it.
 o The name field in struct mapped_device is now only used in a very few
   places in dm.c and will be replaced in future with a back reference to
   the dentry rather than keeping the name in two places.
This commit is contained in:
steve 2001-09-18 16:52:50 +00:00
parent 66bac98fc2
commit edce87f3fb
2 changed files with 12 additions and 14 deletions

View File

@ -190,7 +190,7 @@ void dmfs_put_inode(struct inode *inode)
if (inode->i_mode & S_IFDIR) {
if (md)
dm_remove(md->name);
dm_remove(md);
} else {
if (table)
@ -328,21 +328,23 @@ static int dmfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
int r;
const char *name = (const char *) dentry->d_name.name;
struct mapped_device *md;
if (!is_identifier(name, dentry->d_name.len))
return -EPERM; /* or EINVAL ? */
r = dm_create(name, -1);
if (r)
return r;
md = dm_create(name, -1);
if (IS_ERR(md))
return PTR_ERR(md);
r = dmfs_mknod(dir, dentry, mode | S_IFDIR);
if (r) {
dm_remove(name);
dm_remove(md);
return r;
}
dentry->d_inode->u.generic_ip = dm_find_by_name(name);
dentry->d_inode->u.generic_ip = md;
md->inode = dentry->d_inode;
return 0;
}
@ -350,12 +352,7 @@ static int dmfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
static int dmfs_rmdir(struct inode *dir, struct dentry *dentry)
{
int r = dmfs_unlink(dir, dentry);
if (r)
return r;
dm_remove(dentry->d_name.name);
return 0;
return r;
}
static int dmfs_create(struct inode *dir, struct dentry *dentry, int mode)

View File

@ -185,6 +185,7 @@ struct dm_table {
struct mapped_device {
kdev_t dev;
char name[DM_NAME_LEN];
struct inode *inode;
int use_count;
int state;
@ -214,8 +215,8 @@ int dm_target_init(void);
struct mapped_device *dm_find_by_name(const char *name);
struct mapped_device *dm_find_by_minor(int minor);
int dm_create(const char *name, int minor);
int dm_remove(const char *name);
struct mapped_device *dm_create(const char *name, int minor);
int dm_remove(struct mapped_device *md);
int dm_activate(struct mapped_device *md, struct dm_table *t);
int dm_deactivate(struct mapped_device *md);