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

Commit b49249d1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull dm update from Alasdair G Kergon:
 "Miscellaneous device-mapper fixes, cleanups and performance
  improvements.

  Of particular note:
   - Disable broken WRITE SAME support in all targets except linear and
     striped.  Use it when kcopyd is zeroing blocks.
   - Remove several mempools from targets by moving the data into the
     bio's new front_pad area(which dm calls 'per_bio_data').
   - Fix a race in thin provisioning if discards are misused.
   - Prevent userspace from interfering with the ioctl parameters and
     use kmalloc for the data buffer if it's small instead of vmalloc.
   - Throttle some annoying error messages when I/O fails."

* tag 'dm-3.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm: (36 commits)
  dm stripe: add WRITE SAME support
  dm: remove map_info
  dm snapshot: do not use map_context
  dm thin: dont use map_context
  dm raid1: dont use map_context
  dm flakey: dont use map_context
  dm raid1: rename read_record to bio_record
  dm: move target request nr to dm_target_io
  dm snapshot: use per_bio_data
  dm verity: use per_bio_data
  dm raid1: use per_bio_data
  dm: introduce per_bio_data
  dm kcopyd: add WRITE SAME support to dm_kcopyd_zero
  dm linear: add WRITE SAME support
  dm: add WRITE SAME support
  dm: prepare to support WRITE SAME
  dm ioctl: use kmalloc if possible
  dm ioctl: remove PF_MEMALLOC
  dm persistent data: improve improve space map block alloc failure message
  dm thin: use DMERR_LIMIT for errors
  ...
parents 10532b56 45e621d4
Loading
Loading
Loading
Loading
+0 −25
Original line number Original line Diff line number Diff line
@@ -207,31 +207,6 @@ void dm_cell_release(struct dm_bio_prison_cell *cell, struct bio_list *bios)
}
}
EXPORT_SYMBOL_GPL(dm_cell_release);
EXPORT_SYMBOL_GPL(dm_cell_release);


/*
 * There are a couple of places where we put a bio into a cell briefly
 * before taking it out again.  In these situations we know that no other
 * bio may be in the cell.  This function releases the cell, and also does
 * a sanity check.
 */
static void __cell_release_singleton(struct dm_bio_prison_cell *cell, struct bio *bio)
{
	BUG_ON(cell->holder != bio);
	BUG_ON(!bio_list_empty(&cell->bios));

	__cell_release(cell, NULL);
}

void dm_cell_release_singleton(struct dm_bio_prison_cell *cell, struct bio *bio)
{
	unsigned long flags;
	struct dm_bio_prison *prison = cell->prison;

	spin_lock_irqsave(&prison->lock, flags);
	__cell_release_singleton(cell, bio);
	spin_unlock_irqrestore(&prison->lock, flags);
}
EXPORT_SYMBOL_GPL(dm_cell_release_singleton);

/*
/*
 * Sometimes we don't want the holder, just the additional bios.
 * Sometimes we don't want the holder, just the additional bios.
 */
 */
+0 −1
Original line number Original line Diff line number Diff line
@@ -44,7 +44,6 @@ int dm_bio_detain(struct dm_bio_prison *prison, struct dm_cell_key *key,
		  struct bio *inmate, struct dm_bio_prison_cell **ref);
		  struct bio *inmate, struct dm_bio_prison_cell **ref);


void dm_cell_release(struct dm_bio_prison_cell *cell, struct bio_list *bios);
void dm_cell_release(struct dm_bio_prison_cell *cell, struct bio_list *bios);
void dm_cell_release_singleton(struct dm_bio_prison_cell *cell, struct bio *bio); // FIXME: bio arg not needed
void dm_cell_release_no_holder(struct dm_bio_prison_cell *cell, struct bio_list *inmates);
void dm_cell_release_no_holder(struct dm_bio_prison_cell *cell, struct bio_list *inmates);
void dm_cell_error(struct dm_bio_prison_cell *cell);
void dm_cell_error(struct dm_bio_prison_cell *cell);


+2 −3
Original line number Original line Diff line number Diff line
@@ -1689,8 +1689,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
	return ret;
	return ret;
}
}


