From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/libdm libdevmapper.h libdm-deptree.c
Date: 3 Nov 2011 14:43:23 -0000 [thread overview]
Message-ID: <20111103144323.19808.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-11-03 14:43:22
Modified files:
libdm : libdevmapper.h libdm-deptree.c
Log message:
Thin api change for dm_tree_node_add_thin_target
A little code shuffling and adding support for
DM_THIN_ERROR_DEVICE_ID which might be eventually be used
for activation of thin which is going to be deleted.
For now we do not need it lvm.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.166&r2=1.167
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.142&r2=1.143
--- LVM2/libdm/libdevmapper.h 2011/10/28 20:06:50 1.166
+++ LVM2/libdm/libdevmapper.h 2011/11/03 14:43:21 1.167
@@ -540,11 +540,9 @@
* FIXME: Defines bellow are based on kernel's dm-thin.c defines
* DATA_DEV_BLOCK_SIZE_MIN_SECTORS (64 * 1024 >> SECTOR_SHIFT)
* DATA_DEV_BLOCK_SIZE_MAX_SECTORS (1024 * 1024 * 1024 >> SECTOR_SHIFT)
- * MAX_DEV_ID ((1 << 24) - 1)
*/
#define DM_THIN_MIN_DATA_BLOCK_SIZE (UINT32_C(128))
#define DM_THIN_MAX_DATA_BLOCK_SIZE (UINT32_C(2097152))
-#define DM_THIN_MAX_DEVICE_ID (UINT32_C((1 << 24) - 1))
int dm_tree_node_add_thin_pool_target(struct dm_tree_node *node,
uint64_t size,
@@ -591,9 +589,18 @@
int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
const struct dm_thin_message *message);
+/*
+ * FIXME: Defines bellow are based on kernel's dm-thin.c defines
+ * MAX_DEV_ID ((1 << 24) - 1)
+ */
+#define DM_THIN_MAX_DEVICE_ID (UINT32_C((1 << 24) - 1))
+/* Reserved device_id for error (deleted) thin device */
+// FIXME - only needed for in-delete thin is not activated
+#define DM_THIN_ERROR_DEVICE_ID (UINT32_MAX)
+
int dm_tree_node_add_thin_target(struct dm_tree_node *node,
uint64_t size,
- const char *thin_pool_uuid,
+ const char *pool_uuid,
uint32_t device_id);
void dm_tree_node_set_udev_flags(struct dm_tree_node *node, uint16_t udev_flags);
--- LVM2/libdm/libdm-deptree.c 2011/10/30 22:52:08 1.142
+++ LVM2/libdm/libdm-deptree.c 2011/11/03 14:43:21 1.143
@@ -2973,26 +2973,33 @@
int dm_tree_node_add_thin_target(struct dm_tree_node *node,
uint64_t size,
- const char *thin_pool_uuid,
+ const char *pool_uuid,
uint32_t device_id)
{
+ struct dm_tree_node *pool;
struct load_segment *seg;
- if (!_thin_validate_device_id(device_id))
- return_0;
-
- if (!(seg = _add_segment(node, SEG_THIN, size)))
- return_0;
-
- if (!(seg->pool = dm_tree_find_node_by_uuid(node->dtree, thin_pool_uuid))) {
- log_error("Missing thin pool uuid %s.", thin_pool_uuid);
+ if (!(pool = dm_tree_find_node_by_uuid(node->dtree, pool_uuid))) {
+ log_error("Missing thin pool uuid %s.", pool_uuid);
return 0;
}
- if (!_link_tree_nodes(node, seg->pool))
+ if (!_link_tree_nodes(node, pool))
return_0;
- seg->device_id = device_id;
+ if (device_id == DM_THIN_ERROR_DEVICE_ID) {
+ if (!dm_tree_node_add_error_target(node, size))
+ return_0;
+ } else {
+ if (!_thin_validate_device_id(device_id))
+ return_0;
+
+ if (!(seg = _add_segment(node, SEG_THIN, size)))
+ return_0;
+
+ seg->pool = pool;
+ seg->device_id = device_id;
+ }
return 1;
}
next reply other threads:[~2011-11-03 14:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-03 14:43 zkabelac [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-12-21 12:52 LVM2/libdm libdevmapper.h libdm-deptree.c zkabelac
2011-10-20 10:33 zkabelac
2011-10-17 14:16 zkabelac
2011-10-17 14:15 zkabelac
2011-10-04 16:22 zkabelac
2011-10-03 18:34 zkabelac
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111103144323.19808.qmail@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.