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

Commit a3d77d35 authored by Kiyoshi Ueda's avatar Kiyoshi Ueda Committed by Linus Torvalds
Browse files

[PATCH] dm: suspend: parameter change



Change the interface of dm_suspend() so that we can pass several options
without increasing the number of parameters.  The existing 'do_lockfs' integer
parameter is replaced by a flag DM_SUSPEND_LOCKFS_FLAG.

There is no functional change to the code.

Test results:
I have tested 'dmsetup suspend' command with/without the '--nolockfs'
option and confirmed the do_lockfs value is correctly set.

Signed-off-by: default avatarKiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 74859364
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ static int dev_set_geometry(struct dm_ioctl *param, size_t param_size)
static int do_suspend(struct dm_ioctl *param)
{
	int r = 0;
	int do_lockfs = 1;
	unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG;
	struct mapped_device *md;

	md = find_device(param);
@@ -773,10 +773,10 @@ static int do_suspend(struct dm_ioctl *param)
		return -ENXIO;

	if (param->flags & DM_SKIP_LOCKFS_FLAG)
		do_lockfs = 0;
		suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;

	if (!dm_suspended(md))
		r = dm_suspend(md, do_lockfs);
		r = dm_suspend(md, suspend_flags);

	if (!r)
		r = __dev_status(md, param);
@@ -788,7 +788,7 @@ static int do_suspend(struct dm_ioctl *param)
static int do_resume(struct dm_ioctl *param)
{
	int r = 0;
	int do_lockfs = 1;
	unsigned suspend_flags = DM_SUSPEND_LOCKFS_FLAG;
	struct hash_cell *hc;
	struct mapped_device *md;
	struct dm_table *new_map;
@@ -814,9 +814,9 @@ static int do_resume(struct dm_ioctl *param)
	if (new_map) {
		/* Suspend if it isn't already suspended */
		if (param->flags & DM_SKIP_LOCKFS_FLAG)
			do_lockfs = 0;
			suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
		if (!dm_suspended(md))
			dm_suspend(md, do_lockfs);
			dm_suspend(md, suspend_flags);

		r = dm_swap_table(md, new_map);
		if (r) {
+2 −1
Original line number Diff line number Diff line
@@ -1272,12 +1272,13 @@ static void unlock_fs(struct mapped_device *md)
 * dm_bind_table, dm_suspend must be called to flush any in
 * flight bios and ensure that any further io gets deferred.
 */
int dm_suspend(struct mapped_device *md, int do_lockfs)
int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
{
	struct dm_table *map = NULL;
	DECLARE_WAITQUEUE(wait, current);
	struct bio *def;
	int r = -EINVAL;
	int do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG ? 1 : 0;

	down(&md->suspend_lock);

+5 −0
Original line number Diff line number Diff line
@@ -32,6 +32,11 @@

#define SECTOR_SHIFT 9

/*
 * Suspend feature flags
 */
#define DM_SUSPEND_LOCKFS_FLAG		(1 << 0)

/*
 * List of devices that a metadevice uses and should open/close.
 */
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ void *dm_get_mdptr(struct mapped_device *md);
/*
 * A device can still be used while suspended, but I/O is deferred.
 */
int dm_suspend(struct mapped_device *md, int with_lockfs);
int dm_suspend(struct mapped_device *md, unsigned suspend_flags);
int dm_resume(struct mapped_device *md);

/*