static int crypt_map(struct dm_target *ti, struct bio *bio,
static int crypt_map(struct dm_target *ti, struct bio *bio)
		     union map_info *map_context)
{
{
	struct dm_crypt_io *io;
	struct dm_crypt_io *io;
	struct crypt_config *cc = ti->private;
	struct crypt_config *cc = ti->private;
@@ -1846,7 +1845,7 @@ static int crypt_iterate_devices(struct dm_target *ti,


static struct target_type crypt_target = {
static struct target_type crypt_target = {
	.name   = "crypt",
	.name   = "crypt",
	.version = {1, 11, 0},
	.version = {1, 12, 0},
	.module = THIS_MODULE,
	.module = THIS_MODULE,
	.ctr    = crypt_ctr,
	.ctr    = crypt_ctr,
	.dtr    = crypt_dtr,
	.dtr    = crypt_dtr,
+2 −3
Original line number Original line Diff line number Diff line
@@ -274,8 +274,7 @@ static void delay_resume(struct dm_target *ti)
	atomic_set(&dc->may_delay, 1);
	atomic_set(&dc->may_delay, 1);
}
}


static int delay_map(struct dm_target *ti, struct bio *bio,
static int delay_map(struct dm_target *ti, struct bio *bio)
		     union map_info *map_context)
{
{
	struct delay_c *dc = ti->private;
	struct delay_c *dc = ti->private;


@@ -338,7 +337,7 @@ static int delay_iterate_devices(struct dm_target *ti,


static struct target_type delay_target = {
static struct target_type delay_target = {
	.name	     = "delay",
	.name	     = "delay",
	.version     = {1, 1, 0},
	.version     = {1, 2, 0},
	.module      = THIS_MODULE,
	.module      = THIS_MODULE,
	.ctr	     = delay_ctr,
	.ctr	     = delay_ctr,
	.dtr	     = delay_dtr,
	.dtr	     = delay_dtr,
+13 −8
Original line number Original line Diff line number Diff line
@@ -39,6 +39,10 @@ enum feature_flag_bits {
	DROP_WRITES
	DROP_WRITES
};
};


struct per_bio_data {
	bool bio_submitted;
};

static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
			  struct dm_target *ti)
			  struct dm_target *ti)
{
{
@@ -214,6 +218,7 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)


	ti->num_flush_requests = 1;
	ti->num_flush_requests = 1;
	ti->num_discard_requests = 1;
	ti->num_discard_requests = 1;
	ti->per_bio_data_size = sizeof(struct per_bio_data);
	ti->private = fc;
	ti->private = fc;
	return 0;
	return 0;


@@ -265,11 +270,12 @@ static void corrupt_bio_data(struct bio *bio, struct flakey_c *fc)
	}
	}
}
}


static int flakey_map(struct dm_target *ti, struct bio *bio,
static int flakey_map(struct dm_target *ti, struct bio *bio)
		      union map_info *map_context)
{
{
	struct flakey_c *fc = ti->private;
	struct flakey_c *fc = ti->private;
	unsigned elapsed;
	unsigned elapsed;
	struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
	pb->bio_submitted = false;


	/* Are we alive ? */
	/* Are we alive ? */
	elapsed = (jiffies - fc->start_time) / HZ;
	elapsed = (jiffies - fc->start_time) / HZ;
@@ -277,7 +283,7 @@ static int flakey_map(struct dm_target *ti, struct bio *bio,
		/*
		/*
		 * Flag this bio as submitted while down.
		 * Flag this bio as submitted while down.
		 */
		 */
		map_context->ll = 1;
		pb->bio_submitted = true;


		/*
		/*
		 * Map reads as normal.
		 * Map reads as normal.
@@ -314,17 +320,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio,
	return DM_MAPIO_REMAPPED;
	return DM_MAPIO_REMAPPED;
}
}


static int flakey_end_io(struct dm_target *ti, struct bio *bio,
static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error)
			 int error, union map_info *map_context)
{
{
	struct flakey_c *fc = ti->private;
	struct flakey_c *fc = ti->private;
	unsigned bio_submitted_while_down = map_context->ll;
	struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));


	/*
	/*
	 * Corrupt successful READs while in down state.
	 * Corrupt successful READs while in down state.
	 * If flags were specified, only corrupt those that match.
	 * If flags were specified, only corrupt those that match.
	 */
	 */
	if (fc->corrupt_bio_byte && !error && bio_submitted_while_down &&
	if (fc->corrupt_bio_byte && !error && pb->bio_submitted &&
	    (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw == READ) &&
	    (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw == READ) &&
	    all_corrupt_bio_flags_match(bio, fc))
	    all_corrupt_bio_flags_match(bio, fc))
		corrupt_bio_data(bio, fc);
		corrupt_bio_data(bio, fc);
@@ -406,7 +411,7 @@ static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_


static struct target_type flakey_target = {
static struct target_type flakey_target = {
	.name   = "flakey",
	.name   = "flakey",
	.version = {1, 2, 0},
	.version = {1, 3, 0},
	.module = THIS_MODULE,
	.module = THIS_MODULE,
	.ctr    = flakey_ctr,
	.ctr    = flakey_ctr,
	.dtr    = flakey_dtr,
	.dtr    = flakey_dtr,
Loading