From 72a444276fb8c27bc7ae5d29cf5ad1825843acfd Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 4 Oct 2005 20:12:32 +0000 Subject: [PATCH] Add dmsetup --nolockfs support for suspend/reload. Requires kernel patches to have any effect. Library version incremented. --- WHATS_NEW_DM | 1 + libdm/.exported_symbols | 1 + libdm/ioctl/libdm-iface.c | 9 +++++++++ libdm/ioctl/libdm-targets.h | 1 + libdm/libdevmapper.h | 1 + tools/dmsetup.c | 9 ++++++++- 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 94a27a912..d6fb80702 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.01.06 - ============================= + Add dmsetup --nolockfs support for suspend/reload. Version 1.01.05 - 26 Sep 2005 ============================= diff --git a/libdm/.exported_symbols b/libdm/.exported_symbols index 413148940..689378460 100644 --- a/libdm/.exported_symbols +++ b/libdm/.exported_symbols @@ -21,6 +21,7 @@ dm_task_set_sector dm_task_set_message dm_task_add_target dm_task_no_open_count +dm_task_skip_lockfs dm_get_next_target dm_task_run dm_set_dev_dir diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index a1dee86f6..f7700d11c 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -950,6 +950,13 @@ int dm_task_no_open_count(struct dm_task *dmt) return 1; } +int dm_task_skip_lockfs(struct dm_task *dmt) +{ + dmt->skip_lockfs = 1; + + return 1; +} + int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr) { dmt->event_nr = event_nr; @@ -1105,6 +1112,8 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count) dmi->flags |= DM_SUSPEND_FLAG; if (dmt->read_only) dmi->flags |= DM_READONLY_FLAG; + if (dmt->skip_lockfs) + dmi->flags |= DM_SKIP_LOCKFS_FLAG; if (dmt->minor >= 0) { if (dmt->major <= 0) { diff --git a/libdm/ioctl/libdm-targets.h b/libdm/ioctl/libdm-targets.h index d25efe17d..ce3ab8225 100644 --- a/libdm/ioctl/libdm-targets.h +++ b/libdm/ioctl/libdm-targets.h @@ -52,6 +52,7 @@ struct dm_task { char *message; uint64_t sector; int no_open_count; + int skip_lockfs; char *uuid; }; diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index 44be174af..adb60ae03 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -135,6 +135,7 @@ int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr); int dm_task_set_message(struct dm_task *dmt, const char *message); int dm_task_set_sector(struct dm_task *dmt, uint64_t sector); int dm_task_no_open_count(struct dm_task *dmt); +int dm_task_skip_lockfs(struct dm_task *dmt); /* * Use these to prepare for a create or reload. diff --git a/tools/dmsetup.c b/tools/dmsetup.c index a5aa37a3c..5740823b7 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -76,6 +76,7 @@ enum { MAJOR_ARG, MINOR_ARG, NOHEADINGS_ARG, + NOLOCKFS_ARG, NOOPENCOUNT_ARG, NOTABLE_ARG, OPTIONS_ARG, @@ -527,6 +528,9 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display) if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt)) goto out; + if (_switches[NOLOCKFS_ARG] && !dm_task_skip_lockfs(dmt)) + goto out; + r = dm_task_run(dmt); if (r && display && _switches[VERBOSE_ARG]) @@ -1000,7 +1004,7 @@ static void _usage(FILE *out) fprintf(out, "Usage:\n\n"); fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n" - " [-r|--readonly] [--noopencount]\n\n"); + " [-r|--readonly] [--noopencount] [--nolockfs]\n\n"); for (i = 0; _commands[i].name; i++) fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help); fprintf(out, "\n may be device name or -u or " @@ -1034,6 +1038,7 @@ static int _process_switches(int *argc, char ***argv) {"major", 1, &ind, MAJOR_ARG}, {"minor", 1, &ind, MINOR_ARG}, {"noheadings", 0, &ind, NOHEADINGS_ARG}, + {"nolockfs", 0, &ind, NOLOCKFS_ARG}, {"noopencount", 0, &ind, NOOPENCOUNT_ARG}, {"notable", 0, &ind, NOTABLE_ARG}, {"options", 1, &ind, OPTIONS_ARG}, @@ -1125,6 +1130,8 @@ static int _process_switches(int *argc, char ***argv) } if ((ind == NOHEADINGS_ARG)) _switches[NOHEADINGS_ARG]++; + if ((ind == NOLOCKFS_ARG)) + _switches[NOLOCKFS_ARG]++; if ((ind == NOOPENCOUNT_ARG)) _switches[NOOPENCOUNT_ARG]++; if ((ind == VERSION_ARG))