Skip to content

Commit e13e75b

Browse files
committed
Merge branch 'for-4.17/dax' into libnvdimm-for-next
2 parents 1ed41b5 + 976431b commit e13e75b

60 files changed

Lines changed: 1637 additions & 1298 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/admin-guide/kernel-parameters.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,17 @@
17661766

17671767
nohz
17681768
Disable the tick when a single task runs.
1769+
1770+
A residual 1Hz tick is offloaded to workqueues, which you
1771+
need to affine to housekeeping through the global
1772+
workqueue's affinity configured via the
1773+
/sys/devices/virtual/workqueue/cpumask sysfs file, or
1774+
by using the 'domain' flag described below.
1775+
1776+
NOTE: by default the global workqueue runs on all CPUs,
1777+
so to protect individual CPUs the 'cpumask' file has to
1778+
be configured manually after bootup.
1779+
17691780
domain
17701781
Isolate from the general SMP balancing and scheduling
17711782
algorithms. Note that performing domain isolation this way

‎drivers/dax/Kconfig‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
config DAX_DRIVER
2+
select DAX
3+
bool
4+
15
menuconfig DAX
26
tristate "DAX: direct access to differentiated memory"
37
select SRCU
@@ -16,7 +20,6 @@ config DEV_DAX
1620
baseline memory pool. Mappings of a /dev/daxX.Y device impose
1721
restrictions that make the mapping behavior deterministic.
1822

19-
2023
config DEV_DAX_PMEM
2124
tristate "PMEM DAX: direct access to persistent memory"
2225
depends on LIBNVDIMM && NVDIMM_DAX && DEV_DAX

‎drivers/dax/super.c‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,19 @@ int __bdev_dax_supported(struct super_block *sb, int blocksize)
124124
return len < 0 ? len : -EIO;
125125
}
126126

