mirror of
git://sourceware.org/git/lvm2.git
synced 2024-11-09 07:21:10 +03:00
libdm: add dm_hold_control_dev
Support hold of control device open. Useful for daemons so the control device is not frequently reopenned.
This commit is contained in:
parent
075f85dcb5
commit
09a62cca0c
@ -1,5 +1,6 @@
|
||||
Version 1.02.110 -
|
||||
======================================
|
||||
Add dm_hold_control_dev to allow holding of control device open.
|
||||
Add dm_report_compact_given_fields to remove given empty fields from report.
|
||||
Use libdm status parsing and local mem raid dmeventd plugin.
|
||||
Use local mem pool and lock only lvm2 execution for mirror dmeventd plugin.
|
||||
|
@ -1 +1,2 @@
|
||||
dm_report_compact_given_fields
|
||||
dm_hold_control_dev
|
||||
|
@ -81,6 +81,7 @@ static dm_bitset_t _dm_bitset = NULL;
|
||||
static uint32_t _dm_device_major = 0;
|
||||
|
||||
static int _control_fd = -1;
|
||||
static int _hold_control_fd_open = 0;
|
||||
static int _version_checked = 0;
|
||||
static int _version_ok = 1;
|
||||
static unsigned _ioctl_buffer_double_factor = 0;
|
||||
@ -2079,9 +2080,18 @@ repeat_ioctl:
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dm_hold_control_dev(int hold_open)
|
||||
{
|
||||
_hold_control_fd_open = hold_open ? 1 : 0;
|
||||
|
||||
log_debug("Hold of control device is now %sset.",
|
||||
_hold_control_fd_open ? "" : "un");
|
||||
}
|
||||
|
||||
void dm_lib_release(void)
|
||||
{
|
||||
_close_control_fd();
|
||||
if (!_hold_control_fd_open)
|
||||
_close_control_fd();
|
||||
dm_timestamp_destroy(_dm_ioctl_timestamp);
|
||||
_dm_ioctl_timestamp = NULL;
|
||||
update_devs();
|
||||
|
@ -1168,6 +1168,9 @@ void dm_lib_init(void) __attribute__((constructor));
|
||||
void dm_lib_release(void);
|
||||
void dm_lib_exit(void) __attribute__((destructor));
|
||||
|
||||
/* An optimisation for clients making repeated calls involving dm ioctls */
|
||||
void dm_hold_control_dev(int hold_open);
|
||||
|
||||
/*
|
||||
* Use NULL for all devices.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user