[lvm-devel] [RFC PATCH 2/7] rename _has_scanned to _need_scan

Takahiro Yasui tyasui at redhat.com
Thu Apr 2 17:19:18 UTC 2009


When metadata cache is loaded into lvmcache, no device scan is necessary,
but it does not mean "has scanned". To tell lvmcache not to scan devices,
the variable name, _has_scanned, is renamed to _need_scan and its logic
is reversed.


Signed-off-by: Takahiro Yasui <tyasui at redhat.com>
---
 lib/cache/lvmcache.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: LVM2.02.46-cvs-20090324/lib/cache/lvmcache.c
===================================================================
--- LVM2.02.46-cvs-20090324.orig/lib/cache/lvmcache.c
+++ LVM2.02.46-cvs-20090324/lib/cache/lvmcache.c
@@ -32,7 +32,7 @@ static struct dm_hash_table *_vgname_has
 static struct dm_hash_table *_lock_hash = NULL;
 static struct dm_list _vginfos;
 static int _scanning_in_progress = 0;
-static int _has_scanned = 0;
+static int _need_scan = 1;
 static int _vgs_locked = 0;
 static int _vg_global_lock_held = 0;	/* Global lock held when cache wiped? */
 
@@ -455,7 +455,7 @@ int lvmcache_label_scan(struct cmd_conte
 		goto out;
 	}
 
-	if (_has_scanned && !full_scan) {
+	if (!_need_scan && !full_scan) {
 		r = _scan_invalid();
 		goto out;
 	}
@@ -470,7 +470,7 @@ int lvmcache_label_scan(struct cmd_conte
 
 	dev_iter_destroy(iter);
 
-	_has_scanned = 1;
+	_need_scan = 0;
 
 	/* Perform any format-specific scanning e.g. text files */
 	dm_list_iterate_items(fmt, &cmd->formats) {
@@ -1239,7 +1239,7 @@ void lvmcache_destroy(struct cmd_context
 	struct dm_hash_node *n;
 	log_verbose("Wiping internal VG cache");
 
-	_has_scanned = 0;
+	_need_scan = 1;
 
 	if (_vgid_hash) {
 		dm_hash_destroy(_vgid_hash);









More information about the lvm-devel mailing list