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

Commit 87c7ae06 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm:
  dm raid1: fix deadlock when suspending failed device
  dm: eliminate some holes data structures
  dm ioctl: introduce flag indicating uevent was generated
  dm: free dm_io before bio_endio not after
  dm table: remove unused dm_get_device range parameters
  dm ioctl: only issue uevent on resume if state changed
  dm raid1: always return error if all legs fail
  dm mpath: refactor pg_init
  dm mpath: wait for pg_init completion when suspending
  dm mpath: hold io until all pg_inits completed
  dm mpath: avoid storing private suspended state
  dm: document when snapshot has finished merging
  dm table: remove dm_get from dm_table_get_md
  dm mpath: skip activate_path for failed paths
  dm mpath: pass struct pgpath to pg init done
parents dff6d1c5 f0703040
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -122,3 +122,47 @@ volumeGroup-base: 0 2097152 snapshot-merge 254:11 254:12 P 16
brw-------  1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real
brw-------  1 root root 254, 12 29 ago 18:16 /dev/mapper/volumeGroup-base-cow
brw-------  1 root root 254, 10 29 ago 18:16 /dev/mapper/volumeGroup-base


How to determine when a merging is complete
===========================================
The snapshot-merge and snapshot status lines end with:
  <sectors_allocated>/<total_sectors> <metadata_sectors>

Both <sectors_allocated> and <total_sectors> include both data and metadata.
During merging, the number of sectors allocated gets smaller and
smaller.  Merging has finished when the number of sectors holding data
is zero, in other words <sectors_allocated> == <metadata_sectors>.

Here is a practical example (using a hybrid of lvm and dmsetup commands):

# lvs
  LV      VG          Attr   LSize Origin  Snap%  Move Log Copy%  Convert
  base    volumeGroup owi-a- 4.00g
  snap    volumeGroup swi-a- 1.00g base  18.97

# dmsetup status volumeGroup-snap
0 8388608 snapshot 397896/2097152 1560
                                  ^^^^ metadata sectors

# lvconvert --merge -b volumeGroup/snap
  Merging of volume snap started.

# lvs volumeGroup/snap
  LV      VG          Attr   LSize Origin  Snap%  Move Log Copy%  Convert
  base    volumeGroup Owi-a- 4.00g          17.23

# dmsetup status volumeGroup-base
0 8388608 snapshot-merge 281688/2097152 1104

# dmsetup status volumeGroup-base
0 8388608 snapshot-merge 180480/2097152 712

# dmsetup status volumeGroup-base
0 8388608 snapshot-merge 16/2097152 16

Merging has finished.

# lvs
  LV      VG          Attr   LSize Origin  Snap%  Move Log Copy%  Convert
  base    volumeGroup owi-a- 4.00g
+1 −2
Original line number Diff line number Diff line
@@ -1160,8 +1160,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
	}
	cc->start = tmpll;

	if (dm_get_device(ti, argv[3], cc->start, ti->len,
			  dm_table_get_mode(ti->table), &cc->dev)) {
	if (dm_get_device(ti, argv[3], dm_table_get_mode(ti->table), &cc->dev)) {
		ti->error = "Device lookup failed";
		goto bad_device;
	}
+4 −4
Original line number Diff line number Diff line
@@ -156,8 +156,8 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
		goto bad;
	}

	if (dm_get_device(ti, argv[0], dc->start_read, ti->len,
			  dm_table_get_mode(ti->table), &dc->dev_read)) {
	if (dm_get_device(ti, argv[0], dm_table_get_mode(ti->table),
			  &dc->dev_read)) {
		ti->error = "Device lookup failed";
		goto bad;
	}
@@ -177,8 +177,8 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
		goto bad_dev_read;
	}

	if (dm_get_device(ti, argv[3], dc->start_write, ti->len,
			  dm_table_get_mode(ti->table), &dc->dev_write)) {
	if (dm_get_device(ti, argv[3], dm_table_get_mode(ti->table),
			  &dc->dev_write)) {
		ti->error = "Write device lookup failed";
		goto bad_dev_read;
	}
+15 −9
Original line number Diff line number Diff line
@@ -285,7 +285,8 @@ retry:
	up_write(&_hash_lock);
}

static int dm_hash_rename(uint32_t cookie, const char *old, const char *new)
static int dm_hash_rename(uint32_t cookie, uint32_t *flags, const char *old,
			  const char *new)
{
	char *new_name, *old_name;
	struct hash_cell *hc;
@@ -344,7 +345,8 @@ static int dm_hash_rename(uint32_t cookie, const char *old, const char *new)
		dm_table_put(table);
	}

	dm_kobject_uevent(hc->md, KOBJ_CHANGE, cookie);
	if (!dm_kobject_uevent(hc->md, KOBJ_CHANGE, cookie))
		*flags |= DM_UEVENT_GENERATED_FLAG;

	dm_put(hc->md);
	up_write(&_hash_lock);
@@ -736,10 +738,10 @@ static int dev_remove(struct dm_ioctl *param, size_t param_size)
	__hash_remove(hc);
	up_write(&_hash_lock);

	dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr);
	if (!dm_kobject_uevent(md, KOBJ_REMOVE, param->event_nr))
		param->flags |= DM_UEVENT_GENERATED_FLAG;

	dm_put(md);
	param->data_size = 0;
	return 0;
}

@@ -773,7 +775,9 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size)
		return r;

	param->data_size = 0;
	return dm_hash_rename(param->event_nr, param->name, new_name);

	return dm_hash_rename(param->event_nr, &param->flags, param->name,
			      new_name);
}

static int dev_set_geometry(struct dm_ioctl *param, size_t param_size)
@@ -897,16 +901,17 @@ static int do_resume(struct dm_ioctl *param)
			set_disk_ro(dm_disk(md), 1);
	}

	if (dm_suspended_md(md))
	if (dm_suspended_md(md)) {
		r = dm_resume(md);
		if (!r && !dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr))
			param->flags |= DM_UEVENT_GENERATED_FLAG;
	}

	if (old_map)
		dm_table_destroy(old_map);

	if (!r) {
		dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr);
	if (!r)
		r = __dev_status(md, param);
	}

	dm_put(md);
	return r;
@@ -1476,6 +1481,7 @@ static int validate_params(uint cmd, struct dm_ioctl *param)
{
	/* Always clear this flag */
	param->flags &= ~DM_BUFFER_FULL_FLAG;
	param->flags &= ~DM_UEVENT_GENERATED_FLAG;

	/* Ignores parameters */
	if (cmd == DM_REMOVE_ALL_CMD ||
+1 −2
Original line number Diff line number Diff line
@@ -47,8 +47,7 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv)
	}
	lc->start = tmp;

	if (dm_get_device(ti, argv[0], lc->start, ti->len,
			  dm_table_get_mode(ti->table), &lc->dev)) {
	if (dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &lc->dev)) {
		ti->error = "dm-linear: Device lookup failed";
		goto bad;
	}
Loading