History

Merge tag 'for-4.18/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device mapper fixes from Mike Snitzer: - Fix dm core to use more efficient bio_split() instead of bio_clone_bioset(). Also fixes splitting bio that has integrity payload. - Three fixes related to properly validating DAX capabilities of a stacked DM device that will advertise DAX support. - Update DM writecache target to use 2-factor allocator arguments. Kees says this is the last related change for 4.18. - Fix DM zoned target to use GFP_NOIO to avoid triggering reclaim during IO submission (caught by lockdep). - Fix DM thinp to gracefully recover from running out of data space while a previous async discard completes (whereby freeing space). - Fix DM thinp's metadata transaction commit to avoid needless work. * tag 'for-4.18/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm: prevent DAX mounts if not supported dax: check for QUEUE_FLAG_DAX in bdev_dax_supported() pmem: only set QUEUE_FLAG_DAX for fsdax mode dm thin: handle running out of data space vs concurrent discard dm raid: don't use 'const' in function return dm zoned: avoid triggering reclaim from inside dmz_map() dm writecache: use 2-factor allocator arguments dm thin metadata: remove needless work from __commit_transaction dm: use bio_split() when splitting out the already processed bio

Linus Torvalds committed 8 years ago

Commit ff239082 parents 2cd3ae2 dbc62659 files · +33 −27Browse files

Unified · Split

9 files
  1. drivers/dax/super.c +8 −0
  2. drivers/md/dm-raid.c +1 −1
  3. drivers/md/dm-table.c +4 −3
  4. drivers/md/dm-thin-metadata.c +0 −9
  5. drivers/md/dm-thin.c +9 −2
  6. drivers/md/dm-writecache.c +5 −5
  7. drivers/md/dm-zoned-target.c +1 −1
  8. drivers/md/dm.c +3 −5
  9. drivers/nvdimm/pmem.c +2 −1
