1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-22 06:50:52 +03:00

Add internal fs cookie

Add functions for handling internal lvm cookie used for
all dm_tree operations until fs_unlock is called.
This commit is contained in:
Zdenek Kabelac 2011-01-10 13:44:39 +00:00
parent 4fef104bf1
commit a23f91ad2f
3 changed files with 24 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.80 -
====================================
Add internal lvm library cookie.
Speedup command processing by caching resolved config tree.
Pass config_tree to renamed function import_vg_from_config_tree().
Detect NULL handle in get_property().

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@ -26,6 +26,12 @@
#include <limits.h>
#include <dirent.h>
/*
* Library cookie to combine multiple fs transactions.
* Supports to wait for udev device settle only when needed.
*/
static uint32_t _fs_cookie = DM_COOKIE_AUTO_CREATE;
static int _mk_dir(const char *dev_dir, const char *vg_name)
{
char vg_path[PATH_MAX];
@ -396,7 +402,21 @@ int fs_rename_lv(struct logical_volume *lv, const char *dev,
void fs_unlock(void)
{
if (!memlock()) {
/* Wait for all processed udev devices */
if (!dm_udev_wait(_fs_cookie))
stack;
_fs_cookie = DM_COOKIE_AUTO_CREATE; /* Reset cookie */
dm_lib_release();
_pop_fs_ops();
}
}
uint32_t fs_get_cookie(void)
{
return _fs_cookie;
}
void fs_set_cookie(uint32_t cookie)
{
_fs_cookie = cookie;
}

View File

@ -30,5 +30,7 @@ int fs_del_lv_byname(const char *dev_dir, const char *vg_name,
int fs_rename_lv(struct logical_volume *lv, const char *dev,
const char *old_vgname, const char *old_lvname);
void fs_unlock(void);
uint32_t fs_get_cookie(void);
void fs_set_cookie(uint32_t cookie);
#endif