mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Some whitespace tidy-ups.
This commit is contained in:
parent
c51b9fff19
commit
67cdbd7e4d
@ -1,5 +1,6 @@
|
||||
Version 2.02.33 -
|
||||
===================================
|
||||
Some whitespace tidy-ups.
|
||||
Use stack return macros throughout.
|
||||
Rely upon internally-cached PV labels while corresponding VG lock is held.
|
||||
|
||||
|
@ -156,9 +156,9 @@ int device_is_usable(dev_t dev)
|
||||
struct dm_task *dmt;
|
||||
struct dm_info info;
|
||||
const char *name;
|
||||
uint64_t start, length;
|
||||
char *target_type = NULL;
|
||||
char *params;
|
||||
uint64_t start, length;
|
||||
char *target_type = NULL;
|
||||
char *params;
|
||||
void *next = NULL;
|
||||
int r = 0;
|
||||
|
||||
@ -186,13 +186,13 @@ int device_is_usable(dev_t dev)
|
||||
/* FIXME Also check for mirror block_on_error and mpath no paths */
|
||||
/* For now, we exclude all mirrors */
|
||||
|
||||
do {
|
||||
next = dm_get_next_target(dmt, next, &start, &length,
|
||||
&target_type, ¶ms);
|
||||
/* Skip if target type doesn't match */
|
||||
if (target_type && !strcmp(target_type, "mirror"))
|
||||
do {
|
||||
next = dm_get_next_target(dmt, next, &start, &length,
|
||||
&target_type, ¶ms);
|
||||
/* Skip if target type doesn't match */
|
||||
if (target_type && !strcmp(target_type, "mirror"))
|
||||
goto out;
|
||||
} while (next);
|
||||
} while (next);
|
||||
|
||||
/* FIXME Also check dependencies? */
|
||||
|
||||
@ -629,11 +629,11 @@ static int _add_dev_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
|
||||
if (!(dlid = build_dlid(dm, lv->lvid.s, layer)))
|
||||
return_0;
|
||||
|
||||
log_debug("Getting device info for %s [%s]", name, dlid);
|
||||
if (!_info(name, dlid, 0, 1, 0, &info, NULL)) {
|
||||
log_error("Failed to get info for %s [%s].", name, dlid);
|
||||
return 0;
|
||||
}
|
||||
log_debug("Getting device info for %s [%s]", name, dlid);
|
||||
if (!_info(name, dlid, 0, 1, 0, &info, NULL)) {
|
||||
log_error("Failed to get info for %s [%s].", name, dlid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (info.exists && !dm_tree_add_dev(dtree, info.major, info.minor)) {
|
||||
log_error("Failed to add device (%" PRIu32 ":%" PRIu32") to dtree",
|
||||
@ -967,10 +967,10 @@ static int _create_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root
|
||||
name = dm_tree_node_get_name(child);
|
||||
|
||||
if (name && lvlayer->old_name && *lvlayer->old_name && strcmp(name, lvlayer->old_name)) {
|
||||
if (!dm_split_lvm_name(dm->mem, lvlayer->old_name, &vgname, &lvname, &layer)) {
|
||||
log_error("_create_lv_symlinks: Couldn't split up old device name %s", lvlayer->old_name);
|
||||
return 0;
|
||||
}
|
||||
if (!dm_split_lvm_name(dm->mem, lvlayer->old_name, &vgname, &lvname, &layer)) {
|
||||
log_error("_create_lv_symlinks: Couldn't split up old device name %s", lvlayer->old_name);
|
||||
return 0;
|
||||
}
|
||||
fs_rename_lv(lvlayer->lv, name, lvname);
|
||||
} else if (!dev_manager_lv_mknodes(lvlayer->lv))
|
||||
r = 0;
|
||||
@ -990,7 +990,7 @@ static int _remove_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root
|
||||
int r = 1;
|
||||
|
||||
while ((child = dm_tree_next_child(&handle, root, 0))) {
|
||||
if (!dm_split_lvm_name(dm->mem, dm_tree_node_get_name(child), &vgname, &lvname, &layer)) {
|
||||
if (!dm_split_lvm_name(dm->mem, dm_tree_node_get_name(child), &vgname, &lvname, &layer)) {
|
||||
r = 0;
|
||||
continue;
|
||||
}
|
||||
@ -1019,10 +1019,10 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root)
|
||||
if (!(uuid = dm_tree_node_get_uuid(child)))
|
||||
continue;
|
||||
|
||||
if (!dm_split_lvm_name(dm->mem, name, &vgname, &lvname, &layer)) {
|
||||
log_error("_clean_tree: Couldn't split up device name %s.", name);
|
||||
return 0;
|
||||
}
|
||||
if (!dm_split_lvm_name(dm->mem, name, &vgname, &lvname, &layer)) {
|
||||
log_error("_clean_tree: Couldn't split up device name %s.", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Not meant to be top level? */
|
||||
if (!*layer)
|
||||
|
@ -175,8 +175,8 @@ static int _mk_link(const char *dev_dir, const char *vg_name,
|
||||
}
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
if (!dm_set_selinux_context(lv_path, S_IFLNK))
|
||||
return_0;
|
||||
if (!dm_set_selinux_context(lv_path, S_IFLNK))
|
||||
return_0;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
|
14
lib/cache/lvmcache.c
vendored
14
lib/cache/lvmcache.c
vendored
@ -446,12 +446,12 @@ static int _drop_vginfo(struct lvmcache_info *info)
|
||||
if (info->vginfo && list_empty(&info->vginfo->infos)) {
|
||||
dm_hash_remove(_vgname_hash, info->vginfo->vgname);
|
||||
if (info->vginfo->next) {
|
||||
if (!dm_hash_insert(_vgname_hash, info->vginfo->vgname, info->vginfo->next)) {
|
||||
log_error("vg hash re-insertion failed: %s",
|
||||
if (!dm_hash_insert(_vgname_hash, info->vginfo->vgname, info->vginfo->next)) {
|
||||
log_error("vg hash re-insertion failed: %s",
|
||||
info->vginfo->vgname);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (info->vginfo->vgname)
|
||||
dm_free(info->vginfo->vgname);
|
||||
@ -643,9 +643,9 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
|
||||
dm_hash_remove(_vgname_hash, old_vginfo->vgname);
|
||||
if (old_vginfo->next) {
|
||||
if (!dm_hash_insert(_vgname_hash, old_vginfo->vgname, old_vginfo->next)) {
|
||||
log_error("vg hash re-insertion failed: %s",
|
||||
log_error("vg hash re-insertion failed: %s",
|
||||
old_vginfo->vgname);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else do {
|
||||
@ -666,7 +666,7 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
|
||||
if (!dm_hash_insert(_vgname_hash, vginfo->vgname, vginfo->next)) {
|
||||
log_error("vg hash re-insertion failed: %s",
|
||||
vginfo->vgname);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
***/
|
||||
|
@ -27,16 +27,16 @@
|
||||
#define PART_OFFSET UINT64_C(0x1BE)
|
||||
|
||||
struct partition {
|
||||
uint8_t boot_ind;
|
||||
uint8_t head;
|
||||
uint8_t sector;
|
||||
uint8_t cyl;
|
||||
uint8_t sys_ind; /* partition type */
|
||||
uint8_t end_head;
|
||||
uint8_t end_sector;
|
||||
uint8_t end_cyl;
|
||||
uint32_t start_sect;
|
||||
uint32_t nr_sects;
|
||||
uint8_t boot_ind;
|
||||
uint8_t head;
|
||||
uint8_t sector;
|
||||
uint8_t cyl;
|
||||
uint8_t sys_ind; /* partition type */
|
||||
uint8_t end_head;
|
||||
uint8_t end_sector;
|
||||
uint8_t end_cyl;
|
||||
uint32_t start_sect;
|
||||
uint32_t nr_sects;
|
||||
} __attribute__((packed));
|
||||
|
||||
static int _is_partitionable(struct device *dev)
|
||||
|
@ -97,13 +97,13 @@ int persistent_filter_load(struct dev_filter *f, struct config_tree **cft_out)
|
||||
{
|
||||
struct pfilter *pf = (struct pfilter *) f->private;
|
||||
struct config_tree *cft;
|
||||
struct stat info;
|
||||
struct stat info;
|
||||
int r = 0;
|
||||
|
||||
if (!stat(pf->file, &info))
|
||||
if (!stat(pf->file, &info))
|
||||
pf->ctime = info.st_ctime;
|
||||
else {
|
||||
log_very_verbose("%s: stat failed: %s", pf->file,
|
||||
log_very_verbose("%s: stat failed: %s", pf->file,
|
||||
strerror(errno));
|
||||
return_0;
|
||||
}
|
||||
|
@ -236,21 +236,21 @@ static int _read_dev(const char *file, dev_t *result)
|
||||
*/
|
||||
static int _read_devs(struct dev_set *ds, const char *dir, unsigned sysfs_depth)
|
||||
{
|
||||
struct dirent *d;
|
||||
DIR *dr;
|
||||
struct dirent *d;
|
||||
DIR *dr;
|
||||
struct stat info;
|
||||
char path[PATH_MAX];
|
||||
char file[PATH_MAX];
|
||||
dev_t dev = { 0 };
|
||||
int r = 1;
|
||||
|
||||
if (!(dr = opendir(dir))) {
|
||||
log_sys_error("opendir", dir);
|
||||
return 0;
|
||||
}
|
||||
if (!(dr = opendir(dir))) {
|
||||
log_sys_error("opendir", dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((d = readdir(dr))) {
|
||||
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
||||
while ((d = readdir(dr))) {
|
||||
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
||||
continue;
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%s/%s", dir,
|
||||
@ -278,8 +278,8 @@ static int _read_devs(struct dev_set *ds, const char *dir, unsigned sysfs_depth)
|
||||
}
|
||||
}
|
||||
|
||||
if (closedir(dr))
|
||||
log_sys_error("closedir", dir);
|
||||
if (closedir(dr))
|
||||
log_sys_error("closedir", dir);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -133,15 +133,15 @@ static int _munge_formats(struct pv_disk *pvd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* UUID too long? */
|
||||
if (pvd->pv_uuid[ID_LEN]) {
|
||||
/* UUID too long? */
|
||||
if (pvd->pv_uuid[ID_LEN]) {
|
||||
/* Retain ID_LEN chars from end */
|
||||
for (e = ID_LEN; e < sizeof(pvd->pv_uuid); e++) {
|
||||
if (!pvd->pv_uuid[e]) {
|
||||
e--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (e = ID_LEN; e < sizeof(pvd->pv_uuid); e++) {
|
||||
if (!pvd->pv_uuid[e]) {
|
||||
e--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (b = 0; b < ID_LEN; b++) {
|
||||
pvd->pv_uuid[b] = pvd->pv_uuid[++e - ID_LEN];
|
||||
/* FIXME Remove all invalid chars */
|
||||
@ -149,7 +149,7 @@ static int _munge_formats(struct pv_disk *pvd)
|
||||
pvd->pv_uuid[b] = '#';
|
||||
}
|
||||
memset(&pvd->pv_uuid[ID_LEN], 0, sizeof(pvd->pv_uuid) - ID_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
/* If UUID is missing, create one */
|
||||
if (pvd->pv_uuid[0] == '\0') {
|
||||
@ -177,8 +177,8 @@ static void _munge_exported_vg(struct pv_disk *pvd)
|
||||
s = sizeof(EXPORTED_TAG);
|
||||
if (!strncmp((char *)pvd->vg_name + l - s + 1, EXPORTED_TAG, s)) {
|
||||
pvd->vg_name[l - s + 1] = '\0';
|
||||
pvd->pv_status |= VG_EXPORTED;
|
||||
}
|
||||
pvd->pv_status |= VG_EXPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
int munge_pvd(struct device *dev, struct pv_disk *pvd)
|
||||
|
@ -115,9 +115,9 @@ int archive(struct volume_group *vg)
|
||||
return 0;
|
||||
|
||||
/* Trap a read-only file system */
|
||||
if ((access(vg->cmd->archive_params->dir, R_OK | W_OK | X_OK) == -1) &&
|
||||
if ((access(vg->cmd->archive_params->dir, R_OK | W_OK | X_OK) == -1) &&
|
||||
(errno == EROFS))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
log_verbose("Archiving volume group \"%s\" metadata (seqno %u).", vg->name,
|
||||
vg->seqno);
|
||||
@ -219,9 +219,9 @@ int backup(struct volume_group *vg)
|
||||
return 0;
|
||||
|
||||
/* Trap a read-only file system */
|
||||
if ((access(vg->cmd->backup_params->dir, R_OK | W_OK | X_OK) == -1) &&
|
||||
if ((access(vg->cmd->backup_params->dir, R_OK | W_OK | X_OK) == -1) &&
|
||||
(errno == EROFS))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
if (!__backup(vg)) {
|
||||
log_error("Backup of volume group %s metadata failed.",
|
||||
|
@ -37,7 +37,7 @@ typedef int (*nl_fn) (struct formatter * f);
|
||||
* Then argument list is reset and out_with_comment_fn is called again.
|
||||
*/
|
||||
#define _out_with_comment(f, buffer, fmt, ap) \
|
||||
do { \
|
||||
do { \
|
||||
va_start(ap, fmt); \
|
||||
r = f->out_with_comment(f, buffer, fmt, ap); \
|
||||
va_end(ap); \
|
||||
|
@ -225,24 +225,24 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
|
||||
pv->pe_alloc_count = 0;
|
||||
pv->fmt = fid->fmt;
|
||||
|
||||
/* Fix up pv size if missing or impossibly large */
|
||||
if ((!pv->size || pv->size > (1ULL << 62)) && pv->dev) {
|
||||
if (!dev_get_size(pv->dev, &pv->size)) {
|
||||
log_error("%s: Couldn't get size.", pv_dev_name(pv));
|
||||
return 0;
|
||||
}
|
||||
log_verbose("Fixing up missing size (%s) "
|
||||
"for PV %s", display_size(fid->fmt->cmd, pv->size),
|
||||
pv_dev_name(pv));
|
||||
if (vg) {
|
||||
size = pv->pe_count * (uint64_t) vg->extent_size +
|
||||
pv->pe_start;
|
||||
if (size > pv->size)
|
||||
log_error("WARNING: Physical Volume %s is too "
|
||||
"large for underlying device",
|
||||
pv_dev_name(pv));
|
||||
}
|
||||
}
|
||||
/* Fix up pv size if missing or impossibly large */
|
||||
if ((!pv->size || pv->size > (1ULL << 62)) && pv->dev) {
|
||||
if (!dev_get_size(pv->dev, &pv->size)) {
|
||||
log_error("%s: Couldn't get size.", pv_dev_name(pv));
|
||||
return 0;
|
||||
}
|
||||
log_verbose("Fixing up missing size (%s) "
|
||||
"for PV %s", display_size(fid->fmt->cmd, pv->size),
|
||||
pv_dev_name(pv));
|
||||
if (vg) {
|
||||
size = pv->pe_count * (uint64_t) vg->extent_size +
|
||||
pv->pe_start;
|
||||
if (size > pv->size)
|
||||
log_error("WARNING: Physical Volume %s is too "
|
||||
"large for underlying device",
|
||||
pv_dev_name(pv));
|
||||
}
|
||||
}
|
||||
|
||||
if (!alloc_pv_segment_whole_pv(mem, pv))
|
||||
return_0;
|
||||
@ -834,7 +834,7 @@ static const char *_read_vgname(const struct format_type *fmt,
|
||||
old_suppress = log_suppress(2);
|
||||
*creation_host = dm_pool_strdup(mem,
|
||||
find_config_str(cft->root,
|
||||
"creation_host", ""));
|
||||
"creation_host", ""));
|
||||
log_suppress(old_suppress);
|
||||
|
||||
/* skip any top-level values */
|
||||
|
@ -104,8 +104,8 @@ static int _send_request(char *inbuf, int inlen, char **retbuf)
|
||||
/* Send it to CLVMD */
|
||||
rewrite:
|
||||
if ( (err = write(_clvmd_sock, inbuf, inlen)) != inlen) {
|
||||
if (err == -1 && errno == EINTR)
|
||||
goto rewrite;
|
||||
if (err == -1 && errno == EINTR)
|
||||
goto rewrite;
|
||||
log_error("Error writing data to clvmd: %s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
@ -113,8 +113,8 @@ static int _send_request(char *inbuf, int inlen, char **retbuf)
|
||||
/* Get the response */
|
||||
reread:
|
||||
if ((len = read(_clvmd_sock, outbuf, sizeof(struct clvm_header))) < 0) {
|
||||
if (errno == EINTR)
|
||||
goto reread;
|
||||
if (errno == EINTR)
|
||||
goto reread;
|
||||
log_error("Error reading data from clvmd: %s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
@ -479,7 +479,7 @@ void reset_locking(void)
|
||||
|
||||
_clvmd_sock = _open_local_sock();
|
||||
if (_clvmd_sock == -1)
|
||||
stack;
|
||||
stack;
|
||||
}
|
||||
|
||||
#ifdef CLUSTER_LOCKING_INTERNAL
|
||||
|
@ -253,7 +253,7 @@ int init_locking(int type, struct cmd_context *cmd)
|
||||
}
|
||||
|
||||
if ((type == 2 || type == 3) &&
|
||||
find_config_tree_int(cmd, "locking/fallback_to_local_locking",
|
||||
find_config_tree_int(cmd, "locking/fallback_to_local_locking",
|
||||
DEFAULT_FALLBACK_TO_LOCAL_LOCKING)) {
|
||||
log_warn("WARNING: Falling back to local file-based locking.");
|
||||
log_warn("Volume Groups with the clustered attribute will "
|
||||
|
@ -1679,8 +1679,8 @@ static int _rename_cb(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
*/
|
||||
static int _for_each_sub_lv(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
int (*func)(struct cmd_context *cmd,
|
||||
struct logical_volume *lv,
|
||||
void *data),
|
||||
struct logical_volume *lv,
|
||||
void *data),
|
||||
void *data)
|
||||
{
|
||||
struct lv_segment *seg;
|
||||
|
@ -33,8 +33,8 @@
|
||||
#define MIRROR_DISK_VERSION 2
|
||||
|
||||
/* These are the flags that represent the mirror failure restoration policies */
|
||||
#define MIRROR_REMOVE 0
|
||||
#define MIRROR_ALLOCATE 1
|
||||
#define MIRROR_REMOVE 0
|
||||
#define MIRROR_ALLOCATE 1
|
||||
#define MIRROR_ALLOCATE_ANYWHERE 2
|
||||
|
||||
/*
|
||||
|
@ -56,7 +56,7 @@ static int _create_single_area(struct dm_pool *mem, struct pv_map *pvm,
|
||||
static int _create_alloc_areas_for_pv(struct dm_pool *mem, struct pv_map *pvm,
|
||||
uint32_t start, uint32_t count)
|
||||
{
|
||||
struct pv_segment *peg;
|
||||
struct pv_segment *peg;
|
||||
uint32_t pe, end, area_len;
|
||||
|
||||
/* Only select extents from start to end inclusive */
|
||||
@ -67,7 +67,7 @@ static int _create_alloc_areas_for_pv(struct dm_pool *mem, struct pv_map *pvm,
|
||||
pe = start;
|
||||
|
||||
/* Walk through complete ordered list of device segments */
|
||||
list_iterate_items(peg, &pvm->pv->segments) {
|
||||
list_iterate_items(peg, &pvm->pv->segments) {
|
||||
/* pe holds the next extent we want to check */
|
||||
|
||||
/* Beyond the range we're interested in? */
|
||||
@ -91,7 +91,7 @@ static int _create_alloc_areas_for_pv(struct dm_pool *mem, struct pv_map *pvm,
|
||||
|
||||
next:
|
||||
pe = peg->pe + peg->len;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -110,19 +110,19 @@ static int _mirrored_text_import(struct lv_segment *seg, const struct config_nod
|
||||
}
|
||||
}
|
||||
|
||||
if ((cn = find_config_node(sn, "mirror_log"))) {
|
||||
if (!cn->v || !cn->v->v.str) {
|
||||
log_error("Mirror log type must be a string.");
|
||||
return 0;
|
||||
}
|
||||
logname = cn->v->v.str;
|
||||
if ((cn = find_config_node(sn, "mirror_log"))) {
|
||||
if (!cn->v || !cn->v->v.str) {
|
||||
log_error("Mirror log type must be a string.");
|
||||
return 0;
|
||||
}
|
||||
logname = cn->v->v.str;
|
||||
if (!(seg->log_lv = find_lv(seg->lv->vg, logname))) {
|
||||
log_error("Unrecognised mirror log in segment %s.",
|
||||
sn->key);
|
||||
return 0;
|
||||
}
|
||||
seg->log_lv->status |= MIRROR_LOG;
|
||||
}
|
||||
}
|
||||
|
||||
if (logname && !seg->region_size) {
|
||||
log_error("Missing region size for mirror log for segment "
|
||||
@ -266,10 +266,10 @@ static int _add_log(struct dev_manager *dm, struct lv_segment *seg,
|
||||
}
|
||||
|
||||
static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem,
|
||||
struct cmd_context *cmd, void **target_state,
|
||||
struct lv_segment *seg,
|
||||
struct dm_tree_node *node, uint64_t len,
|
||||
uint32_t *pvmove_mirror_count)
|
||||
struct cmd_context *cmd, void **target_state,
|
||||
struct lv_segment *seg,
|
||||
struct dm_tree_node *node, uint64_t len,
|
||||
uint32_t *pvmove_mirror_count)
|
||||
{
|
||||
struct mirror_state *mirr_state;
|
||||
uint32_t area_count = seg->area_count;
|
||||
@ -349,7 +349,7 @@ static int _mirrored_target_present(const struct lv_segment *seg __attribute((un
|
||||
static int _mirrored_present = 0;
|
||||
uint32_t maj, min, patchlevel;
|
||||
unsigned maj2, min2, patchlevel2;
|
||||
char vsn[80];
|
||||
char vsn[80];
|
||||
|
||||
if (!_mirrored_checked) {
|
||||
_mirrored_present = target_present("mirror", 1);
|
||||
|
@ -151,8 +151,8 @@ void memlock_init(struct cmd_context *cmd)
|
||||
"activation/reserved_memory",
|
||||
DEFAULT_RESERVED_MEMORY) * 1024;
|
||||
_default_priority = find_config_tree_int(cmd,
|
||||
"activation/process_priority",
|
||||
DEFAULT_PROCESS_PRIORITY);
|
||||
"activation/process_priority",
|
||||
DEFAULT_PROCESS_PRIORITY);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -115,7 +115,7 @@ static int _format_pvsegs(struct dm_pool *mem, struct dm_report_field *field,
|
||||
}
|
||||
|
||||
if (dm_snprintf(extent_str, sizeof(extent_str),
|
||||
"%s%" PRIu32 "%s",
|
||||
"%s%" PRIu32 "%s",
|
||||
range_format ? ":" : "(", extent,
|
||||
range_format ? "-" : ")") < 0) {
|
||||
log_error("Extent number dm_snprintf failed");
|
||||
@ -128,7 +128,7 @@ static int _format_pvsegs(struct dm_pool *mem, struct dm_report_field *field,
|
||||
|
||||
if (range_format) {
|
||||
if (dm_snprintf(extent_str, sizeof(extent_str),
|
||||
"%" PRIu32, extent + seg->area_len - 1) < 0) {
|
||||
"%" PRIu32, extent + seg->area_len - 1) < 0) {
|
||||
log_error("Extent number dm_snprintf failed");
|
||||
return 0;
|
||||
}
|
||||
|
@ -154,11 +154,11 @@ static int _striped_merge_segments(struct lv_segment *seg1, struct lv_segment *s
|
||||
#ifdef DEVMAPPER_SUPPORT
|
||||
static int _striped_add_target_line(struct dev_manager *dm,
|
||||
struct dm_pool *mem __attribute((unused)),
|
||||
struct cmd_context *cmd __attribute((unused)),
|
||||
struct cmd_context *cmd __attribute((unused)),
|
||||
void **target_state __attribute((unused)),
|
||||
struct lv_segment *seg,
|
||||
struct dm_tree_node *node, uint64_t len,
|
||||
uint32_t *pvmove_mirror_count __attribute((unused)))
|
||||
struct lv_segment *seg,
|
||||
struct dm_tree_node *node, uint64_t len,
|
||||
uint32_t *pvmove_mirror_count __attribute((unused)))
|
||||
{
|
||||
if (!seg->area_count) {
|
||||
log_error("Internal error: striped add_target_line called "
|
||||
|
@ -93,10 +93,10 @@ int id_create(struct id *id)
|
||||
if (close(randomfile))
|
||||
stack;
|
||||
|
||||
/*
|
||||
* Skip out the last 2 chars in randomized creation for LVM1
|
||||
* backwards compatibility.
|
||||
*/
|
||||
/*
|
||||
* Skip out the last 2 chars in randomized creation for LVM1
|
||||
* backwards compatibility.
|
||||
*/
|
||||
for (i = 0; i < len; i++)
|
||||
id->uuid[i] = _c[id->uuid[i] % (sizeof(_c) - 3)];
|
||||
|
||||
|
@ -40,12 +40,12 @@ static int _zero_merge_segments(struct lv_segment *seg1, struct lv_segment *seg2
|
||||
|
||||
#ifdef DEVMAPPER_SUPPORT
|
||||
static int _zero_add_target_line(struct dev_manager *dm __attribute((unused)),
|
||||
struct dm_pool *mem __attribute((unused)),
|
||||
struct cmd_context *cmd __attribute((unused)),
|
||||
void **target_state __attribute((unused)),
|
||||
struct lv_segment *seg __attribute((unused)),
|
||||
struct dm_tree_node *node,uint64_t len,
|
||||
uint32_t *pvmove_mirror_count __attribute((unused)))
|
||||
struct dm_pool *mem __attribute((unused)),
|
||||
struct cmd_context *cmd __attribute((unused)),
|
||||
void **target_state __attribute((unused)),
|
||||
struct lv_segment *seg __attribute((unused)),
|
||||
struct dm_tree_node *node,uint64_t len,
|
||||
uint32_t *pvmove_mirror_count __attribute((unused)))
|
||||
{
|
||||
return dm_tree_node_add_zero_target(node, len);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
|
||||
static struct volume_group *_get_lvconvert_vg(struct cmd_context *cmd,
|
||||
const char *lv_name)
|
||||
{
|
||||
dev_close_all();
|
||||
dev_close_all();
|
||||
|
||||
return vg_lock_and_read(cmd, extract_vgname(cmd, lv_name),
|
||||
NULL, LCK_VG_WRITE,
|
||||
|
@ -45,10 +45,10 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name)
|
||||
pv = pv_read(cmd, name, NULL, NULL, 0);
|
||||
|
||||
/*
|
||||
* If a PV has no MDAs it may appear to be an orphan until the
|
||||
* metadata is read off another PV in the same VG. Detecting
|
||||
* this means checking every VG by scanning every PV on the
|
||||
* system.
|
||||
* If a PV has no MDAs it may appear to be an orphan until the
|
||||
* metadata is read off another PV in the same VG. Detecting
|
||||
* this means checking every VG by scanning every PV on the
|
||||
* system.
|
||||
*/
|
||||
if (pv && is_orphan(pv)) {
|
||||
if (!scan_vgs_for_pvs(cmd))
|
||||
|
@ -30,10 +30,10 @@ static int _pvdisplay_single(struct cmd_context *cmd,
|
||||
vg_name = pv_vg_name(pv);
|
||||
if (!(vg = vg_lock_and_read(cmd, vg_name, (char *)&pv->vgid,
|
||||
LCK_VG_READ, CLUSTERED, 0))) {
|
||||
log_error("Skipping volume group %s", vg_name);
|
||||
log_error("Skipping volume group %s", vg_name);
|
||||
/* FIXME If CLUSTERED should return ECMD_PROCESSED here */
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Replace possibly incomplete PV structure with new one
|
||||
@ -42,8 +42,8 @@ static int _pvdisplay_single(struct cmd_context *cmd,
|
||||
if (!(pvl = find_pv_in_vg(vg, pv_name))) {
|
||||
log_error("Unable to find \"%s\" in volume group \"%s\"",
|
||||
pv_name, vg->name);
|
||||
ret = ECMD_FAILED;
|
||||
goto out;
|
||||
ret = ECMD_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
pv = pvl->pv;
|
||||
@ -80,8 +80,8 @@ static int _pvdisplay_single(struct cmd_context *cmd,
|
||||
pvdisplay_segments(pv);
|
||||
|
||||
out:
|
||||
if (vg_name)
|
||||
unlock_vg(cmd, vg_name);
|
||||
if (vg_name)
|
||||
unlock_vg(cmd, vg_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -530,12 +530,12 @@ int pvmove(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (!(segtype = get_segtype_from_string(cmd, "mirror")))
|
||||
return_0;
|
||||
|
||||
if (activation() && segtype->ops->target_present &&
|
||||
!segtype->ops->target_present(NULL)) {
|
||||
log_error("%s: Required device-mapper target(s) not "
|
||||
"detected in your kernel", segtype->name);
|
||||
return 0;
|
||||
}
|
||||
if (activation() && segtype->ops->target_present &&
|
||||
!segtype->ops->target_present(NULL)) {
|
||||
log_error("%s: Required device-mapper target(s) not "
|
||||
"detected in your kernel", segtype->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc) {
|
||||
pv_name = argv[0];
|
||||
|
@ -111,7 +111,7 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg,
|
||||
goto out;
|
||||
}
|
||||
|
||||
pv = pvl->pv;
|
||||
pv = pvl->pv;
|
||||
}
|
||||
|
||||
if (!report_object(handle, vg, NULL, pv, NULL, NULL))
|
||||
|
@ -736,13 +736,13 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* If a PV has no MDAs it may appear to be an
|
||||
/*
|
||||
* If a PV has no MDAs it may appear to be an
|
||||
* orphan until the metadata is read off
|
||||
* another PV in the same VG. Detecting this
|
||||
* means checking every VG by scanning every
|
||||
* PV on the system.
|
||||
*/
|
||||
*/
|
||||
if (!scanned && is_orphan(pv)) {
|
||||
if (!scan_vgs_for_pvs(cmd)) {
|
||||
stack;
|
||||
@ -1251,7 +1251,7 @@ int fill_vg_create_params(struct cmd_context *cmd,
|
||||
arg_uint_value(cmd, physicalextentsize_ARG, vp_def->extent_size);
|
||||
|
||||
if (arg_count(cmd, clustered_ARG))
|
||||
vp_new->clustered =
|
||||
vp_new->clustered =
|
||||
!strcmp(arg_str_value(cmd, clustered_ARG,
|
||||
vp_def->clustered ? "y":"n"), "y");
|
||||
else
|
||||
|
@ -256,8 +256,8 @@ static int _vgchange_clustered(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
if (clustered) {
|
||||
list_iterate_items(lvl, &vg->lvs) {
|
||||
if (lv_is_origin(lvl->lv) || lv_is_cow(lvl->lv)) {
|
||||
list_iterate_items(lvl, &vg->lvs) {
|
||||
if (lv_is_origin(lvl->lv) || lv_is_cow(lvl->lv)) {
|
||||
log_error("Volume group %s contains snapshots "
|
||||
"that are not yet supported.",
|
||||
vg->name);
|
||||
|
@ -70,16 +70,16 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
|
||||
list_iterate_items(lvl2, &vg_from->lvs) {
|
||||
union lvid *lvid2 = &lvl2->lv->lvid;
|
||||
|
||||
if (id_equal(&lvid1->id[1], &lvid2->id[1])) {
|
||||
if (id_equal(&lvid1->id[1], &lvid2->id[1])) {
|
||||
if (!id_create(&lvid2->id[1])) {
|
||||
log_error("Failed to generate new "
|
||||
"random LVID for %s",
|
||||
lvl2->lv->name);
|
||||
goto bad;
|
||||
}
|
||||
if (!id_write_format(&lvid2->id[1], uuid,
|
||||
if (!id_write_format(&lvid2->id[1], uuid,
|
||||
sizeof(uuid)))
|
||||
goto_bad;
|
||||
goto_bad;
|
||||
|
||||
log_verbose("Changed LVID for %s to %s",
|
||||
lvl2->lv->name, uuid);
|
||||
|
@ -150,8 +150,8 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
|
||||
vg_name_old, vg_name_new);
|
||||
|
||||
/* FIXME lvmcache corruption - vginfo duplicated instead of renamed */
|
||||
persistent_filter_wipe(cmd->filter);
|
||||
lvmcache_destroy();
|
||||
persistent_filter_wipe(cmd->filter);
|
||||
lvmcache_destroy();
|
||||
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user