drivers/dax/super.c+8−0
@@ -86,6 +86,7 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize) · 85 unmodified lines
8686 {
8787 struct dax_device *dax_dev;
8888 bool dax_enabled = false;
89+ struct request_queue *q;
8990 pgoff_t pgoff;
9091 int err, id;
9192 void *kaddr;
@@ -99,6 +100,13 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize) · 7 unmodified lines
99100 return false;
100101 }
101102
103+ q = bdev_get_queue(bdev);
104+ if (!q || !blk_queue_dax(q)) {
105+ pr_debug("%s: error: request queue doesn't support dax\n",
106+ bdevname(bdev, buf));
107+ return false;
108+ }
109+
102110 err = bdev_dax_pgoff(bdev, 0, PAGE_SIZE, &pgoff);
103111 if (err) {
104112 pr_debug("%s: error: unaligned partition for dax\n",
drivers/md/dm-raid.c+1−1
@@ -588,7 +588,7 @@ static const char *raid10_md_layout_to_format(int layout) · 587 unmodified lines
588588 }
589589
590590 /* Return md raid10 algorithm for @name */
591−static const int raid10_name_to_format(const char *name)
591+static int raid10_name_to_format(const char *name)
592592 {
593593 if (!strcasecmp(name, "near"))
594594 return ALGORITHM_RAID10_NEAR;
drivers/md/dm-table.c+4−3
@@ -885,9 +885,7 @@ EXPORT_SYMBOL_GPL(dm_table_set_type); · 884 unmodified lines
885885 static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
886886 sector_t start, sector_t len, void *data)
887887 {
888− struct request_queue *q = bdev_get_queue(dev->bdev);
889−
890− return q && blk_queue_dax(q);
888+ return bdev_dax_supported(dev->bdev, PAGE_SIZE);
891889 }
892890
893891 static bool dm_table_supports_dax(struct dm_table *t)
@@ -1907,6 +1905,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, · 1013 unmodified lines
19071905
19081906 if (dm_table_supports_dax(t))
19091907 blk_queue_flag_set(QUEUE_FLAG_DAX, q);
1908+ else
1909+ blk_queue_flag_clear(QUEUE_FLAG_DAX, q);
1910+
19101911 if (dm_table_supports_dax_write_cache(t))
19111912 dax_write_cache(t->md->dax_dev, true);
19121913
drivers/md/dm-thin-metadata.c+0−9
@@ -776,7 +776,6 @@ static int __write_changed_details(struct dm_pool_metadata *pmd) · 775 unmodified lines
776776 static int __commit_transaction(struct dm_pool_metadata *pmd)
777777 {
778778 int r;
779− size_t metadata_len, data_len;
780779 struct thin_disk_superblock *disk_super;
781780 struct dm_block *sblock;
782781
@@ -797,14 +796,6 @@ static int __commit_transaction(struct dm_pool_metadata *pmd) · 14 unmodified lines
797796 if (r < 0)
798797 return r;
799798
800− r = dm_sm_root_size(pmd->metadata_sm, &metadata_len);
801− if (r < 0)
802− return r;
803−
804− r = dm_sm_root_size(pmd->data_sm, &data_len);
805− if (r < 0)
806− return r;
807−
808799 r = save_sm_roots(pmd);
809800 if (r < 0)
810801 return r;
drivers/md/dm-thin.c+9−2
@@ -1386,6 +1386,8 @@ static void schedule_external_copy(struct thin_c *tc, dm_block_t virt_block, · 1385 unmodified lines
13861386
13871387 static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);
13881388
1389+static void requeue_bios(struct pool *pool);
1390+
13891391 static void check_for_space(struct pool *pool)
13901392 {
13911393 int r;
@@ -1398,8 +1400,10 @@ static void check_for_space(struct pool *pool) · 6 unmodified lines
13981400 if (r)
13991401 return;
14001402
1401− if (nr_free)
1403+ if (nr_free) {
14021404 set_pool_mode(pool, PM_WRITE);
1405+ requeue_bios(pool);
1406+ }
14031407 }
14041408
14051409 /*
@@ -1476,7 +1480,10 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) · 70 unmodified lines
14761480
14771481 r = dm_pool_alloc_data_block(pool->pmd, result);
14781482 if (r) {
1479− metadata_operation_failed(pool, "dm_pool_alloc_data_block", r);
1483+ if (r == -ENOSPC)
1484+ set_pool_mode(pool, PM_OUT_OF_DATA_SPACE);
1485+ else
1486+ metadata_operation_failed(pool, "dm_pool_alloc_data_block", r);
14801487 return r;
14811488 }
14821489
drivers/md/dm-writecache.c+5−5
@@ -259,7 +259,7 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 258 unmodified lines
259259 if (da != p) {
260260 long i;
261261 wc->memory_map = NULL;
262− pages = kvmalloc(p * sizeof(struct page *), GFP_KERNEL);
262+ pages = kvmalloc_array(p, sizeof(struct page *), GFP_KERNEL);
263263 if (!pages) {
264264 r = -ENOMEM;
265265 goto err2;
@@ -859,7 +859,7 @@ static int writecache_alloc_entries(struct dm_writecache *wc) · 593 unmodified lines
859859
860860 if (wc->entries)
861861 return 0;
862− wc->entries = vmalloc(sizeof(struct wc_entry) * wc->n_blocks);
862+ wc->entries = vmalloc(array_size(sizeof(struct wc_entry), wc->n_blocks));
863863 if (!wc->entries)
864864 return -ENOMEM;
865865 for (b = 0; b < wc->n_blocks; b++) {
@@ -1481,9 +1481,9 @@ static void __writecache_writeback_pmem(struct dm_writecache *wc, struct writeba · 615 unmodified lines
14811481 wb->bio.bi_iter.bi_sector = read_original_sector(wc, e);
14821482 wb->page_offset = PAGE_SIZE;
14831483 if (max_pages <= WB_LIST_INLINE ||
1484− unlikely(!(wb->wc_list = kmalloc(max_pages * sizeof(struct wc_entry *),
1485− GFP_NOIO | __GFP_NORETRY |
1486− __GFP_NOMEMALLOC | __GFP_NOWARN)))) {
1484+ unlikely(!(wb->wc_list = kmalloc_array(max_pages, sizeof(struct wc_entry *),
1485+ GFP_NOIO | __GFP_NORETRY |
1486+ __GFP_NOMEMALLOC | __GFP_NOWARN)))) {
14871487 wb->wc_list = wb->wc_list_inline;
14881488 max_pages = WB_LIST_INLINE;
14891489 }
drivers/md/dm-zoned-target.c+1−1
@@ -787,7 +787,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 786 unmodified lines
787787
788788 /* Chunk BIO work */
789789 mutex_init(&dmz->chunk_lock);
790− INIT_RADIX_TREE(&dmz->chunk_rxtree, GFP_KERNEL);
790+ INIT_RADIX_TREE(&dmz->chunk_rxtree, GFP_NOIO);
791791 dmz->chunk_wq = alloc_workqueue("dmz_cwq_%s", WQ_MEM_RECLAIM | WQ_UNBOUND,
792792 0, dev->name);
793793 if (!dmz->chunk_wq) {
drivers/md/dm.c+3−5
@@ -1056,8 +1056,7 @@ static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, · 1055 unmodified lines
10561056 if (len < 1)
10571057 goto out;
10581058 nr_pages = min(len, nr_pages);
1059− if (ti->type->direct_access)
1060− ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn);
1059+ ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn);
10611060
10621061 out:
10631062 dm_put_live_table(md, srcu_idx);
@@ -1606,10 +1605,9 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, · 542 unmodified lines
16061605 * the usage of io->orig_bio in dm_remap_zone_report()
16071606 * won't be affected by this reassignment.
16081607 */
1609− struct bio *b = bio_clone_bioset(bio, GFP_NOIO,
1610− &md->queue->bio_split);
1608+ struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count,
1609+ GFP_NOIO, &md->queue->bio_split);
16111610 ci.io->orig_bio = b;
1612− bio_advance(bio, (bio_sectors(bio) - ci.sector_count) << 9);
16131611 bio_chain(b, bio);
16141612 ret = generic_make_request(bio);
16151613 break;
drivers/nvdimm/pmem.c+2−1
@@ -414,7 +414,8 @@ static int pmem_attach_disk(struct device *dev, · 413 unmodified lines
414414 blk_queue_logical_block_size(q, pmem_sector_size(ndns));
415415 blk_queue_max_hw_sectors(q, UINT_MAX);
416416 blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
417− blk_queue_flag_set(QUEUE_FLAG_DAX, q);
417+ if (pmem->pfn_flags & PFN_MAP)
418+ blk_queue_flag_set(QUEUE_FLAG_DAX, q);
418419 q->queuedata = pmem;
419420
420421 disk = alloc_disk_node(0, nid);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t