127-
if ((IS_ENABLED(CONFIG_FS_DAX_LIMITED) && pfn_t_special(pfn))
128-
|| pfn_t_devmap(pfn))
127+
if (IS_ENABLED(CONFIG_FS_DAX_LIMITED) && pfn_t_special(pfn)) {
128+
/*
129+
* An arch that has enabled the pmem api should also
130+
* have its drivers support pfn_t_devmap()
131+
*
132+
* This is a developer warning and should not trigger in
133+
* production. dax_flush() will crash since it depends
134+
* on being able to do (page_address(pfn_to_page())).
135+
*/
136+
WARN_ON(IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API));
137+
} else if (pfn_t_devmap(pfn)) {
129138
/* pass */;
130-
else {
139+
} else {
131140
pr_debug("VFS (%s): error: dax support not enabled\n",
132141
sb->s_id);
133142
return -EOPNOTSUPP;

‎drivers/md/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ config BLK_DEV_DM_BUILTIN
201201
config BLK_DEV_DM
202202
tristate "Device mapper support"
203203
select BLK_DEV_DM_BUILTIN
204-
select DAX
204+
depends on DAX || DAX=n
205205
---help---
206206
Device-mapper is a low level volume manager. It works by allowing
207207
people to specify mappings for ranges of logical sectors. Various

‎drivers/md/dm-linear.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ static int linear_iterate_devices(struct dm_target *ti,
154154
return fn(ti, lc->dev, lc->start, ti->len, data);
155155
}
156156

157+
#if IS_ENABLED(CONFIG_DAX_DRIVER)
157158
static long linear_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
158159
long nr_pages, void **kaddr, pfn_t *pfn)
159160
{
@@ -184,6 +185,11 @@ static size_t linear_dax_copy_from_iter(struct dm_target *ti, pgoff_t pgoff,
184185
return dax_copy_from_iter(dax_dev, pgoff, addr, bytes, i);
185186
}
186187

188+
#else
189+
#define linear_dax_direct_access NULL
190+
#define linear_dax_copy_from_iter NULL
191+
#endif
192+
187193
static struct target_type linear_target = {
188194
.name = "linear",
189195
.version = {1, 4, 0},

‎drivers/md/dm-log-writes.c‎

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -610,51 +610,6 @@ static int log_mark(struct log_writes_c *lc, char *data)
610610
return 0;
611611
}
612612

613-
static int log_dax(struct log_writes_c *lc, sector_t sector, size_t bytes,
614-
struct iov_iter *i)
615-
{
616-
struct pending_block *block;
617-
618-
if (!bytes)
619-
return 0;
620-
621-
block = kzalloc(sizeof(struct pending_block), GFP_KERNEL);
622-
if (!block) {
623-
DMERR("Error allocating dax pending block");
624-
return -ENOMEM;
625-
}
626-
627-
block->data = kzalloc(bytes, GFP_KERNEL);
628-
if (!block->data) {
629-
DMERR("Error allocating dax data space");
630-
kfree(block);
631-
return -ENOMEM;
632-
}
633-
634-
/* write data provided via the iterator */
635-
if (!copy_from_iter(block->data, bytes, i)) {
636-
DMERR("Error copying dax data");
637-
kfree(block->data);
638-
kfree(block);
639-
return -EIO;
640-
}
641-
642-
/* rewind the iterator so that the block driver can use it */
643-
iov_iter_revert(i, bytes);
644-
645-
block->datalen = bytes;
646-
block->sector = bio_to_dev_sectors(lc, sector);
647-
block->nr_sectors = ALIGN(bytes, lc->sectorsize) >> lc->sectorshift;
648-
649-
atomic_inc(&lc->pending_blocks);
650-
spin_lock_irq(&lc->blocks_lock);
651-
list_add_tail(&block->list, &lc->unflushed_blocks);
652-
spin_unlock_irq(&lc->blocks_lock);
653-
wake_up_process(lc->log_kthread);
654-
655-
return 0;
656-
}
657-
658613
static void log_writes_dtr(struct dm_target *ti)
659614
{
660615
struct log_writes_c *lc = ti->private;
@@ -920,6 +875,52 @@ static void log_writes_io_hints(struct dm_target *ti, struct queue_limits *limit
920875
limits->io_min = limits->physical_block_size;
921876
}
922877

878+
#if IS_ENABLED(CONFIG_DAX_DRIVER)
879+
static int log_dax(struct log_writes_c *lc, sector_t sector, size_t bytes,
880+
struct iov_iter *i)
881+
{
882+
struct pending_block *block;
883+
884+
if (!bytes)
885+
return 0;
886+
887+
block = kzalloc(sizeof(struct pending_block), GFP_KERNEL);
888+
if (!block) {
889+
DMERR("Error allocating dax pending block");
890+
return -ENOMEM;
891+
}
892+
893+
block->data = kzalloc(bytes, GFP_KERNEL);
894+
if (!block->data) {
895+
DMERR("Error allocating dax data space");
896+
kfree(block);
897+
return -ENOMEM;
898+
}
899+
900+
/* write data provided via the iterator */
901+
if (!copy_from_iter(block->data, bytes, i)) {
902+
DMERR("Error copying dax data");
903+
kfree(block->data);
904+
kfree(block);
905+
return -EIO;
906+
}
907+
908+
/* rewind the iterator so that the block driver can use it */
909+
iov_iter_revert(i, bytes);
910+
911+
block->datalen = bytes;
912+
block->sector = bio_to_dev_sectors(lc, sector);
913+
block->nr_sectors = ALIGN(bytes, lc->sectorsize) >> lc->sectorshift;
914+
915+
atomic_inc(&lc->pending_blocks);
916+
spin_lock_irq(&lc->blocks_lock);
917+
list_add_tail(&block->list, &lc->unflushed_blocks);
918+
spin_unlock_irq(&lc->blocks_lock);
919+
wake_up_process(lc->log_kthread);
920+
921+
return 0;
922+
}
923+
923924
static long log_writes_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
924925
long nr_pages, void **kaddr, pfn_t *pfn)
925926
{
@@ -956,6 +957,10 @@ static size_t log_writes_dax_copy_from_iter(struct dm_target *ti,
956957
dax_copy:
957958
return dax_copy_from_iter(lc->dev->dax_dev, pgoff, addr, bytes, i);
958959
}
960+
#else
961+
#define log_writes_dax_direct_access NULL
962+
#define log_writes_dax_copy_from_iter NULL
963+
#endif
959964

960965
static struct target_type log_writes_target = {
961966
.name = "log-writes",

‎drivers/md/dm-stripe.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ static int stripe_map(struct dm_target *ti, struct bio *bio)
311311
return DM_MAPIO_REMAPPED;
312312
}
313313

314+
#if IS_ENABLED(CONFIG_DAX_DRIVER)
314315
static long stripe_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
315316
long nr_pages, void **kaddr, pfn_t *pfn)
316317
{
@@ -351,6 +352,11 @@ static size_t stripe_dax_copy_from_iter(struct dm_target *ti, pgoff_t pgoff,
351352
return dax_copy_from_iter(dax_dev, pgoff, addr, bytes, i);
352353
}
353354

355+
#else
356+
#define stripe_dax_direct_access NULL
357+
#define stripe_dax_copy_from_iter NULL
358+
#endif
359+
354360
/*
355361
* Stripe status:
356362
*

‎drivers/md/dm.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ static void cleanup_mapped_device(struct mapped_device *md)
18051805
static struct mapped_device *alloc_dev(int minor)
18061806
{
18071807
int r, numa_node_id = dm_get_numa_node();
1808-
struct dax_device *dax_dev;
1808+
struct dax_device *dax_dev = NULL;
18091809
struct mapped_device *md;
18101810
void *old_md;
18111811

@@ -1871,9 +1871,11 @@ static struct mapped_device *alloc_dev(int minor)
18711871
md->disk->private_data = md;
18721872
sprintf(md->disk->disk_name, "dm-%d", minor);
18731873

1874-
dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops);
1875-
if (!dax_dev)
1876-
goto bad;
1874+
if (IS_ENABLED(CONFIG_DAX_DRIVER)) {
1875+
dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops);
1876+
if (!dax_dev)
1877+
goto bad;
1878+
}
18771879
md->dax_dev = dax_dev;
18781880

18791881
add_disk_no_queue_reg(md->disk);

‎drivers/nvdimm/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if LIBNVDIMM
2020
config BLK_DEV_PMEM
2121
tristate "PMEM: Persistent memory block device support"
2222
default LIBNVDIMM
23-
select DAX
23+
select DAX_DRIVER
2424
select ND_BTT if BTT
2525
select ND_PFN if NVDIMM_PFN
2626
help

‎drivers/s390/block/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ config BLK_DEV_XPRAM
1515

1616
config DCSSBLK
1717
def_tristate m
18-
select DAX
1918
select FS_DAX_LIMITED
19+
select DAX_DRIVER
2020
prompt "DCSSBLK support"
2121
depends on S390 && BLOCK
2222
help

0 commit comments

Comments
 (0)