public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: zkabelac@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ... Date: Fri, 02 Mar 2012 17:31:00 -0000 [thread overview] Message-ID: <20120302173125.20135.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-03-02 17:31:22 Modified files: . : WHATS_NEW_DM libdm : libdevmapper.h libdm-deptree.c Log message: Added dm_tree_node_set_callback() for preload and deactivation hooks Run users hook after preload for the node is finished, or after the node has been deactivated. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.581&r2=1.582 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.186&r2=1.187 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.158&r2=1.159 --- LVM2/WHATS_NEW_DM 2012/03/02 13:26:08 1.581 +++ LVM2/WHATS_NEW_DM 2012/03/02 17:31:21 1.582 @@ -1,5 +1,6 @@ Version 1.02.73 - ==================================== + Added dm_tree_node_set_callback() for preload and deactivation hooks. Drop unsupported TRIM message for thin pool. Improve logging for fifo startup in dmeventd. Add few pointer validation in dmsetup. --- LVM2/libdm/libdevmapper.h 2012/03/02 13:26:10 1.186 +++ LVM2/libdm/libdevmapper.h 2012/03/02 17:31:22 1.187 @@ -688,6 +688,20 @@ uint32_t read_ahead, uint32_t read_ahead_flags); +/* + * Set node callback hook before de/activation. + * Callback is called before 'activation' of node for activation tree, + * or 'deactivation' of node for deactivation tree. + */ +typedef enum { + DM_NODE_CALLBACK_PRELOADED, /* Node has preload deps */ + DM_NODE_CALLBACK_DEACTIVATED, /* Node is deactivated */ +} dm_node_callback_t; +typedef int (*dm_node_callback_fn) (struct dm_tree_node *node, + dm_node_callback_t type, void *cb_data); +void dm_tree_node_set_callback(struct dm_tree_node *node, + dm_node_callback_fn cb, void *cb_data); + void dm_tree_set_cookie(struct dm_tree_node *node, uint32_t cookie); uint32_t dm_tree_get_cookie(struct dm_tree_node *node); --- LVM2/libdm/libdm-deptree.c 2012/03/02 13:26:10 1.158 +++ LVM2/libdm/libdm-deptree.c 2012/03/02 17:31:22 1.159 @@ -263,6 +263,10 @@ * Note: only direct child is allowed */ struct dm_tree_node *presuspend_node; + + /* Callback */ + dm_node_callback_fn callback; + void *callback_data; }; struct dm_tree { @@ -1588,6 +1592,14 @@ } else if (info.suspended) dec_suspended(); + if (child->callback && + !child->callback(child, DM_NODE_CALLBACK_DEACTIVATED, + child->callback_data)) { + r = 0; + // FIXME: break tree shutdown or continue? + // hmm what about _node_clear_table()? + } + if (dm_tree_node_num_children(child, 0)) { if (!_dm_tree_deactivate_children(child, uuid_prefix, uuid_prefix_len, level + 1)) return_0; @@ -2445,10 +2457,16 @@ update_devs_flag = 1; } - if (update_devs_flag) { + if (update_devs_flag || + (!dnode->info.exists && dnode->callback)) { if (!dm_udev_wait(dm_tree_get_cookie(dnode))) stack; dm_tree_set_cookie(dnode, 0); + + if (!dnode->info.exists && dnode->callback && + !dnode->callback(child, DM_NODE_CALLBACK_PRELOADED, + dnode->callback_data)) + return_0; } return r; @@ -3245,3 +3263,10 @@ return 1; } + +void dm_tree_node_set_callback(struct dm_tree_node *dnode, + dm_node_callback_fn cb, void *data) +{ + dnode->callback = cb; + dnode->callback_data = data; +}
next reply other threads:[~2012-03-02 17:31 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-02 17:31 zkabelac [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-02-23 22:45 zkabelac 2012-02-15 12:23 prajnoha 2012-02-15 11:39 prajnoha 2012-02-15 11:27 prajnoha 2012-01-11 12:34 prajnoha 2011-12-21 12:47 zkabelac 2011-09-29 8:53 zkabelac 2011-09-22 17:36 prajnoha 2011-09-22 17:23 prajnoha 2011-09-22 17:17 prajnoha 2011-09-22 17:09 prajnoha 2011-08-19 16:26 agk 2011-03-10 12:48 zkabelac 2011-02-18 14:38 zkabelac 2011-02-04 16:08 mbroz 2011-01-04 14:43 prajnoha 2010-10-25 13:13 zkabelac 2010-10-15 1:10 agk 2010-04-28 13:37 prajnoha 2009-11-13 12:43 prajnoha 2009-10-22 12:55 prajnoha 2009-06-03 11:40 agk
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=20120302173125.20135.qmail@sourceware.org \ --to=zkabelac@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).