Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff23908b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-4.18/dm-fixes' of...

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
parents 2cd3ae21 dbc62659
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
{
	struct dax_device *dax_dev;
	bool dax_enabled = false;
	struct request_queue *q;
	pgoff_t pgoff;
	int err, id;
	void *kaddr;
@@ -99,6 +100,13 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
		return false;
	}

	q = bdev_get_queue(bdev);
	if (!q || !blk_queue_dax(q)) {
		pr_debug("%s: error: request queue doesn't support dax\n",
				bdevname(bdev, buf));
		return false;
	}

	err = bdev_dax_pgoff(bdev, 0, PAGE_SIZE, &pgoff);
	if (err) {
		pr_debug("%s: error: unaligned partition for dax\n",
+1 −1
Original line number Diff line number Diff line
@@ -588,7 +588,7 @@ static const char *raid10_md_layout_to_format(int layout)
}

/* Return md raid10 algorithm for @name */
static const int raid10_name_to_format(const char *name)
static int raid10_name_to_format(const char *name)
{
	if (!strcasecmp(name, "near"))
		return ALGORITHM_RAID10_NEAR;
+4 −3
Original line number Diff line number Diff line
@@ -885,9 +885,7 @@ EXPORT_SYMBOL_GPL(dm_table_set_type);
static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
			       sector_t start, sector_t len, void *data)
{
	struct request_queue *q = bdev_get_queue(dev->bdev);

	return q && blk_queue_dax(q);
	return bdev_dax_supported(dev->bdev, PAGE_SIZE);
}

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,

	if (dm_table_supports_dax(t))
		blk_queue_flag_set(QUEUE_FLAG_DAX, q);
	else
		blk_queue_flag_clear(QUEUE_FLAG_DAX, q);

	if (dm_table_supports_dax_write_cache(t))
		dax_write_cache(t->md->dax_dev, true);

+0 −9
Original line number Diff line number Diff line
@@ -776,7 +776,6 @@ static int __write_changed_details(struct dm_pool_metadata *pmd)
static int __commit_transaction(struct dm_pool_metadata *pmd)
{
	int r;
	size_t metadata_len, data_len;
	struct thin_disk_superblock *disk_super;
	struct dm_block *sblock;

@@ -797,14 +796,6 @@ static int __commit_transaction(struct dm_pool_metadata *pmd)
	if (r < 0)
		return r;

	r = dm_sm_root_size(pmd->metadata_sm, &metadata_len);
	if (r < 0)
		return r;

	r = dm_sm_root_size(pmd->data_sm, &data_len);
	if (r < 0)
		return r;

	r = save_sm_roots(pmd);
	if (r < 0)
		return r;
+9 −2
Original line number Diff line number Diff line
@@ -1386,6 +1386,8 @@ static void schedule_external_copy(struct thin_c *tc, dm_block_t virt_block,

static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);

static void requeue_bios(struct pool *pool);

static void check_for_space(struct pool *pool)
{
	int r;
@@ -1398,8 +1400,10 @@ static void check_for_space(struct pool *pool)
	if (r)
		return;

	if (nr_free)
	if (nr_free) {
		set_pool_mode(pool, PM_WRITE);
		requeue_bios(pool);
	}
}

/*
@@ -1476,6 +1480,9 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result)

	r = dm_pool_alloc_data_block(pool->pmd, result);
	if (r) {
		if (r == -ENOSPC)
			set_pool_mode(pool, PM_OUT_OF_DATA_SPACE);
		else
			metadata_operation_failed(pool, "dm_pool_alloc_data_block", r);
		return r;
	}
Loading