Skip to content

Commit fe7af2d

Browse files
committed
dm: fix write same requests counting
When processing write same requests, fix dm to send the configured number of WRITE SAME requests to the target rather than the number of discards, which is not always the same. Device-mapper WRITE SAME support was introduced by commit 23508a9 ("dm: add WRITE SAME support"). Signed-off-by: Alasdair G Kergon <agk@redhat.com> Acked-by: Mike Snitzer <snitzer@redhat.com>
1 parent 0f640dc commit fe7af2d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/md/dm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,7 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci,
11881188
{
11891189
struct dm_target *ti;
11901190
sector_t len;
1191+
unsigned num_requests;
11911192

11921193
do {
11931194
ti = dm_table_find_target(ci->map, ci->sector);
@@ -1200,15 +1201,16 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci,
12001201
* reconfiguration might also have changed that since the
12011202
* check was performed.
12021203
*/
1203-
if (!get_num_requests || !get_num_requests(ti))
1204+
num_requests = get_num_requests ? get_num_requests(ti) : 0;
1205+
if (!num_requests)
12041206
return -EOPNOTSUPP;
12051207

12061208
if (is_split_required && !is_split_required(ti))
12071209
len = min(ci->sector_count, max_io_len_target_boundary(ci->sector, ti));
12081210
else
12091211
len = min(ci->sector_count, max_io_len(ci->sector, ti));
12101212

1211-
__issue_target_requests(ci, ti, ti->num_discard_requests, len);
1213+
__issue_target_requests(ci, ti, num_requests, len);
12121214

12131215
ci->sector += len;
12141216
} while (ci->sector_count -= len);

0 commit comments

Comments
 (0)