Skip to content

Commit b7e6f62

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
* 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
2 parents 8a39262 + d41e26b commit b7e6f62

File tree

11 files changed

+270
-49
lines changed

11 files changed

+270
-49
lines changed

drivers/md/dm-crypt.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,9 +1216,24 @@ static int crypt_message(struct dm_target *ti, unsigned argc, char **argv)
12161216
return -EINVAL;
12171217
}
12181218

1219+
static int crypt_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
1220+
struct bio_vec *biovec, int max_size)
1221+
{
1222+
struct crypt_config *cc = ti->private;
1223+
struct request_queue *q = bdev_get_queue(cc->dev->bdev);
1224+
1225+
if (!q->merge_bvec_fn)
1226+
return max_size;
1227+
1228+
bvm->bi_bdev = cc->dev->bdev;
1229+
bvm->bi_sector = cc->start + bvm->bi_sector - ti->begin;
1230+
1231+
return min(max_size, q->merge_bvec_fn(q, bvm, biovec));
1232+
}
1233+
12191234
static struct target_type crypt_target = {
12201235
.name = "crypt",
1221-
.version= {1, 5, 0},
1236+
.version= {1, 6, 0},
12221237
.module = THIS_MODULE,
12231238
.ctr = crypt_ctr,
12241239
.dtr = crypt_dtr,
@@ -1228,6 +1243,7 @@ static struct target_type crypt_target = {
12281243
.preresume = crypt_preresume,
12291244
.resume = crypt_resume,
12301245
.message = crypt_message,
1246+
.merge = crypt_merge,
12311247
};
12321248

12331249
static int __init dm_crypt_init(void)

drivers/md/dm-linear.c

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,25 @@ static void linear_dtr(struct dm_target *ti)
6969
kfree(lc);
7070
}
7171

72-
static int linear_map(struct dm_target *ti, struct bio *bio,
73-
union map_info *map_context)
72+
static sector_t linear_map_sector(struct dm_target *ti, sector_t bi_sector)
7473
{
75-
struct linear_c *lc = (struct linear_c *) ti->private;
74+
struct linear_c *lc = ti->private;
75+
76+
return lc->start + (bi_sector - ti->begin);
77+
}
78+
79+
static void linear_map_bio(struct dm_target *ti, struct bio *bio)
80+
{
81+
struct linear_c *lc = ti->private;
7682

7783
bio->bi_bdev = lc->dev->bdev;
78-
bio->bi_sector = lc->start + (bio->bi_sector - ti->begin);
84+
bio->bi_sector = linear_map_sector(ti, bio->bi_sector);
85+
}
86+
87+
static int linear_map(struct dm_target *ti, struct bio *bio,
88+
union map_info *map_context)
89+
{
90+
linear_map_bio(ti, bio);
7991

8092
return DM_MAPIO_REMAPPED;
8193
}
@@ -114,15 +126,31 @@ static int linear_ioctl(struct dm_target *ti, struct inode *inode,
114126
return blkdev_driver_ioctl(bdev->bd_inode, &fake_file, bdev->bd_disk, cmd, arg);
115127
}
116128

129+
static int linear_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
130+
struct bio_vec *biovec, int max_size)
131+
{
132+
struct linear_c *lc = ti->private;
133+
struct request_queue *q = bdev_get_queue(lc->dev->bdev);
134+
135+
if (!q->merge_bvec_fn)
136+
return max_size;
137+
138+
bvm->bi_bdev = lc->dev->bdev;
139+
bvm->bi_sector = linear_map_sector(ti, bvm->bi_sector);
140+
141+
return min(max_size, q->merge_bvec_fn(q, bvm, biovec));
142+
}
143+
117144
static struct target_type linear_target = {
118145
.name = "linear",
119-
.version= {1, 0, 2},
146+
.version= {1, 0, 3},
120147
.module = THIS_MODULE,
121148
.ctr = linear_ctr,
122149
.dtr = linear_dtr,
123150
.map = linear_map,
124151
.status = linear_status,
125152
.ioctl = linear_ioctl,
153+
.merge = linear_merge,
126154
};
127155

128156
int __init dm_linear_init(void)

drivers/md/dm-log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ static struct dm_dirty_log_type _disk_type = {
831831
.status = disk_status,
832832
};
833833

834-
int __init dm_dirty_log_init(void)
834+
static int __init dm_dirty_log_init(void)
835835
{
836836
int r;
837837

@@ -848,7 +848,7 @@ int __init dm_dirty_log_init(void)
848848
return r;
849849
}
850850

851-
void __exit dm_dirty_log_exit(void)
851+
static void __exit dm_dirty_log_exit(void)
852852
{
853853
dm_dirty_log_type_unregister(&_disk_type);
854854
dm_dirty_log_type_unregister(&_core_type);

drivers/md/dm-mpath.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,10 @@ static int parse_path_selector(struct arg_set *as, struct priority_group *pg,
525525
}
526526

527527
r = read_param(_params, shift(as), &ps_argc, &ti->error);
528-
if (r)
528+
if (r) {
529+
dm_put_path_selector(pst);
529530
return -EINVAL;
531+
}
530532

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

626-
if (as->argc < nr_params)
628+
if (as->argc < nr_params) {
629+
ti->error = "not enough path parameters";
627630
goto bad;
631+
}
628632

629633
path_args.argc = nr_params;
630634
path_args.argv = as->argv;
@@ -867,7 +871,7 @@ static int reinstate_path(struct pgpath *pgpath)
867871
if (pgpath->path.is_active)
868872
goto out;
869873

870-
if (!pgpath->pg->ps.type) {
874+
if (!pgpath->pg->ps.type->reinstate_path) {
871875
DMWARN("Reinstate path not supported by path selector %s",
872876
pgpath->pg->ps.type->name);
873877
r = -EINVAL;

0 commit comments

Comments
 (0)