Skip to content

Commit

Permalink
dm: allow targets to request flushes regardless of underlying device …
Browse files Browse the repository at this point in the history
…support

Allow targets to override the 'supports flush' calculation.

Set 'flush_supported' if a target needs to receive flushes regardless of
whether or not its underlying devices have support.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Joe Thornber authored and Alasdair G Kergon committed Jul 27, 2012
1 parent f4b9036 commit 0e9c24e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,9 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned flush)
if (!ti->num_flush_requests)
continue;

if (ti->flush_supported)
return 1;

if (ti->type->iterate_devices &&
ti->type->iterate_devices(ti, device_flush_capable, &flush))
return 1;
Expand Down
6 changes: 6 additions & 0 deletions include/linux/device-mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ struct dm_target {
/* Used to provide an error string from the ctr */
char *error;

/*
* Set if this target needs to receive flushes regardless of
* whether or not its underlying devices have support.
*/
bool flush_supported:1;

/*
* Set if this target needs to receive discards regardless of
* whether or not its underlying devices have support.
Expand Down

0 comments on commit 0e9c24e

Please sign in to comment.