diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2008-10-01 09:39:17 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-10-01 09:39:17 -0400 |
commit | 5037108acd4dc40c210321cc83b0bf8352eda95a (patch) | |
tree | 96b8684cd33eaee6dda5f07d598c93de36b1476a /drivers/md | |
parent | d3a47e82b6bc3724dd60f3ee4e84fe4479104382 (diff) |
dm: always allow one page in dm_merge_bvec
Some callers assume they can always add at least one page to an empty bio,
so dm_merge_bvec should not return 0 in this case: we'll reject the I/O
later after the bio is submitted.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index bca448e11878..469cec54f371 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -837,10 +837,10 @@ static int dm_merge_bvec(struct request_queue *q, | |||
837 | struct dm_table *map = dm_get_table(md); | 837 | struct dm_table *map = dm_get_table(md); |
838 | struct dm_target *ti; | 838 | struct dm_target *ti; |
839 | sector_t max_sectors; | 839 | sector_t max_sectors; |
840 | int max_size; | 840 | int max_size = 0; |
841 | 841 | ||
842 | if (unlikely(!map)) | 842 | if (unlikely(!map)) |
843 | return 0; | 843 | goto out; |
844 | 844 | ||
845 | ti = dm_table_find_target(map, bvm->bi_sector); | 845 | ti = dm_table_find_target(map, bvm->bi_sector); |
846 | 846 | ||
@@ -861,14 +861,15 @@ static int dm_merge_bvec(struct request_queue *q, | |||
861 | if (max_size && ti->type->merge) | 861 | if (max_size && ti->type->merge) |
862 | max_size = ti->type->merge(ti, bvm, biovec, max_size); | 862 | max_size = ti->type->merge(ti, bvm, biovec, max_size); |
863 | 863 | ||
864 | dm_table_put(map); | ||
865 | |||
866 | out: | ||
864 | /* | 867 | /* |
865 | * Always allow an entire first page | 868 | * Always allow an entire first page |
866 | */ | 869 | */ |
867 | if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT)) | 870 | if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT)) |
868 | max_size = biovec->bv_len; | 871 | max_size = biovec->bv_len; |
869 | 872 | ||
870 | dm_table_put(map); | ||
871 | |||
872 | return max_size; | 873 | return max_size; |
873 | } | 874 | } |
874 | 875 | ||