Discussion:
[linux-lvm] [PATCH v7 0/2] dm: boot a mapped device without an initramfs
Enric Balletbo i Serra
2017-05-18 16:10:11 UTC
Permalink
Dear all,

So here is a new version of the patches to be reviewed, this time as
suggested by Alasdair the patches are reworked to match with the new
dmsetup bootformat feature [1]. These patches are not reviewed yet but
the format was discussed in the IRC and was suggested to send the
kernel patches in parallel.

Changes since v6:
- Add a new function to issue the equivalent of a DM ioctl programatically.
- Use the new ioctl interface to create the devices.
- Use a comma-delimited and semi-colon delimited dmsetup-like commands.

Changes since v5:
- https://www.redhat.com/archives/dm-devel/2016-February/msg00112.html

[1] https://www.redhat.com/archives/linux-lvm/2017-May/msg00047.html

Wating for your feedback,

Enric Balletbo i Serra (1):
dm ioctl: add a device mapper ioctl function.

Will Drewry (1):
init: add support to directly boot to a mapped device

Documentation/admin-guide/kernel-parameters.rst | 1 +
Documentation/admin-guide/kernel-parameters.txt | 3 +
Documentation/device-mapper/dm-boot.txt | 65 ++++
drivers/md/dm-ioctl.c | 45 +++
include/linux/device-mapper.h | 6 +
init/Makefile | 1 +
init/do_mounts.c | 1 +
init/do_mounts.h | 10 +
init/do_mounts_dm.c | 459 ++++++++++++++++++++++++
9 files changed, 591 insertions(+)
create mode 100644 Documentation/device-mapper/dm-boot.txt
create mode 100644 init/do_mounts_dm.c
--
2.9.3
Enric Balletbo i Serra
2017-05-18 16:10:12 UTC
Permalink
This post might be inappropriate. Click to display it.
Enric Balletbo i Serra
2017-05-18 16:10:13 UTC
Permalink
Add a dm_ioctl_cmd to issue the equivalent of a DM ioctl call in kernel.

Signed-off-by: Enric Balletbo i Serra <***@collabora.com>
---
drivers/md/dm-ioctl.c | 45 +++++++++++++++++++++++++++++++++++++++++++
include/linux/device-mapper.h | 6 ++++++
2 files changed, 51 insertions(+)

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 4951bf9..d79a41a 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1954,3 +1954,48 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)

return r;
}
+
+/**
+ * dm_ioctl_cmd - Device mapper ioctl's
+ * @command: ioctl command
+ * @param: Pointer to device mapped ioctl struct
+ */
+int dm_ioctl_cmd(uint command, struct dm_ioctl *param)
+{
+ int r = 0;
+ int ioctl_flags;
+ unsigned int cmd;
+ ioctl_fn fn = NULL;
+ size_t input_param_size;
+
+ if (_IOC_TYPE(command) != DM_IOCTL)
+ return -ENOTTY;
+
+ cmd = _IOC_NR(command);
+
+ /*
+ * Nothing more to do for the version command.
+ */
+ if (cmd == DM_VERSION_CMD)
+ return 0;
+
+ fn = lookup_ioctl(cmd, &ioctl_flags);
+ if (!fn) {
+ DMWARN("dm_ioctl: unknown command 0x%x", command);
+ return -ENOTTY;
+ }
+
+ input_param_size = param->data_size;
+ r = validate_params(cmd, param);
+ if (r)
+ return r;
+
+ param->data_size = sizeof(*param);
+ r = fn(param, input_param_size);
+
+ if (unlikely(param->flags & DM_BUFFER_FULL_FLAG) &&
+ unlikely(ioctl_flags & IOCTL_FLAGS_NO_PARAMS))
+ DMERR("ioctl %d tried to output some data but has IOCTL_FLAGS_NO_PARAMS set", cmd);
+
+ return r;
+}
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 81272c8..efa83ff 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -12,6 +12,7 @@
#include <linux/blkdev.h>
#include <linux/math64.h>
#include <linux/ratelimit.h>
+#include <linux/dm-ioctl.h>

struct dm_dev;
struct dm_target;
@@ -444,6 +445,11 @@ int dm_noflush_suspending(struct dm_target *ti);
void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors);
union map_info *dm_get_rq_mapinfo(struct request *rq);

+/*
+ * Device mapper ioctl function.
+ */
+int dm_ioctl_cmd(unsigned int command, struct dm_ioctl *param);
+
struct queue_limits *dm_get_queue_limits(struct mapped_device *md);

/*
--
2.9.3
Enric Balletbo Serra
2017-05-19 07:06:36 UTC
Permalink
Hi,

2017-05-18 18:29 GMT+02:00 Enric Balletbo i Serra
Post by Enric Balletbo i Serra
Dear all,
So here is a new version of the patches to be reviewed, this time as
suggested by Alasdair the patches are reworked to match with the new
dmsetup bootformat feature [1]. These patches are not reviewed yet but
the format was discussed in the IRC and was suggested to send the
kernel patches in parallel.
- Add a new function to issue the equivalent of a DM ioctl programatically.
- Use the new ioctl interface to create the devices.
- Use a comma-delimited and semi-colon delimited dmsetup-like commands.
- https://www.redhat.com/archives/dm-devel/2016-February/msg00112.html
[1] https://www.redhat.com/archives/linux-lvm/2017-May/msg00047.html
Wating for your feedback,
dm ioctl: add a device mapper ioctl function.
init: add support to directly boot to a mapped device
Documentation/admin-guide/kernel-parameters.rst | 1 +
Documentation/admin-guide/kernel-parameters.txt | 3 +
Documentation/device-mapper/dm-boot.txt | 65 ++++
drivers/md/dm-ioctl.c | 45 +++
include/linux/device-mapper.h | 6 +
init/Makefile | 1 +
init/do_mounts.c | 1 +
init/do_mounts.h | 10 +
init/do_mounts_dm.c | 459 ++++++++++++++++++++++++
9 files changed, 591 insertions(+)
create mode 100644 Documentation/device-mapper/dm-boot.txt
create mode 100644 init/do_mounts_dm.c
--
2.9.3
--
dm-devel mailing list
https://www.redhat.com/mailman/listinfo/dm-devel
Rebasing the patches against current linux-next I just noticied that
there is a build error due commit

commit e516db4f676ac88c7c7f698f8047178e8accc3b8
Author: Mikulas Patocka <***@redhat.com>
Date: Fri May 5 11:12:52 2017 -0700

dm ioctl: add a new DM_DEV_ARM_POLL ioctl

So I'll send v8 to fix this.

Best regards,
Enric

Loading...