aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2006-01-06 03:20:07 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:34:01 -0500
commit6da487dcc0c6f4c827779687a20016efeffc4d60 (patch)
tree824d14e18cbb81bf45c6d17104993acfa47c9c36
parentaa8d7c2fbe619d8c0837296d2eaf4c14cebac198 (diff)
[PATCH] device-mapper ioctl: add skip lock_fs flag
Add ioctl DM_SKIP_LOCKFS_FLAG for userspace to request that lock_fs is bypassed when suspending a device. There's no change to the behaviour of existing code that doesn't know about the new flag. Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/md/dm-ioctl.c11
-rw-r--r--include/linux/dm-ioctl.h11
2 files changed, 17 insertions, 5 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index dbc07afd4462..561bda5011e0 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -693,14 +693,18 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size)
693static int do_suspend(struct dm_ioctl *param) 693static int do_suspend(struct dm_ioctl *param)
694{ 694{
695 int r = 0; 695 int r = 0;
696 int do_lockfs = 1;
696 struct mapped_device *md; 697 struct mapped_device *md;
697 698
698 md = find_device(param); 699 md = find_device(param);
699 if (!md) 700 if (!md)
700 return -ENXIO; 701 return -ENXIO;
701 702
703 if (param->flags & DM_SKIP_LOCKFS_FLAG)
704 do_lockfs = 0;
705
702 if (!dm_suspended(md)) 706 if (!dm_suspended(md))
703 r = dm_suspend(md, 1); 707 r = dm_suspend(md, do_lockfs);
704 708
705 if (!r) 709 if (!r)
706 r = __dev_status(md, param); 710 r = __dev_status(md, param);
@@ -712,6 +716,7 @@ static int do_suspend(struct dm_ioctl *param)
712static int do_resume(struct dm_ioctl *param) 716static int do_resume(struct dm_ioctl *param)
713{ 717{
714 int r = 0; 718 int r = 0;
719 int do_lockfs = 1;
715 struct hash_cell *hc; 720 struct hash_cell *hc;
716 struct mapped_device *md; 721 struct mapped_device *md;
717 struct dm_table *new_map; 722 struct dm_table *new_map;
@@ -737,8 +742,10 @@ static int do_resume(struct dm_ioctl *param)
737 /* Do we need to load a new map ? */ 742 /* Do we need to load a new map ? */
738 if (new_map) { 743 if (new_map) {
739 /* Suspend if it isn't already suspended */ 744 /* Suspend if it isn't already suspended */
745 if (param->flags & DM_SKIP_LOCKFS_FLAG)
746 do_lockfs = 0;
740 if (!dm_suspended(md)) 747 if (!dm_suspended(md))
741 dm_suspend(md, 1); 748 dm_suspend(md, do_lockfs);
742 749
743 r = dm_swap_table(md, new_map); 750 r = dm_swap_table(md, new_map);
744 if (r) { 751 if (r) {
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index f5eb6b6cd109..fa75ba0d635e 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -272,9 +272,9 @@ typedef char ioctl_struct[308];
272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) 272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
273 273
274#define DM_VERSION_MAJOR 4 274#define DM_VERSION_MAJOR 4
275#define DM_VERSION_MINOR 4 275#define DM_VERSION_MINOR 5
276#define DM_VERSION_PATCHLEVEL 0 276#define DM_VERSION_PATCHLEVEL 0
277#define DM_VERSION_EXTRA "-ioctl (2005-01-12)" 277#define DM_VERSION_EXTRA "-ioctl (2005-10-04)"
278 278
279/* Status bits */ 279/* Status bits */
280#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 280#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -301,8 +301,13 @@ typedef char ioctl_struct[308];
301#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ 301#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
302 302
303/* 303/*
304 * Set this to improve performance when you aren't going to use open_count 304 * Set this to improve performance when you aren't going to use open_count.
305 */ 305 */
306#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ 306#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
307 307
308/*
309 * Set this to avoid attempting to freeze any filesystem when suspending.
310 */
311#define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */
312
308#endif /* _LINUX_DM_IOCTL_H */ 313#endif /* _LINUX_DM_IOCTL_H */