Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1421388 > unrolled thread
| Started by | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| First post | 2016-06-14 00:40 +0200 |
| Last post | 2016-06-14 18:00 +0200 |
| Articles | 20 on this page of 40 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH 0/6] Support DAX for device-mapper dm-linear devices Toshi Kani <toshi.kani@hpe.com> - 2016-06-14 00:40 +0200
[PATCH 1/6] genhd: Add GENHD_FL_DAX to gendisk flags Toshi Kani <toshi.kani@hpe.com> - 2016-06-14 00:40 +0200
[PATCH 4/6] dm-linear: Add linear_direct_access() Toshi Kani <toshi.kani@hpe.com> - 2016-06-14 00:40 +0200
[PATCH 6/6] dm: Enable DAX support for mapper device Toshi Kani <toshi.kani@hpe.com> - 2016-06-14 00:40 +0200
[PATCH 3/6] dm: Add dm_blk_direct_access() for mapped device Toshi Kani <toshi.kani@hpe.com> - 2016-06-14 00:40 +0200
[PATCH 2/6] block: Check GENHD_FL_DAX for DAX capability Toshi Kani <toshi.kani@hpe.com> - 2016-06-14 00:40 +0200
[PATCH 5/6] dm, dm-linear: Add dax_supported to dm_target Toshi Kani <toshi.kani@hpe.com> - 2016-06-14 00:40 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-14 01:00 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-20 20:30 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-20 21:50 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-20 23:50 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-21 00:10 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-21 00:40 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-21 15:50 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-21 18:00 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-21 18:10 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Dan Williams <dan.j.williams@intel.com> - 2016-06-21 18:30 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Dan Williams <dan.j.williams@intel.com> - 2016-06-21 18:50 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-21 19:20 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-21 19:00 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-21 20:30 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-22 19:50 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Dan Williams <dan.j.williams@intel.com> - 2016-06-22 21:20 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-22 22:20 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-23 00:40 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-23 01:20 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-21 00:50 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-20 23:10 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Dan Williams <dan.j.williams@intel.com> - 2016-06-14 01:20 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-14 02:00 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Dan Williams <dan.j.williams@intel.com> - 2016-06-14 02:10 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Dan Williams <dan.j.williams@intel.com> - 2016-06-14 09:40 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Jeff Moyer <jmoyer@redhat.com> - 2016-06-14 16:00 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-14 17:50 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-14 20:10 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Jeff Moyer <jmoyer@redhat.com> - 2016-06-14 22:20 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-15 03:50 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Dan Williams <dan.j.williams@intel.com> - 2016-06-15 04:10 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices Mike Snitzer <snitzer@redhat.com> - 2016-06-15 04:40 +0200
Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices "Kani, Toshimitsu" <toshi.kani@hpe.com> - 2016-06-14 18:00 +0200
Page 1 of 2 [1] 2 Next page →
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-14 00:40 +0200 |
| Subject | [PATCH 0/6] Support DAX for device-mapper dm-linear devices |
| Message-ID | <rJIGt-4a0-1@gated-at.bofh.it> |
This patch-set adds DAX support to device-mapper dm-linear devices used by LVM. It works with LVM commands as follows: - Creation of a logical volume with all DAX capable devices (such as pmem) sets the logical volume DAX capable as well. - Once a logical volume is set to DAX capable, the volume may not be extended with non-DAX capable devices. The direct_access interface is added to dm and dm-linear to map a request to a target device. - Patch 1-2 introduce GENHD_FL_DAX flag to indicate DAX capability. - Patch 3-4 add direct_access functions to dm and dm-linear. - Patch 5-6 set GENHD_FL_DAX to dm when all targets are DAX capable. --- Toshi Kani (6): 1/6 genhd: Add GENHD_FL_DAX to gendisk flags 2/6 block: Check GENHD_FL_DAX for DAX capability 3/6 dm: Add dm_blk_direct_access() for mapped device 4/6 dm-linear: Add linear_direct_access() 5/6 dm, dm-linear: Add dax_supported to dm_target 6/6 dm: Enable DAX support for mapper device --- drivers/block/brd.c | 2 +- drivers/md/dm-linear.c | 19 +++++++++++++++++++ drivers/md/dm-table.c | 12 +++++++++--- drivers/md/dm.c | 38 ++++++++++++++++++++++++++++++++++++-- drivers/md/dm.h | 7 +++++++ drivers/nvdimm/pmem.c | 2 +- drivers/s390/block/dcssblk.c | 1 + fs/block_dev.c | 5 +++-- include/linux/device-mapper.h | 15 +++++++++++++++ include/linux/genhd.h | 2 +- 10 files changed, 93 insertions(+), 10 deletions(-)
[toc] | [next] | [standalone]
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-14 00:40 +0200 |
| Subject | [PATCH 1/6] genhd: Add GENHD_FL_DAX to gendisk flags |
| Message-ID | <rJIGu-4a0-11@gated-at.bofh.it> |
| In reply to | #1421388 |
Currently, presence of direct_access() in block_device_operations
indicates support of DAX on its block device. Because
block_device_operations is instantiated with 'const', this DAX
capablity may not be enabled conditinally.
In preparation for supporting DAX to device-mapper devices, add
GENHD_FL_DAX to gendisk flags to indicate that this block device
supports DAX. This will allow to set the DAX capability based on
how mapped device is composed.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: <linux-s390@vger.kernel.org>
---
drivers/block/brd.c | 2 +-
drivers/nvdimm/pmem.c | 2 +-
drivers/s390/block/dcssblk.c | 1 +
include/linux/genhd.h | 2 +-
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index c04bd9b..43a6765 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -518,7 +518,7 @@ static struct brd_device *brd_alloc(int i)
disk->fops = &brd_fops;
disk->private_data = brd;
disk->queue = brd->brd_queue;
- disk->flags = GENHD_FL_EXT_DEVT;
+ disk->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DAX;
sprintf(disk->disk_name, "ram%d", i);
set_capacity(disk, rd_size * 2);
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 608fc44..3847449 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -295,7 +295,7 @@ static int pmem_attach_disk(struct device *dev,
disk->fops = &pmem_fops;
disk->queue = q;
- disk->flags = GENHD_FL_EXT_DEVT;
+ disk->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DAX;
nvdimm_namespace_disk_name(ndns, disk->disk_name);
disk->driverfs_dev = dev;
set_capacity(disk, (pmem->size - pmem->pfn_pad - pmem->data_offset)
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index bed53c4..60b1857 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -616,6 +616,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
dev_info->gd->queue = dev_info->dcssblk_queue;
dev_info->gd->private_data = dev_info;
dev_info->gd->driverfs_dev = &dev_info->dev;
+ dev_info->gd->flags = GENHD_FL_DAX;
blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request);
blk_queue_logical_block_size(dev_info->dcssblk_queue, 4096);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 359a8e4..9dc3a3d 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -131,7 +131,7 @@ struct hd_struct {
};
#define GENHD_FL_REMOVABLE 1
-/* 2 is unused */
+#define GENHD_FL_DAX 2
#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4
#define GENHD_FL_CD 8
#define GENHD_FL_UP 16
[toc] | [prev] | [next] | [standalone]
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-14 00:40 +0200 |
| Subject | [PATCH 4/6] dm-linear: Add linear_direct_access() |
| Message-ID | <rJIGu-4a0-13@gated-at.bofh.it> |
| In reply to | #1421388 |
Change dm-linear to implement direct_access function,
linear_direct_access(), which maps sector and calls
direct_access function of its target device.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
---
drivers/md/dm-linear.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
index 05c35aa..49bd7d2 100644
--- a/drivers/md/dm-linear.c
+++ b/drivers/md/dm-linear.c
@@ -141,6 +141,22 @@ static int linear_iterate_devices(struct dm_target *ti,
return fn(ti, lc->dev, lc->start, ti->len, data);
}
+static long linear_direct_access(struct dm_target *ti, sector_t sector,
+ void __pmem **kaddr, pfn_t *pfn, long size)
+{
+ struct linear_c *lc;
+ struct block_device *tbdev;
+ const struct block_device_operations *tops;
+ sector_t tsector;
+
+ lc = ti->private;
+ tbdev = lc->dev->bdev;
+ tops = tbdev->bd_disk->fops;
+ tsector = linear_map_sector(ti, sector);
+
+ return tops->direct_access(tbdev, tsector, kaddr, pfn, size);
+}
+
static struct target_type linear_target = {
.name = "linear",
.version = {1, 2, 1},
@@ -151,6 +167,7 @@ static struct target_type linear_target = {
.status = linear_status,
.prepare_ioctl = linear_prepare_ioctl,
.iterate_devices = linear_iterate_devices,
+ .direct_access = linear_direct_access,
};
int __init dm_linear_init(void)
[toc] | [prev] | [next] | [standalone]
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-14 00:40 +0200 |
| Subject | [PATCH 6/6] dm: Enable DAX support for mapper device |
| Message-ID | <rJIGu-4a0-35@gated-at.bofh.it> |
| In reply to | #1421388 |
Add a new dm type, DM_TYPE_DAX_BIO_BASED, which indicates
that mapped device supports DAX and is bio based. This new
type is used to assure that all target devices have DAX support
and remain that way after GENHD_FL_DAX is set to mapped device.
At initial table load, GENHD_FL_DAX is set to mapped device
when setting DM_TYPE_DAX_BIO_BASED to the type. Any subsequent
table load to the mapped device must have the same type, or else
it fails per the check in table_load().
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
---
drivers/md/dm-table.c | 12 +++++++++---
drivers/md/dm.c | 9 +++++++--
drivers/md/dm.h | 7 +++++++
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 626a5ec..81138e7 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -833,7 +833,7 @@ static bool __table_type_request_based(unsigned table_type)
static int dm_table_set_type(struct dm_table *t)
{
unsigned i;
- unsigned bio_based = 0, request_based = 0, hybrid = 0;
+ unsigned bio_based = 0, request_based = 0, hybrid = 0, num_dax = 0;
bool use_blk_mq = false;
struct dm_target *tgt;
struct dm_dev_internal *dd;
@@ -849,6 +849,9 @@ static int dm_table_set_type(struct dm_table *t)
else
bio_based = 1;
+ if (tgt->dax_supported)
+ num_dax++;
+
if (bio_based && request_based) {
DMWARN("Inconsistent table: different target types"
" can't be mixed up");
@@ -870,7 +873,10 @@ static int dm_table_set_type(struct dm_table *t)
if (bio_based) {
/* We must use this table as bio-based */
- t->type = DM_TYPE_BIO_BASED;
+ if (num_dax && num_dax == t->num_targets)
+ t->type = DM_TYPE_DAX_BIO_BASED;
+ else
+ t->type = DM_TYPE_BIO_BASED;
return 0;
}
@@ -978,7 +984,7 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *
return -EINVAL;
}
- if (type == DM_TYPE_BIO_BASED)
+ if (dm_type_bio_based(type))
for (i = 0; i < t->num_targets; i++) {
tgt = t->targets + i;
per_io_data_size = max(per_io_data_size, tgt->per_io_data_size);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 6e9f958..41b8912 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2492,7 +2492,7 @@ static void __bind_mempools(struct mapped_device *md, struct dm_table *t)
if (md->bs) {
/* The md already has necessary mempools. */
- if (dm_table_get_type(t) == DM_TYPE_BIO_BASED) {
+ if (dm_type_bio_based(dm_table_get_type(t))) {
/*
* Reload bioset because front_pad may have changed
* because a different table was loaded.
@@ -2659,6 +2659,9 @@ void dm_set_md_type(struct mapped_device *md, unsigned type)
{
BUG_ON(!mutex_is_locked(&md->type_lock));
md->type = type;
+
+ if (type == DM_TYPE_DAX_BIO_BASED)
+ dm_disk(md)->flags |= GENHD_FL_DAX;
}
unsigned dm_get_md_type(struct mapped_device *md)
@@ -2837,7 +2840,7 @@ out_kfree_tag_set:
static unsigned filter_md_type(unsigned type, struct mapped_device *md)
{
- if (type == DM_TYPE_BIO_BASED)
+ if (dm_type_bio_based(type))
return type;
return !md->use_blk_mq ? DM_TYPE_REQUEST_BASED : DM_TYPE_MQ_REQUEST_BASED;
@@ -2867,6 +2870,7 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)
}
break;
case DM_TYPE_BIO_BASED:
+ case DM_TYPE_DAX_BIO_BASED:
dm_init_normal_md_queue(md);
blk_queue_make_request(md->queue, dm_make_request);
/*
@@ -3573,6 +3577,7 @@ struct dm_md_mempools *dm_alloc_md_mempools(struct mapped_device *md, unsigned t
switch (type) {
case DM_TYPE_BIO_BASED:
+ case DM_TYPE_DAX_BIO_BASED:
cachep = _io_cache;
pool_size = dm_get_reserved_bio_based_ios();
front_pad = roundup(per_io_data_size, __alignof__(struct dm_target_io)) + offsetof(struct dm_target_io, clone);
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 13a758e..6d22667 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -39,6 +39,13 @@
#define DM_TYPE_BIO_BASED 1
#define DM_TYPE_REQUEST_BASED 2
#define DM_TYPE_MQ_REQUEST_BASED 3
+#define DM_TYPE_DAX_BIO_BASED 4
+
+/*
+ * To check whether the DM type is bio-based or not.
+ */
+#define dm_type_bio_based(type) (((type) == DM_TYPE_BIO_BASED) || \
+ ((type) == DM_TYPE_DAX_BIO_BASED))
/*
* List of devices that a metadevice uses and should open/close.
[toc] | [prev] | [next] | [standalone]
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-14 00:40 +0200 |
| Subject | [PATCH 3/6] dm: Add dm_blk_direct_access() for mapped device |
| Message-ID | <rJIGv-4a0-55@gated-at.bofh.it> |
| In reply to | #1421388 |
Change mapped device to implement direct_access function,
dm_blk_direct_access(), which calls a target direct_access
function. 'struct target_type' is extended to have target
direct_access interface. This function limits direct
accessible size to the dm_target's limit with max_io_len().
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
---
drivers/md/dm.c | 29 +++++++++++++++++++++++++++++
include/linux/device-mapper.h | 10 ++++++++++
2 files changed, 39 insertions(+)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 1b2f962..6e9f958 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1473,6 +1473,34 @@ int dm_set_target_max_io_len(struct dm_target *ti, sector_t len)
}
EXPORT_SYMBOL_GPL(dm_set_target_max_io_len);
+static long dm_blk_direct_access(struct block_device *bdev, sector_t sector,
+ void __pmem **kaddr, pfn_t *pfn, long size)
+{
+ struct mapped_device *md = bdev->bd_disk->private_data;
+ struct dm_table *map;
+ struct dm_target *ti;
+ int srcu_idx;
+ long len, ret = -EIO;
+
+ map = dm_get_live_table(md, &srcu_idx);
+ if (!map)
+ return ret;
+
+ ti = dm_table_find_target(map, sector);
+ if (!dm_target_is_valid(ti))
+ goto out;
+
+ len = max_io_len(sector, ti) << SECTOR_SHIFT;
+ size = min(len, size);
+
+ if (ti->type->direct_access)
+ ret = ti->type->direct_access(ti, sector, kaddr, pfn, size);
+
+out:
+ dm_put_live_table(md, srcu_idx);
+ return min(ret, size);
+}
+
/*
* A target may call dm_accept_partial_bio only from the map routine. It is
* allowed for all bio types except REQ_FLUSH.
@@ -3721,6 +3749,7 @@ static const struct block_device_operations dm_blk_dops = {
.open = dm_blk_open,
.release = dm_blk_close,
.ioctl = dm_blk_ioctl,
+ .direct_access = dm_blk_direct_access,
.getgeo = dm_blk_getgeo,
.pr_ops = &dm_pr_ops,
.owner = THIS_MODULE
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 0830c9e..16e6c8c 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -116,6 +116,15 @@ typedef void (*dm_io_hints_fn) (struct dm_target *ti,
*/
typedef int (*dm_busy_fn) (struct dm_target *ti);
+/*
+ * Returns:
+ * < 0 : error
+ * >= 0 : the number of bytes accessible at the address
+ */
+typedef long (*dm_direct_access_fn) (struct dm_target *ti, sector_t sector,
+ void __pmem **kaddr, pfn_t *pfn,
+ long size);
+
void dm_error(const char *message);
struct dm_dev {
@@ -162,6 +171,7 @@ struct target_type {
dm_busy_fn busy;
dm_iterate_devices_fn iterate_devices;
dm_io_hints_fn io_hints;
+ dm_direct_access_fn direct_access;
/* For internal device-mapper use. */
struct list_head list;
[toc] | [prev] | [next] | [standalone]
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-14 00:40 +0200 |
| Subject | [PATCH 2/6] block: Check GENHD_FL_DAX for DAX capability |
| Message-ID | <rJIGv-4a0-59@gated-at.bofh.it> |
| In reply to | #1421388 |
Now that GENHD_FL_DAX is set to all drivers supporting DAX, change bdev_direct_access() and __blkdev_get() to check this GENHD_FL_DAX flag. Signed-off-by: Toshi Kani <toshi.kani@hpe.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: <linux-fsdevel@vger.kernel.org> --- fs/block_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 71ccab1..61935ee 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -493,7 +493,7 @@ long bdev_direct_access(struct block_device *bdev, struct blk_dax_ctl *dax) if (size < 0) return size; - if (!ops->direct_access) + if (!(bdev->bd_disk->flags & GENHD_FL_DAX) || !ops->direct_access) return -EOPNOTSUPP; if ((sector + DIV_ROUND_UP(size, 512)) > part_nr_sects_read(bdev->bd_part)) @@ -1287,7 +1287,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) bdev->bd_disk = disk; bdev->bd_queue = disk->queue; bdev->bd_contains = bdev; - if (IS_ENABLED(CONFIG_BLK_DEV_DAX) && disk->fops->direct_access) + if (IS_ENABLED(CONFIG_BLK_DEV_DAX) && + disk->flags & GENHD_FL_DAX) bdev->bd_inode->i_flags = S_DAX; else bdev->bd_inode->i_flags = 0;
[toc] | [prev] | [next] | [standalone]
| From | Toshi Kani <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-14 00:40 +0200 |
| Subject | [PATCH 5/6] dm, dm-linear: Add dax_supported to dm_target |
| Message-ID | <rJIGv-4a0-63@gated-at.bofh.it> |
| In reply to | #1421388 |
Extend 'struct dm_target' to have dax_supported bit, which allows
dm-table to check if a dm-target supports DAX.
Change dm-linear to set this bit when its target physical device
supports DAX.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
---
drivers/md/dm-linear.c | 2 ++
include/linux/device-mapper.h | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
index 49bd7d2..6fdbbc8 100644
--- a/drivers/md/dm-linear.c
+++ b/drivers/md/dm-linear.c
@@ -59,6 +59,8 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv)
ti->num_flush_bios = 1;
ti->num_discard_bios = 1;
ti->num_write_same_bios = 1;
+ if (lc->dev->bdev->bd_disk->flags & GENHD_FL_DAX)
+ ti->dax_supported = 1;
ti->private = lc;
return 0;
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 16e6c8c..9b72989 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -290,6 +290,11 @@ struct dm_target {
* Set if this target does not return zeroes on discarded blocks.
*/
bool discard_zeroes_data_unsupported:1;
+
+ /*
+ * Set if the target supports DAX (direct access).
+ */
+ bool dax_supported:1;
};
/* Each target can link one of these into the table */
[toc] | [prev] | [next] | [standalone]
| From | Mike Snitzer <snitzer@redhat.com> |
|---|---|
| Date | 2016-06-14 01:00 +0200 |
| Message-ID | <rJIZQ-4pp-9@gated-at.bofh.it> |
| In reply to | #1421388 |
On Mon, Jun 13 2016 at 6:21pm -0400, Toshi Kani <toshi.kani@hpe.com> wrote: > This patch-set adds DAX support to device-mapper dm-linear devices > used by LVM. It works with LVM commands as follows: > - Creation of a logical volume with all DAX capable devices (such > as pmem) sets the logical volume DAX capable as well. > - Once a logical volume is set to DAX capable, the volume may not > be extended with non-DAX capable devices. > > The direct_access interface is added to dm and dm-linear to map > a request to a target device. > > - Patch 1-2 introduce GENHD_FL_DAX flag to indicate DAX capability. > - Patch 3-4 add direct_access functions to dm and dm-linear. > - Patch 5-6 set GENHD_FL_DAX to dm when all targets are DAX capable. > > --- > Toshi Kani (6): > 1/6 genhd: Add GENHD_FL_DAX to gendisk flags > 2/6 block: Check GENHD_FL_DAX for DAX capability > 3/6 dm: Add dm_blk_direct_access() for mapped device > 4/6 dm-linear: Add linear_direct_access() > 5/6 dm, dm-linear: Add dax_supported to dm_target > 6/6 dm: Enable DAX support for mapper device Thanks a lot for doing this. I recently added it to my TODO so your patches come at a great time. I'll try to get to reviewing/testing your work by the end of this week. Mike
[toc] | [prev] | [next] | [standalone]
| From | Mike Snitzer <snitzer@redhat.com> |
|---|---|
| Date | 2016-06-20 20:30 +0200 |
| Message-ID | <rMc7n-3jw-11@gated-at.bofh.it> |
| In reply to | #1421421 |
On Mon, Jun 13 2016 at 6:57pm -0400, Mike Snitzer <snitzer@redhat.com> wrote: > On Mon, Jun 13 2016 at 6:21pm -0400, > Toshi Kani <toshi.kani@hpe.com> wrote: > > > This patch-set adds DAX support to device-mapper dm-linear devices > > used by LVM. It works with LVM commands as follows: > > - Creation of a logical volume with all DAX capable devices (such > > as pmem) sets the logical volume DAX capable as well. > > - Once a logical volume is set to DAX capable, the volume may not > > be extended with non-DAX capable devices. > > > > The direct_access interface is added to dm and dm-linear to map > > a request to a target device. > > > > - Patch 1-2 introduce GENHD_FL_DAX flag to indicate DAX capability. > > - Patch 3-4 add direct_access functions to dm and dm-linear. > > - Patch 5-6 set GENHD_FL_DAX to dm when all targets are DAX capable. > > > > --- > > Toshi Kani (6): > > 1/6 genhd: Add GENHD_FL_DAX to gendisk flags > > 2/6 block: Check GENHD_FL_DAX for DAX capability > > 3/6 dm: Add dm_blk_direct_access() for mapped device > > 4/6 dm-linear: Add linear_direct_access() > > 5/6 dm, dm-linear: Add dax_supported to dm_target > > 6/6 dm: Enable DAX support for mapper device > > Thanks a lot for doing this. I recently added it to my TODO so your > patches come at a great time. > > I'll try to get to reviewing/testing your work by the end of this week. I rebased your patches on linux-dm.git's 'for-next' (which includes what I've already staged for the 4.8 merge window). And I folded/changed some of the DM patches so that there are only 2 now (1 for DM core and 1 for dm-linear). Please see the 4 topmost commits in my 'wip' here: http://git.kernel.org/cgit/linux/kernel/git/snitzer/linux.git/log/?h=wip Feel free to pick these patches up to use as the basis for continued work or re-posting of this set.. either that or I could post them as v2 on your behalf. As for testing, I've verified that basic IO works to a pmem-based DM linear device and that mixed table types are rejected as expected. Mike
[toc] | [prev] | [next] | [standalone]
| From | Mike Snitzer <snitzer@redhat.com> |
|---|---|
| Date | 2016-06-20 21:50 +0200 |
| Message-ID | <rMdmO-41g-9@gated-at.bofh.it> |
| In reply to | #1426910 |
On Mon, Jun 20 2016 at 2:31pm -0400,
Kani, Toshimitsu <toshi.kani@hpe.com> wrote:
> On Mon, 2016-06-20 at 14:00 -0400, Mike Snitzer wrote:
> >
> > I rebased your patches on linux-dm.git's 'for-next' (which includes what
> > I've already staged for the 4.8 merge window). And I folded/changed
> > some of the DM patches so that there are only 2 now (1 for DM core and 1
> > for dm-linear). Please see the 4 topmost commits in my 'wip' here:
> >
> > http://git.kernel.org/cgit/linux/kernel/git/snitzer/linux.git/log/?h=wip
> >
> > Feel free to pick these patches up to use as the basis for continued
> > work or re-posting of this set.. either that or I could post them as v2
> > on your behalf.
> >
> > As for testing, I've verified that basic IO works to a pmem-based DM
> > linear device and that mixed table types are rejected as expected.
>
> Great! I will send additional patch, add DAX support to dm-stripe, on top of
> these once I finish my testing.
I did some further testing and am seeing some XFS corruption when
testing a DM linear device that spans multiple pmem devices. I created
2 partitions ontop of /dev/pmem0 (which I created using the howto from
https://nvdimm.wiki.kernel.org). Then I did:
# pvcreate /dev/pmem0p1
# pvcreate /dev/pmem0p2
# vgcreate pmem /dev/pmem0p1 /dev/pmem0p2
# lvcreate -L 2.9G -n lv pmem
# lsblk /dev/pmem0
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
pmem0 259:0 0 6G 0 disk
├─pmem0p1 259:1 0 1G 0 part
│ └─pmem-lv 253:4 0 2.9G 0 lvm
└─pmem0p2 259:2 0 2G 0 part
└─pmem-lv 253:4 0 2.9G 0 lvm
# dmsetup table pmem-lv
0 4186112 linear 259:2 2048
4186112 1900544 linear 259:1 2048
# mkfs.xfs /dev/pmem/lv
# mount -o dax -t xfs /dev/pmem/lv /mnt/dax
[11452.212034] XFS (dm-4): DAX enabled. Warning: EXPERIMENTAL, use at your own risk
[11452.220323] XFS (dm-4): Mounting V4 Filesystem
[11452.226526] XFS (dm-4): Ending clean mount
# dd if=/dev/zero of=/mnt/dax/meh bs=1024K oflag=direct
[11729.754671] XFS (dm-4): Metadata corruption detected at xfs_agf_read_verify+0x70/0x120 [xfs], xfs_agf block 0x45a808
[11729.766423] XFS (dm-4): Unmount and run xfs_repair
[11729.771774] XFS (dm-4): First 64 bytes of corrupted metadata buffer:
[11729.778869] ffff8800b8038000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[11729.788582] ffff8800b8038010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[11729.798293] ffff8800b8038020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[11729.808002] ffff8800b8038030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[11729.817715] XFS (dm-4): metadata I/O error: block 0x45a808 ("xfs_trans_read_buf_map") error 117 numblks 8
When this XFS corruption occurs corruption then also manifests in lvm2's
metadata:
# vgremove pmem
Do you really want to remove volume group "pmem" containing 1 logical volumes? [y/n]: y
Do you really want to remove active logical volume lv? [y/n]: y
Incorrect metadata area header checksum on /dev/pmem0p1 at offset 4096
WARNING: Failed to write an MDA of VG pmem.
Incorrect metadata area header checksum on /dev/pmem0p2 at offset 4096
WARNING: Failed to write an MDA of VG pmem.
Failed to write VG pmem.
Incorrect metadata area header checksum on /dev/pmem0p2 at offset 4096
Incorrect metadata area header checksum on /dev/pmem0p1 at offset 4096
If I don't use XFS, and only issue IO directly to the /dev/pmem/lv, I
don't see this corruption.
[toc] | [prev] | [next] | [standalone]
| From | Mike Snitzer <snitzer@redhat.com> |
|---|---|
| Date | 2016-06-20 23:50 +0200 |
| Message-ID | <rMfeV-5bZ-7@gated-at.bofh.it> |
| In reply to | #1426967 |
On Mon, Jun 20 2016 at 3:40pm -0400,
Mike Snitzer <snitzer@redhat.com> wrote:
> # dd if=/dev/zero of=/mnt/dax/meh bs=1024K oflag=direct
> [11729.754671] XFS (dm-4): Metadata corruption detected at xfs_agf_read_verify+0x70/0x120 [xfs], xfs_agf block 0x45a808
> [11729.766423] XFS (dm-4): Unmount and run xfs_repair
> [11729.771774] XFS (dm-4): First 64 bytes of corrupted metadata buffer:
> [11729.778869] ffff8800b8038000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> [11729.788582] ffff8800b8038010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> [11729.798293] ffff8800b8038020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> [11729.808002] ffff8800b8038030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> [11729.817715] XFS (dm-4): metadata I/O error: block 0x45a808 ("xfs_trans_read_buf_map") error 117 numblks 8
>
> When this XFS corruption occurs corruption then also manifests in lvm2's
> metadata:
>
> # vgremove pmem
> Do you really want to remove volume group "pmem" containing 1 logical volumes? [y/n]: y
> Do you really want to remove active logical volume lv? [y/n]: y
> Incorrect metadata area header checksum on /dev/pmem0p1 at offset 4096
> WARNING: Failed to write an MDA of VG pmem.
> Incorrect metadata area header checksum on /dev/pmem0p2 at offset 4096
> WARNING: Failed to write an MDA of VG pmem.
> Failed to write VG pmem.
> Incorrect metadata area header checksum on /dev/pmem0p2 at offset 4096
> Incorrect metadata area header checksum on /dev/pmem0p1 at offset 4096
>
> If I don't use XFS, and only issue IO directly to the /dev/pmem/lv, I
> don't see this corruption.
I did the same test with ext4 instead of xfs and it resulted in the same
type of systemic corruption (lvm2 metadata corrupted too):
[12816.407147] EXT4-fs (dm-4): DAX enabled. Warning: EXPERIMENTAL, use at your own risk
[12816.416123] EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: dax
[12816.766855] EXT4-fs error (device dm-4): ext4_mb_generate_buddy:758: group 9, block bitmap and bg descriptor inconsistent: 32768 vs 32395 free clusters
[12816.782016] EXT4-fs error (device dm-4): ext4_mb_generate_buddy:758: group 10, block bitmap and bg descriptor inconsistent: 32768 vs 16384 free clusters
[12816.797491] JBD2: Spotted dirty metadata buffer (dev = dm-4, blocknr = 0). There's a risk of filesystem corruption in case of system crash.
# vgremove pmem
Do you really want to remove volume group "pmem" containing 1 logical volumes? [y/n]: y
Do you really want to remove active logical volume lv? [y/n]: y
Incorrect metadata area header checksum on /dev/pmem0p1 at offset 4096
WARNING: Failed to write an MDA of VG pmem.
Incorrect metadata area header checksum on /dev/pmem0p2 at offset 4096
WARNING: Failed to write an MDA of VG pmem.
Failed to write VG pmem.
Incorrect metadata area header checksum on /dev/pmem0p2 at offset 4096
Incorrect metadata area header checksum on /dev/pmem0p1 at offset 4096
[toc] | [prev] | [next] | [standalone]
| From | "Kani, Toshimitsu" <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-21 00:10 +0200 |
| Message-ID | <rMfyi-5y7-27@gated-at.bofh.it> |
| In reply to | #1427077 |
On Mon, 2016-06-20 at 14:01 -0600, Kani, Toshimitsu wrote:
> On Mon, 2016-06-20 at 15:52 -0400, Mike Snitzer wrote:
> >
> > On Mon, Jun 20 2016 at 3:40pm -0400,
> > Mike Snitzer <snitzer@redhat.com> wrote:
> >
:
> > > If I don't use XFS, and only issue IO directly to the /dev/pmem/lv, I
> > > don't see this corruption.
> >
> > I did the same test with ext4 instead of xfs and it resulted in the same
> > type of systemic corruption (lvm2 metadata corrupted too):
> >
:
> I will look into the issue.
Hi Mike,
Can you fold the following patch to the dm-linear patch?
Thanks,
-Tsohi
------
Subject: [PATCH] dm-linear: Fix partition handling for DAX
Partition handling was missing in linear_direct_access().
Call bdev_direct_access(), instead of directly calling
target direct_access function.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
---
drivers/md/dm-linear.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
index 325aa06..38323e4 100644
--- a/drivers/md/dm-linear.c
+++ b/drivers/md/dm-linear.c
@@ -148,10 +148,16 @@ static long linear_direct_access(struct dm_target *ti,
sector_t sector,
{
struct linear_c *lc = ti->private;
struct block_device *bdev = lc->dev->bdev;
- const struct block_device_operations *bd_ops = bdev->bd_disk->fops;
-
- return bd_ops->direct_access(bdev, linear_map_sector(ti, sector),
- kaddr, pfn, size);
+ struct blk_dax_ctl dax = {
+ .sector = linear_map_sector(ti, sector),
+ .size = size,
+ };
+ long ret;
+
+ ret = bdev_direct_access(bdev, &dax);
+ *kaddr = dax.addr;
+ *pfn = dax.pfn;
+ return ret;
}
static struct target_type linear_target = {
[toc] | [prev] | [next] | [standalone]
| From | Mike Snitzer <snitzer@redhat.com> |
|---|---|
| Date | 2016-06-21 00:40 +0200 |
| Message-ID | <rMg1j-5KE-5@gated-at.bofh.it> |
| In reply to | #1427092 |
On Mon, Jun 20 2016 at 5:28pm -0400,
Kani, Toshimitsu <toshi.kani@hpe.com> wrote:
> On Mon, 2016-06-20 at 14:01 -0600, Kani, Toshimitsu wrote:
> > On Mon, 2016-06-20 at 15:52 -0400, Mike Snitzer wrote:
> > >
> > > On Mon, Jun 20 2016 at 3:40pm -0400,
> > > Mike Snitzer <snitzer@redhat.com> wrote:
> > >
> :
> > > > If I don't use XFS, and only issue IO directly to the /dev/pmem/lv, I
> > > > don't see this corruption.
> > >
> > > I did the same test with ext4 instead of xfs and it resulted in the same
> > > type of systemic corruption (lvm2 metadata corrupted too):
> > >
> :
> > I will look into the issue.
>
> Hi Mike,
>
> Can you fold the following patch to the dm-linear patch?
>
> Thanks,
> -Tsohi
>
> ------
> Subject: [PATCH] dm-linear: Fix partition handling for DAX
>
> Partition handling was missing in linear_direct_access().
> Call bdev_direct_access(), instead of directly calling
> target direct_access function.
>
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> ---
> drivers/md/dm-linear.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
> index 325aa06..38323e4 100644
> --- a/drivers/md/dm-linear.c
> +++ b/drivers/md/dm-linear.c
> @@ -148,10 +148,16 @@ static long linear_direct_access(struct dm_target *ti,
> sector_t sector,
> {
> struct linear_c *lc = ti->private;
> struct block_device *bdev = lc->dev->bdev;
> - const struct block_device_operations *bd_ops = bdev->bd_disk->fops;
> -
> - return bd_ops->direct_access(bdev, linear_map_sector(ti, sector),
> - kaddr, pfn, size);
> + struct blk_dax_ctl dax = {
> + .sector = linear_map_sector(ti, sector),
> + .size = size,
> + };
> + long ret;
> +
> + ret = bdev_direct_access(bdev, &dax);
> + *kaddr = dax.addr;
> + *pfn = dax.pfn;
> + return ret;
> }
>
> static struct target_type linear_target = {
Looks good, I folded it in and tested it to work. Pushed to my 'wip'
branch.
No longer seeing any corruption in my test that was using partitions to
span pmem devices with a dm-linear device.
Jens, any chance you'd be open to picking up the first 2 patches in this
series? Or would you like to see them folded or something different?
Mike
[toc] | [prev] | [next] | [standalone]
| From | Mike Snitzer <snitzer@redhat.com> |
|---|---|
| Date | 2016-06-21 15:50 +0200 |
| Message-ID | <rMudX-6uM-3@gated-at.bofh.it> |
| In reply to | #1427112 |
On Mon, Jun 20 2016 at 6:22pm -0400,
Mike Snitzer <snitzer@redhat.com> wrote:
> On Mon, Jun 20 2016 at 5:28pm -0400,
> Kani, Toshimitsu <toshi.kani@hpe.com> wrote:
>
> >
> > Hi Mike,
> >
> > Can you fold the following patch to the dm-linear patch?
> >
> > Thanks,
> > -Tsohi
> >
> > ------
> > Subject: [PATCH] dm-linear: Fix partition handling for DAX
> >
> > Partition handling was missing in linear_direct_access().
> > Call bdev_direct_access(), instead of directly calling
> > target direct_access function.
> >
> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > ---
> > drivers/md/dm-linear.c | 14 ++++++++++----
> > 1 file changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
> > index 325aa06..38323e4 100644
> > --- a/drivers/md/dm-linear.c
> > +++ b/drivers/md/dm-linear.c
> > @@ -148,10 +148,16 @@ static long linear_direct_access(struct dm_target *ti,
> > sector_t sector,
> > {
> > struct linear_c *lc = ti->private;
> > struct block_device *bdev = lc->dev->bdev;
> > - const struct block_device_operations *bd_ops = bdev->bd_disk->fops;
> > -
> > - return bd_ops->direct_access(bdev, linear_map_sector(ti, sector),
> > - kaddr, pfn, size);
> > + struct blk_dax_ctl dax = {
> > + .sector = linear_map_sector(ti, sector),
> > + .size = size,
> > + };
> > + long ret;
> > +
> > + ret = bdev_direct_access(bdev, &dax);
> > + *kaddr = dax.addr;
> > + *pfn = dax.pfn;
> > + return ret;
> > }
> >
> > static struct target_type linear_target = {
>
> Looks good, I folded it in and tested it to work. Pushed to my 'wip'
> branch.
>
> No longer seeing any corruption in my test that was using partitions to
> span pmem devices with a dm-linear device.
>
> Jens, any chance you'd be open to picking up the first 2 patches in this
> series? Or would you like to see them folded or something different?
I'm now wondering if we'd be better off setting a new QUEUE_FLAG_DAX
rather than establish GENHD_FL_DAX on the genhd?
It'd be quite a bit easier to allow upper layers (e.g. XFS and ext4) to
check for a queue flag.
[toc] | [prev] | [next] | [standalone]
| From | "Kani, Toshimitsu" <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-21 18:00 +0200 |
| Message-ID | <rMwfM-7MM-29@gated-at.bofh.it> |
| In reply to | #1427767 |
On Tue, 2016-06-21 at 09:34 -0600, Kani, Toshimitsu wrote: > On Tue, 2016-06-21 at 09:41 -0400, Mike Snitzer wrote: > > > > On Mon, Jun 20 2016 at 6:22pm -0400, > > Mike Snitzer <snitzer@redhat.com> wrote: > > > > > > On Mon, Jun 20 2016 at 5:28pm -0400, > > > Kani, Toshimitsu <toshi.kani@hpe.com> wrote: > > > > : > > > > > > Looks good, I folded it in and tested it to work. Pushed to my 'wip' > > > branch. > > > > > > No longer seeing any corruption in my test that was using partitions > > > to span pmem devices with a dm-linear device. > > > > > > Jens, any chance you'd be open to picking up the first 2 patches in > > > this series? Or would you like to see them folded or something > > > different? > > > > I'm now wondering if we'd be better off setting a new QUEUE_FLAG_DAX > > rather than establish GENHD_FL_DAX on the genhd? > > > > It'd be quite a bit easier to allow upper layers (e.g. XFS and ext4) to > > check for a queue flag. > > I think GENHD_FL_DAX is more appropriate since DAX does not use a request > queue, except for protecting the underlining device being disabled while > direct_access() is called (b2e0d1625e19). Forgot to mention that there are bdev_dax_supported() and bdev_dax_capable() interfaces that can be called from upper layers. They both call bdev_direct_access() which checks GENHD_FL_DAX. Thanks, -Toshi > About protecting direct_access, this patch assumes that the underlining > device cannot be disabled until dtr() is called. Is this correct? If > not, I will need to call dax_map_atomic(). > > Thanks, > -Toshi
[toc] | [prev] | [next] | [standalone]
| From | "Kani, Toshimitsu" <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-21 18:10 +0200 |
| Message-ID | <rMwfM-7MM-31@gated-at.bofh.it> |
| In reply to | #1427767 |
On Tue, 2016-06-21 at 09:41 -0400, Mike Snitzer wrote: > On Mon, Jun 20 2016 at 6:22pm -0400, > Mike Snitzer <snitzer@redhat.com> wrote: > > > > On Mon, Jun 20 2016 at 5:28pm -0400, > > Kani, Toshimitsu <toshi.kani@hpe.com> wrote: > > : > > Looks good, I folded it in and tested it to work. Pushed to my 'wip' > > branch. > > > > No longer seeing any corruption in my test that was using partitions to > > span pmem devices with a dm-linear device. > > > > Jens, any chance you'd be open to picking up the first 2 patches in this > > series? Or would you like to see them folded or something different? > > I'm now wondering if we'd be better off setting a new QUEUE_FLAG_DAX > rather than establish GENHD_FL_DAX on the genhd? > > It'd be quite a bit easier to allow upper layers (e.g. XFS and ext4) to > check for a queue flag. I think GENHD_FL_DAX is more appropriate since DAX does not use a request queue, except for protecting the underlining device being disabled while direct_access() is called (b2e0d1625e19). About protecting direct_access, this patch assumes that the underlining device cannot be disabled until dtr() is called. Is this correct? If not, I will need to call dax_map_atomic(). Thanks, -Toshi
[toc] | [prev] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2016-06-21 18:30 +0200 |
| Message-ID | <rMwIN-8bK-1@gated-at.bofh.it> |
| In reply to | #1427909 |
On Tue, Jun 21, 2016 at 8:44 AM, Kani, Toshimitsu <toshi.kani@hpe.com> wrote: > On Tue, 2016-06-21 at 09:41 -0400, Mike Snitzer wrote: >> On Mon, Jun 20 2016 at 6:22pm -0400, >> Mike Snitzer <snitzer@redhat.com> wrote: >> > >> > On Mon, Jun 20 2016 at 5:28pm -0400, >> > Kani, Toshimitsu <toshi.kani@hpe.com> wrote: >> > > : >> > Looks good, I folded it in and tested it to work. Pushed to my 'wip' >> > branch. >> > >> > No longer seeing any corruption in my test that was using partitions to >> > span pmem devices with a dm-linear device. >> > >> > Jens, any chance you'd be open to picking up the first 2 patches in this >> > series? Or would you like to see them folded or something different? >> >> I'm now wondering if we'd be better off setting a new QUEUE_FLAG_DAX >> rather than establish GENHD_FL_DAX on the genhd? >> >> It'd be quite a bit easier to allow upper layers (e.g. XFS and ext4) to >> check for a queue flag. > > I think GENHD_FL_DAX is more appropriate since DAX does not use a request > queue, except for protecting the underlining device being disabled while > direct_access() is called (b2e0d1625e19). > > About protecting direct_access, this patch assumes that the underlining > device cannot be disabled until dtr() is called. Is this correct? If not, > I will need to call dax_map_atomic(). Kernel internal usages of dax should be using dax_map_atomic() to safely resolve device removal races.
[toc] | [prev] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2016-06-21 18:50 +0200 |
| Message-ID | <rMx29-8iu-7@gated-at.bofh.it> |
| In reply to | #1427925 |
On Tue, Jun 21, 2016 at 9:35 AM, Kani, Toshimitsu <toshi.kani@hpe.com> wrote: > On Tue, 2016-06-21 at 09:25 -0700, Dan Williams wrote: >> On Tue, Jun 21, 2016 at 8:44 AM, Kani, Toshimitsu <toshi.kani@hpe.com> >> wrote: >> > >> > On Tue, 2016-06-21 at 09:41 -0400, Mike Snitzer wrote: >> > > >> > > On Mon, Jun 20 2016 at 6:22pm -0400, >> > > Mike Snitzer <snitzer@redhat.com> wrote: >> > > > >> > > > On Mon, Jun 20 2016 at 5:28pm -0400, >> > > > Kani, Toshimitsu <toshi.kani@hpe.com> wrote: >> > : >> > > > Looks good, I folded it in and tested it to work. Pushed to my 'wip' >> > > > branch. >> > > > >> > > > No longer seeing any corruption in my test that was using partitions >> > > > to span pmem devices with a dm-linear device. >> > > > >> > > > Jens, any chance you'd be open to picking up the first 2 patches in >> > > > this series? Or would you like to see them folded or something >> > > > different? >> > > >> > > I'm now wondering if we'd be better off setting a new QUEUE_FLAG_DAX >> > > rather than establish GENHD_FL_DAX on the genhd? >> > > >> > > It'd be quite a bit easier to allow upper layers (e.g. XFS and ext4) to >> > > check for a queue flag. >> > >> > I think GENHD_FL_DAX is more appropriate since DAX does not use a request >> > queue, except for protecting the underlining device being disabled while >> > direct_access() is called (b2e0d1625e19). >> > >> > About protecting direct_access, this patch assumes that the underlining >> > device cannot be disabled until dtr() is called. Is this correct? If >> > not, I will need to call dax_map_atomic(). >> >> Kernel internal usages of dax should be using dax_map_atomic() to >> safely resolve device removal races. > > Will do. In such case, shall I move dax_[un]map_atomic() to block_dev.c and > rename them to bdev_dax_[un]map_atomic()? Sounds good to me. I know Jeff and Christoph don't like the current calling convention of passing in a structure. Just note that they might ask you to change it back to a list of parameters if it moves to bdev_dax_map_atomic().
[toc] | [prev] | [next] | [standalone]
| From | "Kani, Toshimitsu" <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-21 19:20 +0200 |
| Message-ID | <rMxvb-ii-7@gated-at.bofh.it> |
| In reply to | #1427945 |
On Tue, 2016-06-21 at 09:45 -0700, Dan Williams wrote: > On Tue, Jun 21, 2016 at 9:35 AM, Kani, Toshimitsu <toshi.kani@hpe.com> > wrote: > > On Tue, 2016-06-21 at 09:25 -0700, Dan Williams wrote: > > > On Tue, Jun 21, 2016 at 8:44 AM, Kani, Toshimitsu <toshi.kani@hpe.com> > > > wrote: > > > > : > > > > I think GENHD_FL_DAX is more appropriate since DAX does not use a > > > > request queue, except for protecting the underlining device being > > > > disabled while direct_access() is called (b2e0d1625e19). > > > > > > > > About protecting direct_access, this patch assumes that the > > > > underlining device cannot be disabled until dtr() is called. Is this > > > > correct? If not, I will need to call dax_map_atomic(). > > > > > > Kernel internal usages of dax should be using dax_map_atomic() to > > > safely resolve device removal races. > > > > Will do. In such case, shall I move dax_[un]map_atomic() to block_dev.c > > and rename them to bdev_dax_[un]map_atomic()? > > Sounds good to me. I know Jeff and Christoph don't like the current > calling convention of passing in a structure. Just note that they > might ask you to change it back to a list of parameters if it moves to > bdev_dax_map_atomic(). OK, I will change it back to a list of parameters as well. Thanks, -Toshi
[toc] | [prev] | [next] | [standalone]
| From | "Kani, Toshimitsu" <toshi.kani@hpe.com> |
|---|---|
| Date | 2016-06-21 19:00 +0200 |
| Message-ID | <rMx29-8iu-9@gated-at.bofh.it> |
| In reply to | #1427925 |
On Tue, 2016-06-21 at 09:25 -0700, Dan Williams wrote: > On Tue, Jun 21, 2016 at 8:44 AM, Kani, Toshimitsu <toshi.kani@hpe.com> > wrote: > > > > On Tue, 2016-06-21 at 09:41 -0400, Mike Snitzer wrote: > > > > > > On Mon, Jun 20 2016 at 6:22pm -0400, > > > Mike Snitzer <snitzer@redhat.com> wrote: > > > > > > > > On Mon, Jun 20 2016 at 5:28pm -0400, > > > > Kani, Toshimitsu <toshi.kani@hpe.com> wrote: > > : > > > > Looks good, I folded it in and tested it to work. Pushed to my 'wip' > > > > branch. > > > > > > > > No longer seeing any corruption in my test that was using partitions > > > > to span pmem devices with a dm-linear device. > > > > > > > > Jens, any chance you'd be open to picking up the first 2 patches in > > > > this series? Or would you like to see them folded or something > > > > different? > > > > > > I'm now wondering if we'd be better off setting a new QUEUE_FLAG_DAX > > > rather than establish GENHD_FL_DAX on the genhd? > > > > > > It'd be quite a bit easier to allow upper layers (e.g. XFS and ext4) to > > > check for a queue flag. > > > > I think GENHD_FL_DAX is more appropriate since DAX does not use a request > > queue, except for protecting the underlining device being disabled while > > direct_access() is called (b2e0d1625e19). > > > > About protecting direct_access, this patch assumes that the underlining > > device cannot be disabled until dtr() is called. Is this correct? If > > not, I will need to call dax_map_atomic(). > > Kernel internal usages of dax should be using dax_map_atomic() to > safely resolve device removal races. Will do. In such case, shall I move dax_[un]map_atomic() to block_dev.c and rename them to bdev_dax_[un]map_atomic()? Thanks, -Toshi
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web