Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264277
b: refs/heads/master
c: 983c7db
h: refs/heads/master
i:
  264275: ed2075e
v: v3
  • Loading branch information
Milan Broz authored and Alasdair G Kergon committed Sep 25, 2011
1 parent 9e186c1 commit 195394d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8232480944d173378082ebb2cac8a3207c08cf31
refs/heads/master: 983c7db347db8ce2d8453fd1d89b7a4bb6920d56
2 changes: 2 additions & 0 deletions trunk/drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
}

ti->num_flush_requests = 1;
ti->discard_zeroes_data_unsupported = 1;

return 0;

bad:
Expand Down
19 changes: 19 additions & 0 deletions trunk/drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,22 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned flush)
return 0;
}

static bool dm_table_discard_zeroes_data(struct dm_table *t)
{
struct dm_target *ti;
unsigned i = 0;

/* Ensure that all targets supports discard_zeroes_data. */
while (i < dm_table_get_num_targets(t)) {
ti = dm_table_get_target(t, i++);

if (ti->discard_zeroes_data_unsupported)
return 0;
}

return 1;
}

void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
struct queue_limits *limits)
{
Expand All @@ -1305,6 +1321,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
}
blk_queue_flush(q, flush);

if (!dm_table_discard_zeroes_data(t))
q->limits.discard_zeroes_data = 0;

dm_table_set_integrity(t);

/*
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/device-mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ struct dm_target {
* whether or not its underlying devices have support.
*/
unsigned discards_supported:1;

/*
* Set if this target does not return zeroes on discarded blocks.
*/
unsigned discard_zeroes_data_unsupported:1;
};

/* Each target can link one of these into the table */
Expand Down

0 comments on commit 195394d

Please sign in to comment.