Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm:
  dm crypt: add merge
  dm table: remove merge_bvec sector restriction
  dm: linear add merge
  dm: introduce merge_bvec_fn
  dm snapshot: use per device mempools
  dm snapshot: fix race during exception creation
  dm snapshot: track snapshot reads
  dm mpath: fix test for reinstate_path
  dm mpath: return parameter error
  dm io: remove struct padding
  dm log: make dm_dirty_log init and exit static
  dm mpath: free path selector on invalid args
  • Loading branch information
Linus Torvalds committed Jul 21, 2008
2 parents 8a39262 + d41e26b commit b7e6f62
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 49 deletions.
18 changes: 17 additions & 1 deletion drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,9 +1216,24 @@ static int crypt_message(struct dm_target *ti, unsigned argc, char **argv)
return -EINVAL;
}

static int crypt_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
struct bio_vec *biovec, int max_size)
{
struct crypt_config *cc = ti->private;
struct request_queue *q = bdev_get_queue(cc->dev->bdev);

if (!q->merge_bvec_fn)
return max_size;

bvm->bi_bdev = cc->dev->bdev;
bvm->bi_sector = cc->start + bvm->bi_sector - ti->begin;

return min(max_size, q->merge_bvec_fn(q, bvm, biovec));
}

static struct target_type crypt_target = {
.name = "crypt",
.version= {1, 5, 0},
.version= {1, 6, 0},
.module = THIS_MODULE,
.ctr = crypt_ctr,
.dtr = crypt_dtr,
Expand All @@ -1228,6 +1243,7 @@ static struct target_type crypt_target = {
.preresume = crypt_preresume,
.resume = crypt_resume,
.message = crypt_message,
.merge = crypt_merge,
};

static int __init dm_crypt_init(void)
Expand Down
38 changes: 33 additions & 5 deletions drivers/md/dm-linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,25 @@ static void linear_dtr(struct dm_target *ti)
kfree(lc);
}

static int linear_map(struct dm_target *ti, struct bio *bio,
union map_info *map_context)
static sector_t linear_map_sector(struct dm_target *ti, sector_t bi_sector)
{
struct linear_c *lc = (struct linear_c *) ti->private;
struct linear_c *lc = ti->private;

return lc->start + (bi_sector - ti->begin);
}

static void linear_map_bio(struct dm_target *ti, struct bio *bio)
{
struct linear_c *lc = ti->private;

bio->bi_bdev = lc->dev->bdev;
bio->bi_sector = lc->start + (bio->bi_sector - ti->begin);
bio->bi_sector = linear_map_sector(ti, bio->bi_sector);
}

static int linear_map(struct dm_target *ti, struct bio *bio,
union map_info *map_context)
{
linear_map_bio(ti, bio);

return DM_MAPIO_REMAPPED;
}
Expand Down Expand Up @@ -114,15 +126,31 @@ static int linear_ioctl(struct dm_target *ti, struct inode *inode,
return blkdev_driver_ioctl(bdev->bd_inode, &fake_file, bdev->bd_disk, cmd, arg);
}

static int linear_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
struct bio_vec *biovec, int max_size)
{
struct linear_c *lc = ti->private;
struct request_queue *q = bdev_get_queue(lc->dev->bdev);

if (!q->merge_bvec_fn)
return max_size;

bvm->bi_bdev = lc->dev->bdev;
bvm->bi_sector = linear_map_sector(ti, bvm->bi_sector);

return min(max_size, q->merge_bvec_fn(q, bvm, biovec));
}

static struct target_type linear_target = {
.name = "linear",
.version= {1, 0, 2},
.version= {1, 0, 3},
.module = THIS_MODULE,
.ctr = linear_ctr,
.dtr = linear_dtr,
.map = linear_map,
.status = linear_status,
.ioctl = linear_ioctl,
.merge = linear_merge,
};

int __init dm_linear_init(void)
Expand Down
4 changes: 2 additions & 2 deletions drivers/md/dm-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ static struct dm_dirty_log_type _disk_type = {
.status = disk_status,
};

int __init dm_dirty_log_init(void)
static int __init dm_dirty_log_init(void)
{
int r;

Expand All @@ -848,7 +848,7 @@ int __init dm_dirty_log_init(void)
return r;
}

void __exit dm_dirty_log_exit(void)
static void __exit dm_dirty_log_exit(void)
{
dm_dirty_log_type_unregister(&_disk_type);
dm_dirty_log_type_unregister(&_core_type);
Expand Down
10 changes: 7 additions & 3 deletions drivers/md/dm-mpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,10 @@ static int parse_path_selector(struct arg_set *as, struct priority_group *pg,
}

r = read_param(_params, shift(as), &ps_argc, &ti->error);
if (r)
if (r) {
dm_put_path_selector(pst);
return -EINVAL;
}

r = pst->create(&pg->ps, ps_argc, as->argv);
if (r) {
Expand Down Expand Up @@ -623,8 +625,10 @@ static struct priority_group *parse_priority_group(struct arg_set *as,
struct pgpath *pgpath;
struct arg_set path_args;

if (as->argc < nr_params)
if (as->argc < nr_params) {
ti->error = "not enough path parameters";
goto bad;
}

path_args.argc = nr_params;
path_args.argv = as->argv;
Expand Down Expand Up @@ -867,7 +871,7 @@ static int reinstate_path(struct pgpath *pgpath)
if (pgpath->path.is_active)
goto out;

if (!pgpath->pg->ps.type) {
if (!pgpath->pg->ps.type->reinstate_path) {
DMWARN("Reinstate path not supported by path selector %s",
pgpath->pg->ps.type->name);
r = -EINVAL;
Expand Down
Loading

0 comments on commit b7e6f62

Please sign in to comment.