* [PATCH 2/4] md: add flush_idx support for stacked devices
[not found] <1413281035-6483-1-git-send-email-dmonakhov@openvz.org>
@ 2014-10-14 10:03 ` Dmitry Monakhov
2014-10-14 12:25 ` Mike Snitzer
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Monakhov @ 2014-10-14 10:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Dmitry Monakhov, Alasdair Kergon, Mike Snitzer, dm-devel
For single device mapping it is safe to introduce get_flush_idx conception.
This cover most common case linear mapping for a single dev.
CC: Alasdair Kergon <agk@redhat.com>
CC: Mike Snitzer <snitzer@redhat.com>
CC: dm-devel@redhat.com
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
drivers/md/dm.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 32b958d..042d172 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1843,6 +1843,36 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
return r;
}
+static int dm_iter_get_flush_idx(struct dm_target *ti,
+ struct dm_dev *dev, sector_t start,
+ sector_t len, void *data)
+{
+ struct block_device *bdev = dev->bdev;
+ struct request_queue *q = bdev_get_queue(bdev);
+
+ return blk_get_flush_idx(q, *((bool *)data));
+}
+
+static unsigned dm_get_flush_idx(struct request_queue *q, bool queued)
+{
+ struct dm_target *ti;
+ struct mapped_device *md = q->queuedata;
+ struct dm_table *map = dm_get_live_table_fast(md);
+ unsigned fid = 0;
+
+ if (unlikely(!map || dm_table_get_num_targets(map) != 1))
+ goto out;
+
+ ti = dm_table_get_target(map, 0);
+ if (unlikely(!ti || !ti->type->iterate_devices))
+ goto out;
+
+ fid = ti->type->iterate_devices(ti, dm_iter_get_flush_idx, &queued);
+out:
+ dm_put_live_table_fast(md);
+ return fid;
+}
+
/*-----------------------------------------------------------------
* An IDR is used to keep track of allocated minor numbers.
*---------------------------------------------------------------*/
@@ -1962,6 +1992,7 @@ static struct mapped_device *alloc_dev(int minor)
goto bad_queue;
dm_init_md_queue(md);
+ blk_queue_get_flush_idx(md->queue, dm_get_flush_idx);
md->disk = alloc_disk(1);
if (!md->disk)
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/4] md: add flush_idx support for stacked devices
2014-10-14 10:03 ` [PATCH 2/4] md: add flush_idx support for stacked devices Dmitry Monakhov
@ 2014-10-14 12:25 ` Mike Snitzer
0 siblings, 0 replies; 2+ messages in thread
From: Mike Snitzer @ 2014-10-14 12:25 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: linux-kernel, Alasdair Kergon, dm-devel
On Tue, Oct 14 2014 at 6:03am -0400,
Dmitry Monakhov <dmonakhov@openvz.org> wrote:
> For single device mapping it is safe to introduce get_flush_idx conception.
> This cover most common case linear mapping for a single dev.
You really should email the entire patchset rather than forcing the need
to hunt for the remainder of the patches that actually provide context
for this change.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-14 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1413281035-6483-1-git-send-email-dmonakhov@openvz.org>
2014-10-14 10:03 ` [PATCH 2/4] md: add flush_idx support for stacked devices Dmitry Monakhov
2014-10-14 12:25 ` Mike Snitzer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox