1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-06 01:58:01 +03:00

Remaing code suffling

Move declaration to the front of function to follow coding rules.
This commit is contained in:
Zdenek Kabelac 2012-02-23 22:23:12 +00:00
parent 9cc66e6f8b
commit ba337a5f3e
2 changed files with 14 additions and 11 deletions

View File

@ -341,23 +341,25 @@ int do_post_command(struct local_client *client)
/* Called when the client is about to be deleted */
void cmd_client_cleanup(struct local_client *client)
{
if (client->bits.localsock.private) {
struct dm_hash_node *v;
struct dm_hash_table *lock_hash =
(struct dm_hash_table *)client->bits.localsock.private;
struct dm_hash_table *lock_hash;
int lkid;
char *lockname;
if (!client->bits.localsock.private)
return;
lock_hash = (struct dm_hash_table *)client->bits.localsock.private;
dm_hash_iterate(v, lock_hash) {
int lkid = (int)(long)dm_hash_get_data(lock_hash, v);
char *lockname = dm_hash_get_key(lock_hash, v);
lkid = (int)(long)dm_hash_get_data(lock_hash, v);
lockname = dm_hash_get_key(lock_hash, v);
DEBUGLOG("cleanup: Unlocking lock %s %x\n", lockname, lkid);
sync_unlock(lockname, lkid);
}
dm_hash_destroy(lock_hash);
client->bits.localsock.private = 0;
}
}

View File

@ -452,6 +452,8 @@ const struct format_type *lvmcache_fmt_from_vgname(struct cmd_context *cmd,
struct dm_list *devh, *tmp;
struct dm_list devs;
struct device_list *devl;
struct volume_group *vg;
const struct format_type *fmt;
char vgid_found[ID_LEN + 1] __attribute__((aligned(8)));
if (!(vginfo = lvmcache_vginfo_from_vgname(vgname, vgid))) {
@ -459,9 +461,8 @@ const struct format_type *lvmcache_fmt_from_vgname(struct cmd_context *cmd,
return NULL; /* too bad */
/* If we don't have the info but we have lvmetad, we can ask
* there before failing. */
struct volume_group *vg = lvmetad_vg_lookup(cmd, vgname, vgid);
if (vg) {
const struct format_type *fmt = vg->fid->fmt;
if ((vg = lvmetad_vg_lookup(cmd, vgname, vgid))) {
fmt = vg->fid->fmt;
release_vg(vg);
return fmt;
}