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>

authored by Mikulas Patocka and committed by Alasdair G Kergon 5037108a d3a47e82

+5 -4
+5 -4
drivers/md/dm.c
··· 837 837 struct dm_table *map = dm_get_table(md); 838 838 struct dm_target *ti; 839 839 sector_t max_sectors; 840 - int max_size; 840 + int max_size = 0; 841 841 842 842 if (unlikely(!map)) 843 - return 0; 843 + goto out; 844 844 845 845 ti = dm_table_find_target(map, bvm->bi_sector); 846 846 ··· 861 861 if (max_size && ti->type->merge) 862 862 max_size = ti->type->merge(ti, bvm, biovec, max_size); 863 863 864 + dm_table_put(map); 865 + 866 + out: 864 867 /* 865 868 * Always allow an entire first page 866 869 */ 867 870 if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT)) 868 871 max_size = biovec->bv_len; 869 - 870 - dm_table_put(map); 871 872 872 873 return max_size; 873 874 }