Skip to contentSkip to conversation

master - logging: classify log_debug messages

PATCH Alasdair Kergon 1 participant 1 message Jan 7, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=06abb2dd4c78e66529e7e6407db1afb3f0f44d85
Commit:        06abb2dd4c78e66529e7e6407db1afb3f0f44d85
Parent:        7f747a0d739c08eadf319da9c3973f83c97c82af
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Mon Jan 7 22:30:29 2013 +0000
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Mon Jan 7 22:30:29 2013 +0000

logging: classify log_debug messages

Place most log_debug() messages into a class.

---
 lib/activate/activate.c         |   44 +++++++-------
 lib/activate/dev_manager.c      |   68 ++++++++++----------
 lib/activate/fs.c               |    2 +-
 lib/cache/lvmcache.c            |   72 +++++++++++-----------
 lib/cache/lvmetad.c             |   32 +++++-----
 lib/device/dev-cache.c          |   36 ++++++------
 lib/device/dev-io.c             |   38 ++++++------
 lib/filters/filter-composite.c  |    2 +-
 lib/filters/filter-md.c         |    6 +-
 lib/filters/filter-mpath.c      |    2 +-
 lib/filters/filter-persistent.c |    4 +-
 lib/filters/filter-regex.c      |    2 +-
 lib/filters/filter-sysfs.c      |    2 +-
 lib/filters/filter.c            |   14 ++--
 lib/format1/disk-rep.c          |   28 ++++----
 lib/format1/format1.c           |   62 +++++++++---------
 lib/format_pool/disk_rep.c      |    8 +-
 lib/format_pool/import_export.c |    8 +-
 lib/format_text/export.c        |    4 +-
 lib/format_text/format-text.c   |   68 ++++++++++----------
 lib/format_text/text_label.c    |   58 +++++++++---------
 lib/label/label.c               |    8 +-
 lib/locking/cluster_locking.c   |    4 +-
 lib/locking/file_locking.c      |    6 +-
 lib/locking/locking.c           |    2 +-
 lib/metadata/lv_manip.c         |   80 ++++++++++++------------
 lib/metadata/merge.c            |   14 ++--
 lib/metadata/metadata.c         |   40 ++++++------
 lib/metadata/pv_manip.c         |   12 ++--
 lib/metadata/pv_map.c           |    4 +-
 lib/metadata/raid_manip.c       |   40 ++++++------
 lib/metadata/replicator_manip.c |    4 +-
 lib/metadata/thin_manip.c       |   14 ++--
 lib/metadata/vg.c               |    8 +-
 lib/mirror/mirrored.c           |    8 +-
 lib/misc/lvm-globals.c          |    8 +-
 lib/misc/lvm-wrappers.c         |    6 +-
 lib/mm/memlock.c                |   44 +++++++-------
 lib/thin/thin.c                 |    6 +-
 libdm/ioctl/libdm-iface.c       |   80 ++++++++++++------------
 libdm/libdm-common.c            |  128 +++++++++++++++++++-------------------
 libdm/libdm-deptree.c           |   46 +++++++-------
 libdm/mm/dbg_malloc.c           |    2 +-
 libdm/mm/pool-debug.c           |   10 ++--
 libdm/mm/pool.c                 |    4 +-
 tools/lvmcmdline.c              |    1 +
 tools/pvscan.c                  |    2 +-
 47 files changed, 571 insertions(+), 570 deletions(-)
lib/activate/activate.c +22 -22
index 899f409..d71639f 100644
@@ -491,7 +491,7 @@ int target_version(const char *target_name, uint32_t *maj,
                 goto_out;
 
 	if (!dm_task_run(dmt)) {
-		log_debug("Failed to get %s target version", target_name);
+		log_debug_activation("Failed to get %s target version", target_name);
 		/* Assume this was because LIST_VERSIONS isn't supported */
 		*maj = 0;
 		*min = 0;
@@ -698,7 +698,7 @@ int lv_check_transient(struct logical_volume *lv)
 	if (!activation())
 		return 0;
 
-	log_debug("Checking transient status for LV %s/%s", lv->vg->name, lv->name);
+	log_debug_activation("Checking transient status for LV %s/%s", lv->vg->name, lv->name);
 
 	if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
 		return_0;
@@ -722,7 +722,7 @@ int lv_snapshot_percent(const struct logical_volume *lv, percent_t *percent)
 	if (!activation())
 		return 0;
 
-	log_debug("Checking snapshot percent for LV %s/%s", lv->vg->name, lv->name);
+	log_debug_activation("Checking snapshot percent for LV %s/%s", lv->vg->name, lv->name);
 
 	if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
 		return_0;
@@ -753,7 +753,7 @@ int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
 	if (!activation())
 		return 0;
 
-	log_debug("Checking mirror percent for LV %s/%s", lv->vg->name, lv->name);
+	log_debug_activation("Checking mirror percent for LV %s/%s", lv->vg->name, lv->name);
 
 	if (!lv_info(cmd, lv, 0, &info, 0, 0))
 		return_0;
@@ -790,8 +790,8 @@ int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
 	if (!activation())
 		return 0;
 
-	log_debug("Checking thin %sdata percent for LV %s/%s",
-		  (metadata) ? "meta" : "", lv->vg->name, lv->name);
+	log_debug_activation("Checking thin %sdata percent for LV %s/%s",
+			     (metadata) ? "meta" : "", lv->vg->name, lv->name);
 
 	if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
 		return_0;
@@ -816,8 +816,8 @@ int lv_thin_percent(const struct logical_volume *lv,
 	if (!activation())
 		return 0;
 
-	log_debug("Checking thin percent for LV %s/%s",
-		  lv->vg->name, lv->name);
+	log_debug_activation("Checking thin percent for LV %s/%s",
+			     lv->vg->name, lv->name);
 
 	if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
 		return_0;
@@ -843,8 +843,8 @@ int lv_thin_pool_transaction_id(const struct logical_volume *lv,
 	if (!activation())
 		return 0;
 
-	log_debug("Checking thin percent for LV %s/%s",
-		  lv->vg->name, lv->name);
+	log_debug_activation("Checking thin percent for LV %s/%s",
+			     lv->vg->name, lv->name);
 
 	if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
 		return_0;
@@ -973,7 +973,7 @@ int lvs_in_vg_activated(const struct volume_group *vg)
 		if (lv_is_visible(lvl->lv))
 			count += (_lv_active(vg->cmd, lvl->lv) == 1);
 
-	log_debug("Counted %d active LVs in VG %s", count, vg->name);
+	log_debug_activation("Counted %d active LVs in VG %s", count, vg->name);
 
 	return count;
 }
@@ -990,7 +990,7 @@ int lvs_in_vg_opened(const struct volume_group *vg)
 		if (lv_is_visible(lvl->lv))
 			count += (_lv_open_count(vg->cmd, lvl->lv) > 0);
 
-	log_debug("Counted %d open LVs in VG %s", count, vg->name);
+	log_debug_activation("Counted %d open LVs in VG %s", count, vg->name);
 
 	return count;
 }
@@ -1265,8 +1265,8 @@ int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv,
 	 */
 	if (laopts->skip_in_use && lv_info(lv->vg->cmd, lv, 1, &info, 1, 0) &&
 	    (info.open_count != 1)) {
-		log_debug("Skipping unmonitor of opened %s (open:%d)",
-			  lv->name, info.open_count);
+		log_debug_activation("Skipping unmonitor of opened %s (open:%d)",
+				     lv->name, info.open_count);
 		return 1;
 	}
 
@@ -1633,10 +1633,10 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
 		goto out;
 	}
 
-	log_debug("Resuming LV %s/%s%s%s%s.", lv->vg->name, lv->name,
-		  error_if_not_active ? "" : " if active",
-		  laopts->origin_only ? " without snapshots" : "",
-		  laopts->revert ? " (reverting)" : "");
+	log_debug_activation("Resuming LV %s/%s%s%s%s.", lv->vg->name, lv->name,
+			     error_if_not_active ? "" : " if active",
+			     laopts->origin_only ? " without snapshots" : "",
+			     laopts->revert ? " (reverting)" : "");
 
 	if (!lv_info(cmd, lv, laopts->origin_only, &info, 0, 0))
 		goto_out;
@@ -1739,7 +1739,7 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s)
 		goto out;
 	}
 
-	log_debug("Deactivating %s/%s.", lv->vg->name, lv->name);
+	log_debug_activation("Deactivating %s/%s.", lv->vg->name, lv->name);
 
 	if (!lv_info(cmd, lv, 0, &info, 1, 0))
 		goto_out;
@@ -1849,9 +1849,9 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
 	if (filter)
 		laopts->read_only = _passes_readonly_filter(cmd, lv);
 
-	log_debug("Activating %s/%s%s%s.", lv->vg->name, lv->name,
-		  laopts->exclusive ? " exclusively" : "",
-		  laopts->read_only ? " read-only" : "");
+	log_debug_activation("Activating %s/%s%s%s.", lv->vg->name, lv->name,
+			     laopts->exclusive ? " exclusively" : "",
+			     laopts->read_only ? " read-only" : "");
 
 	if (!lv_info(cmd, lv, 0, &info, 0, 0))
 		goto_out;
lib/activate/dev_manager.c +34 -34

194 lines not on this page · raw message

lib/activate/fs.c +1 -1
index 2636ccf..fe53349 100644
@@ -486,7 +486,7 @@ int fs_rename_lv(struct logical_volume *lv, const char *dev,
 void fs_unlock(void)
 {
 	if (!critical_section()) {
-		log_debug("Syncing device names");
+		log_debug_activation("Syncing device names");
 		/* Wait for all processed udev devices */
 		if (!dm_udev_wait(_fs_cookie))
 			stack;
lib/cache/lvmcache.c +36 -36

150 lines not on this page · raw message

lib/cache/lvmetad.c +16 -16
index db33553..9b54174 100644
@@ -53,8 +53,8 @@ static void _lvmetad_connect()
 
 	_lvmetad = lvmetad_open(_lvmetad_socket);
 	if (_lvmetad.socket_fd >= 0 && !_lvmetad.error) {
-		log_debug("Successfully connected to lvmetad on fd %d.",
-			  _lvmetad.socket_fd);
+		log_debug_lvmetad("Successfully connected to lvmetad on fd %d.",
+				  _lvmetad.socket_fd);
 		_lvmetad_connected = 1;
 	}
 }
@@ -81,7 +81,7 @@ int lvmetad_active(void)
 		_lvmetad_connect();
 
 	if ((_lvmetad.socket_fd < 0 || _lvmetad.error))
-		log_debug("Failed to connect to lvmetad: %s.", strerror(_lvmetad.error));
+		log_debug_lvmetad("Failed to connect to lvmetad: %s.", strerror(_lvmetad.error));
 
 	return _lvmetad_connected;
 }
@@ -156,7 +156,7 @@ retry:
 
 static int _token_update(void)
 {
-	log_debug("Sending updated token to lvmetad: %s", _lvmetad_token ? : "<NONE>");
+	log_debug_lvmetad("Sending updated token to lvmetad: %s", _lvmetad_token ? : "<NONE>");
 	daemon_reply repl = _lvmetad_send("token_update", NULL);
 
 	if (repl.error || strcmp(daemon_reply_str(repl, "response", ""), "OK")) {
@@ -323,12 +323,12 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
 	if (vgid) {
 		if (!id_write_format((const struct id*)vgid, uuid, sizeof(uuid)))
 			return_NULL;
-		log_debug("Asking lvmetad for VG %s (%s)", uuid, vgname ? : "name unknown");
+		log_debug_lvmetad("Asking lvmetad for VG %s (%s)", uuid, vgname ? : "name unknown");
 		reply = _lvmetad_send("vg_lookup", "uuid = %s", uuid, NULL);
 	} else {
 		if (!vgname)
 			log_error(INTERNAL_ERROR "VG name required (VGID not available)");
-		log_debug("Asking lvmetad for VG %s", vgname);
+		log_debug_lvmetad("Asking lvmetad for VG %s", vgname);
 		reply = _lvmetad_send("vg_lookup", "name = %s", vgname, NULL);
 	}
 
@@ -439,7 +439,7 @@ int lvmetad_vg_update(struct volume_group *vg)
 	if (!(vgmeta = _export_vg_to_config_tree(vg)))
 		return_0;
 
-	log_debug("Sending lvmetad updated metadata for VG %s (seqno %" PRIu32 ")", vg->name, vg->seqno);
+	log_debug_lvmetad("Sending lvmetad updated metadata for VG %s (seqno %" PRIu32 ")", vg->name, vg->seqno);
 	reply = _lvmetad_send("vg_update", "vgname = %s", vg->name,
 			      "metadata = %t", vgmeta, NULL);
 	dm_config_destroy(vgmeta);
@@ -492,7 +492,7 @@ int lvmetad_vg_remove(struct volume_group *vg)
 	if (!id_write_format(&vg->id, uuid, sizeof(uuid)))
 		return_0;
 
-	log_debug("Telling lvmetad to remove VGID %s (%s)", uuid, vg->name);
+	log_debug_lvmetad("Telling lvmetad to remove VGID %s (%s)", uuid, vg->name);
 	reply = _lvmetad_send("vg_remove", "uuid = %s", uuid, NULL);
 	result = _lvmetad_handle_reply(reply, "remove VG", vg->name, NULL);
 
@@ -514,7 +514,7 @@ int lvmetad_pv_lookup(struct cmd_context *cmd, struct id pvid, int *found)
 	if (!id_write_format(&pvid, uuid, sizeof(uuid)))
 		return_0;
 
-	log_debug("Asking lvmetad for PV %s", uuid);
+	log_debug_lvmetad("Asking lvmetad for PV %s", uuid);
 	reply = _lvmetad_send("pv_lookup", "uuid = %s", uuid, NULL);
 	if (!_lvmetad_handle_reply(reply, "lookup PV", "", found))
 		goto_out;
@@ -545,7 +545,7 @@ int lvmetad_pv_lookup_by_dev(struct cmd_context *cmd, struct device *dev, int *f
 	if (!lvmetad_active())
 		return_0;
 
-	log_debug("Asking lvmetad for PV on %s", dev_name(dev));
+	log_debug_lvmetad("Asking lvmetad for PV on %s", dev_name(dev));
 	reply = _lvmetad_send("pv_lookup", "device = %" PRId64, (int64_t) dev->dev, NULL);
 	if (!_lvmetad_handle_reply(reply, "lookup PV", dev_name(dev), found))
 		goto_out;
@@ -573,7 +573,7 @@ int lvmetad_pv_list_to_lvmcache(struct cmd_context *cmd)
 	if (!lvmetad_active())
 		return 1;
 
-	log_debug("Asking lvmetad for complete list of known PVs");
+	log_debug_lvmetad("Asking lvmetad for complete list of known PVs");
 	reply = _lvmetad_send("pv_list", NULL);
 	if (!_lvmetad_handle_reply(reply, "list PVs", "", NULL)) {
 		daemon_reply_destroy(reply);
@@ -600,7 +600,7 @@ int lvmetad_vg_list_to_lvmcache(struct cmd_context *cmd)
 	if (!lvmetad_active())
 		return 1;
 
-	log_debug("Asking lvmetad for complete list of known VGs");
+	log_debug_lvmetad("Asking lvmetad for complete list of known VGs");
 	reply = _lvmetad_send("vg_list", NULL);
 	if (!_lvmetad_handle_reply(reply, "list VGs", "", NULL)) {
 		daemon_reply_destroy(reply);
@@ -738,7 +738,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
 			return_0;
 		}
 
-		log_debug("Telling lvmetad to store PV %s (%s) in VG %s", dev_name(dev), uuid, vg->name);
+		log_debug_lvmetad("Telling lvmetad to store PV %s (%s) in VG %s", dev_name(dev), uuid, vg->name);
 		reply = _lvmetad_send("pv_found",
 				      "pvmeta = %t", pvmeta,
 				      "vgname = %s", vg->name,
@@ -750,7 +750,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
 		 * There is no VG metadata stored on this PV.
 		 * It might or might not be an orphan.
 		 */
-		log_debug("Telling lvmetad to store PV %s (%s)", dev_name(dev), uuid);
+		log_debug_lvmetad("Telling lvmetad to store PV %s (%s)", dev_name(dev), uuid);
 		reply = _lvmetad_send("pv_found", "pvmeta = %t", pvmeta, NULL);
 	}
 
@@ -798,7 +798,7 @@ int lvmetad_pv_gone(dev_t devno, const char *pv_name, activation_handler handler
          *        the whole stack from top to bottom (not yet upstream).
          */
 
-	log_debug("Telling lvmetad to forget any PV on %s", pv_name);
+	log_debug_lvmetad("Telling lvmetad to forget any PV on %s", pv_name);
 	reply = _lvmetad_send("pv_gone", "device = %" PRId64, (int64_t) devno, NULL);
 
 	result = _lvmetad_handle_reply(reply, "drop PV", pv_name, &found);
@@ -925,7 +925,7 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
 		return 0;
 	}
 
-	log_debug("Telling lvmetad to clear its cache");
+	log_debug_lvmetad("Telling lvmetad to clear its cache");
 	reply = _lvmetad_send("pv_clear_all", NULL);
 	if (!_lvmetad_handle_reply(reply, "clear info about all PVs", "", NULL))
 		r = 0;
lib/device/dev-cache.c +18 -18
index 2b2d32b..9905045 100644
@@ -137,7 +137,7 @@ void dev_set_preferred_name(struct str_list *sl, struct device *dev)
 	if (_cache.preferred_names_matcher)
 		return;
 
-	log_debug("%s: New preferred name", sl->str);
+	log_debug_devs("%s: New preferred name", sl->str);
 	dm_list_del(&sl->list);
 	dm_list_add_h(&dev->aliases, &sl->list);
 }
@@ -315,7 +315,7 @@ static int _add_alias(struct device *dev, const char *path)
 	/* Is name already there? */
 	dm_list_iterate_items(strl, &dev->aliases) {
 		if (!strcmp(strl->str, path)) {
-			log_debug("%s: Already in device cache", path);
+			log_debug_devs("%s: Already in device cache", path);
 			return 1;
 		}
 	}
@@ -325,11 +325,11 @@ static int _add_alias(struct device *dev, const char *path)
 	if (!dm_list_empty(&dev->aliases)) {
 		oldpath = dm_list_item(dev->aliases.n, struct str_list)->str;
 		prefer_old = _compare_paths(path, oldpath);
-		log_debug("%s: Aliased to %s in device cache%s",
-			  path, oldpath, prefer_old ? "" : " (preferred name)");
+		log_debug_devs("%s: Aliased to %s in device cache%s",
+			       path, oldpath, prefer_old ? "" : " (preferred name)");
 
 	} else
-		log_debug("%s: Added to device cache", path);
+		log_debug_devs("%s: Added to device cache", path);
 
 	if (prefer_old)
 		dm_list_add(&dev->aliases, &sl->list);
@@ -464,7 +464,7 @@ static int _insert_file(const char *path)
 	}
 
 	if (!S_ISREG(info.st_mode)) {
-		log_debug("%s: Not a regular file", path);
+		log_debug_devs("%s: Not a regular file", path);
 		return 0;
 	}
 
@@ -563,13 +563,13 @@ static void _insert_dirs(struct dm_list *dirs)
 	dm_list_iterate_items(dl, &_cache.dirs) {
 		if (with_udev) {
 			if (!_insert_udev_dir(udev, dl->dir))
-				log_debug("%s: Failed to insert devices from "
-					  "udev-managed directory to device "
-					  "cache fully", dl->dir);
+				log_debug_devs("%s: Failed to insert devices from "
+					       "udev-managed directory to device "
+					       "cache fully", dl->dir);
 		}
 		else if (!_insert_dir(dl->dir))
-			log_debug("%s: Failed to insert devices to "
-				  "device cache fully", dl->dir);
+			log_debug_devs("%s: Failed to insert devices to "
+				       "device cache fully", dl->dir);
 	}
 }
 
@@ -613,7 +613,7 @@ static int _insert(const char *path, int rec, int check_with_udev_db)
 		}
 
 		if (S_ISLNK(info.st_mode)) {
-			log_debug("%s: Symbolic link to directory", path);
+			log_debug_devs("%s: Symbolic link to directory", path);
 			return 0;
 		}
 
@@ -622,7 +622,7 @@ static int _insert(const char *path, int rec, int check_with_udev_db)
 
 	} else {		/* add a device */
 		if (!S_ISBLK(info.st_mode)) {
-			log_debug("%s: Not a block device", path);
+			log_debug_devs("%s: Not a block device", path);
 			return 0;
 		}
 
@@ -869,9 +869,9 @@ const char *dev_name_confirmed(struct device *dev, int quiet)
 				log_sys_error("stat", name);
 		}
 		if (quiet)
-			log_debug("Path %s no longer valid for device(%d,%d)",
-				  name, (int) MAJOR(dev->dev),
-				  (int) MINOR(dev->dev));
+			log_debug_devs("Path %s no longer valid for device(%d,%d)",
+				       name, (int) MAJOR(dev->dev),
+				       (int) MINOR(dev->dev));
 		else
 			log_warn("Path %s no longer valid for device(%d,%d)",
 				 name, (int) MAJOR(dev->dev),
@@ -891,8 +891,8 @@ const char *dev_name_confirmed(struct device *dev, int quiet)
 		}
 
 		/* Scanning issues this inappropriately sometimes. */
-		log_debug("Aborting - please provide new pathname for what "
-			  "used to be %s", name);
+		log_debug_devs("Aborting - please provide new pathname for what "
+			       "used to be %s", name);
 		return NULL;
 	}
 
lib/device/dev-io.c +19 -19
index 3bb9d65..2846caf 100644
@@ -134,7 +134,7 @@ static int _get_block_size(struct device *dev, unsigned int *size)
 			log_sys_error("ioctl BLKBSZGET", name);
 			return 0;
 		}
-		log_debug("%s: block size is %u bytes", name, dev->block_size);
+		log_debug_devs("%s: block size is %u bytes", name, dev->block_size);
 	}
 
 	*size = (unsigned int) dev->block_size;
@@ -314,8 +314,8 @@ static int _dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64
 	discard_range[0] = offset_bytes;
 	discard_range[1] = size_bytes;
 
-	log_debug("Discarding %" PRIu64 " bytes offset %" PRIu64 " bytes on %s.",
-		  size_bytes, offset_bytes, dev_name(dev));
+	log_debug_devs("Discarding %" PRIu64 " bytes offset %" PRIu64 " bytes on %s.",
+		       size_bytes, offset_bytes, dev_name(dev));
 	if (ioctl(dev->fd, BLKDISCARD, &discard_range) < 0) {
 		log_error("%s: BLKDISCARD ioctl@offset %" PRIu64 " size %" PRIu64 " failed: %s.",
 			  dev_name(dev), offset_bytes, size_bytes, strerror(errno));
@@ -431,8 +431,8 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
 		}
 
 		if (dev->open_count && !need_excl) {
-			log_debug("%s already opened read-only. Upgrading "
-				  "to read-write.", dev_name(dev));
+			log_debug_devs("%s already opened read-only. Upgrading "
+				       "to read-write.", dev_name(dev));
 			dev->open_count++;
 		}
 
@@ -442,7 +442,7 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
 	if (critical_section())
 		/* FIXME Make this log_error */
 		log_verbose("dev_open(%s) called while suspended",
-			 dev_name(dev));
+			    dev_name(dev));
 
 	if (dev->flags & DEV_REGULAR)
 		name = dev_name(dev);
@@ -471,7 +471,7 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
 			flags &= ~O_DIRECT;
 			if ((dev->fd = open(name, flags, 0777)) >= 0) {
 				dev->flags &= ~DEV_O_DIRECT;
-				log_debug("%s: Not using O_DIRECT", name);
+				log_debug_devs("%s: Not using O_DIRECT", name);
 				goto opened;
 			}
 		}
@@ -518,10 +518,10 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
 
 	dm_list_add(&_open_devices, &dev->open_list);
 
-	log_debug("Opened %s %s%s%s", dev_name(dev),
-		  dev->flags & DEV_OPENED_RW ? "RW" : "RO",
-		  dev->flags & DEV_OPENED_EXCL ? " O_EXCL" : "",
-		  dev->flags & DEV_O_DIRECT ? " O_DIRECT" : "");
+	log_debug_devs("Opened %s %s%s%s", dev_name(dev),
+		       dev->flags & DEV_OPENED_RW ? "RW" : "RO",
+		       dev->flags & DEV_OPENED_EXCL ? " O_EXCL" : "",
+		       dev->flags & DEV_O_DIRECT ? " O_DIRECT" : "");
 
 	return 1;
 }
@@ -574,7 +574,7 @@ static void _close(struct device *dev)
 	dev->block_size = -1;
 	dm_list_del(&dev->open_list);
 
-	log_debug("Closed %s", dev_name(dev));
+	log_debug_devs("Closed %s", dev_name(dev));
 
 	if (dev->flags & DEV_ALLOCED) {
 		dm_free((void *) dm_list_item(dev->aliases.n, struct str_list)->
@@ -602,8 +602,8 @@ static int _dev_close(struct device *dev, int immediate)
 		dev->open_count--;
 
 	if (immediate && dev->open_count)
-		log_debug("%s: Immediate close attempt while still referenced",
-			  dev_name(dev));
+		log_debug_devs("%s: Immediate close attempt while still referenced",
+			       dev_name(dev));
 
 	/* Close unless device is known to belong to a locked VG */
 	if (immediate ||
@@ -756,12 +756,12 @@ int dev_set(struct device *dev, uint64_t offset, size_t len, int value)
 		return_0;
 
 	if ((offset % SECTOR_SIZE) || (len % SECTOR_SIZE))
-		log_debug("Wiping %s at %" PRIu64 " length %" PRIsize_t,
-			  dev_name(dev), offset, len);
+		log_debug_devs("Wiping %s at %" PRIu64 " length %" PRIsize_t,
+			       dev_name(dev), offset, len);
 	else
-		log_debug("Wiping %s at sector %" PRIu64 " length %" PRIsize_t
-			  " sectors", dev_name(dev), offset >> SECTOR_SHIFT,
-			  len >> SECTOR_SHIFT);
+		log_debug_devs("Wiping %s at sector %" PRIu64 " length %" PRIsize_t
+			       " sectors", dev_name(dev), offset >> SECTOR_SHIFT,
+			       len >> SECTOR_SHIFT);
 
 	memset(buffer, value, sizeof(buffer));
 	while (1) {
lib/filters/filter-composite.c +1 -1
index 3ed8787..2298000 100644
@@ -28,7 +28,7 @@ static int _and_p(struct dev_filter *f, struct device *dev)
 		filters++;
 	}
 
-	log_debug("Using %s", dev_name(dev));
+	log_debug_devs("Using %s", dev_name(dev));
 
 	return 1;
 }
lib/filters/filter-md.c +3 -3
index d57489d..6f289b0 100644
@@ -29,13 +29,13 @@ static int _ignore_md(struct dev_filter *f __attribute__((unused)),
 	ret = dev_is_md(dev, NULL);
 
 	if (ret == 1) {
-		log_debug("%s: Skipping md component device", dev_name(dev));
+		log_debug_devs("%s: Skipping md component device", dev_name(dev));
 		return 0;
 	}
 
 	if (ret < 0) {
-		log_debug("%s: Skipping: error in md component detection",
-			  dev_name(dev));
+		log_debug_devs("%s: Skipping: error in md component detection",
+			       dev_name(dev));
 		return 0;
 	}
 
lib/filters/filter-mpath.c +1 -1
index 61a62d7..2d171e6 100644
@@ -160,7 +160,7 @@ static int dev_is_mpath(struct dev_filter *f, struct device *dev)
 static int _ignore_mpath(struct dev_filter *f, struct device *dev)
 {
 	if (dev_is_mpath(f, dev) == 1) {
-		log_debug("%s: Skipping mpath component device", dev_name(dev));
+		log_debug_devs("%s: Skipping mpath component device", dev_name(dev));
 		return 0;
 	}
 
lib/filters/filter-persistent.c +2 -2
index d00a99a..bec396b 100644
@@ -282,7 +282,7 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
 
 	/* Cached BAD? */
 	if (l == PF_BAD_DEVICE) {
-		log_debug("%s: Skipping (cached)", dev_name(dev));
+		log_debug_devs("%s: Skipping (cached)", dev_name(dev));
 		return 0;
 	}
 
@@ -295,7 +295,7 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
 					return 0;
 				}
 		if (!device_is_usable(dev)) {
-			log_debug("%s: Skipping unusable device", dev_name(dev));
+			log_debug_devs("%s: Skipping unusable device", dev_name(dev));
 			return 0;
 		}
 		return pf->real->passes_filter(pf->real, dev);
lib/filters/filter-regex.c +1 -1
index 3221195..7172c93 100644
@@ -170,7 +170,7 @@ static int _accept_p(struct dev_filter *f, struct device *dev)
 	}
 
 	if (rejected)
-		log_debug("%s: Skipping (regex)", dev_name(dev));
+		log_debug_devs("%s: Skipping (regex)", dev_name(dev));
 
 	/*
 	 * pass everything that doesn't match
lib/filters/filter-sysfs.c +1 -1
index ebd16a2..a075f36 100644
@@ -274,7 +274,7 @@ static int _accept_p(struct dev_filter *f, struct device *dev)
 		return 1;
 
 	if (!_set_lookup(ds, dev->dev)) {
-		log_debug("%s: Skipping (sysfs)", dev_name(dev));
+		log_debug_devs("%s: Skipping (sysfs)", dev_name(dev));
 		return 0;
 	} else
 		return 1;
lib/filters/filter.c +7 -7
index e335045..6981b94 100644
@@ -105,31 +105,31 @@ static int _passes_lvm_type_device_filter(struct dev_filter *f __attribute__((un
 
 	/* Is this a recognised device type? */
 	if (!_partitions[MAJOR(dev->dev)].max_partitions) {
-		log_debug("%s: Skipping: Unrecognised LVM device type %"
-			  PRIu64, name, (uint64_t) MAJOR(dev->dev));
+		log_debug_devs("%s: Skipping: Unrecognised LVM device type %"
+			       PRIu64, name, (uint64_t) MAJOR(dev->dev));
 		return 0;
 	}
 
 	/* Check it's accessible */
 	if (!dev_open_readonly_quiet(dev)) {
-		log_debug("%s: Skipping: open failed", name);
+		log_debug_devs("%s: Skipping: open failed", name);
 		return 0;
 	}
 
 	/* Check it's not too small */
 	if (!dev_get_size(dev, &size)) {
-		log_debug("%s: Skipping: dev_get_size failed", name);
+		log_debug_devs("%s: Skipping: dev_get_size failed", name);
 		goto out;
 	}
 
 	if (size < pv_min_size()) {
-		log_debug("%s: Skipping: Too small to hold a PV", name);
+		log_debug_devs("%s: Skipping: Too small to hold a PV", name);
 		goto out;
 	}
 
 	if (is_partitioned_dev(dev)) {
-		log_debug("%s: Skipping: Partition table signature found",
-			  name);
+		log_debug_devs("%s: Skipping: Partition table signature found",
+			       name);
 		goto out;
 	}
 
lib/format1/disk-rep.c +14 -14
index 0143ea0..ce6cda1 100644
@@ -535,8 +535,8 @@ static int _write_vgd(struct disk_list *data)
 	struct vg_disk *vgd = &data->vgd;
 	uint64_t pos = data->pvd.vg_on_disk.base;
 
-	log_debug("Writing %s VG metadata to %s at %" PRIu64 " len %" PRIsize_t,
-		  data->pvd.vg_name, dev_name(data->dev), pos, sizeof(*vgd));
+	log_debug_metadata("Writing %s VG metadata to %s at %" PRIu64 " len %" PRIsize_t,
+			   data->pvd.vg_name, dev_name(data->dev), pos, sizeof(*vgd));
 
 	_xlate_vgd(vgd);
 	if (!dev_write(data->dev, pos, sizeof(*vgd), vgd))
@@ -560,9 +560,9 @@ static int _write_uuids(struct disk_list *data)
 			return 0;
 		}
 
-		log_debug("Writing %s uuidlist to %s at %" PRIu64 " len %d",
-			  data->pvd.vg_name, dev_name(data->dev),
-			  pos, NAME_LEN);
+		log_debug_metadata("Writing %s uuidlist to %s at %" PRIu64 " len %d",
+				   data->pvd.vg_name, dev_name(data->dev),
+				   pos, NAME_LEN);
 
 		if (!dev_write(data->dev, pos, NAME_LEN, ul->uuid))
 			return_0;
@@ -575,9 +575,9 @@ static int _write_uuids(struct disk_list *data)
 
 static int _write_lvd(struct device *dev, uint64_t pos, struct lv_disk *disk)
 {
-	log_debug("Writing %s LV %s metadata to %s at %" PRIu64 " len %"
-		  PRIsize_t, disk->vg_name, disk->lv_name, dev_name(dev),
-		  pos, sizeof(*disk));
+	log_debug_metadata("Writing %s LV %s metadata to %s at %" PRIu64 " len %"
+			   PRIsize_t, disk->vg_name, disk->lv_name, dev_name(dev),
+			   pos, sizeof(*disk));
 
 	_xlate_lvd(disk);
 	if (!dev_write(dev, pos, sizeof(*disk), disk))
@@ -621,9 +621,9 @@ static int _write_extents(struct disk_list *data)
 	struct pe_disk *extents = data->extents;
 	uint64_t pos = data->pvd.pe_on_disk.base;
 
-	log_debug("Writing %s extents metadata to %s at %" PRIu64 " len %"
-		  PRIsize_t, data->pvd.vg_name, dev_name(data->dev),
-		  pos, len);
+	log_debug_metadata("Writing %s extents metadata to %s at %" PRIu64 " len %"
+			   PRIsize_t, data->pvd.vg_name, dev_name(data->dev),
+			   pos, len);
 
 	_xlate_extents(extents, data->pvd.pe_total);
 	if (!dev_write(data->dev, pos, len, extents))
@@ -656,9 +656,9 @@ static int _write_pvd(struct disk_list *data)
 
 	memcpy(buf, &data->pvd, sizeof(struct pv_disk));
 
-	log_debug("Writing %s PV metadata to %s at %" PRIu64 " len %"
-		  PRIsize_t, data->pvd.vg_name, dev_name(data->dev),
-		  pos, size);
+	log_debug_metadata("Writing %s PV metadata to %s at %" PRIu64 " len %"
+			   PRIsize_t, data->pvd.vg_name, dev_name(data->dev),
+			   pos, size);
 
 	_xlate_pvd((struct pv_disk *) buf);
 	if (!dev_write(data->dev, pos, size, buf)) {
lib/format1/format1.c +31 -31

74 lines not on this page · raw message

lib/format_pool/disk_rep.c +4 -4
index a140384..c4afefe 100644
@@ -91,11 +91,11 @@ int read_pool_label(struct pool_list *pl, struct labeller *l,
 
 	get_pool_pv_uuid(&pvid, pd);
 	id_write_format(&pvid, uuid, ID_LEN + 7);
-	log_debug("Calculated uuid %s for %s", uuid, dev_name(dev));
+	log_debug_metadata("Calculated uuid %s for %s", uuid, dev_name(dev));
 
 	get_pool_vg_uuid(&vgid, pd);
 	id_write_format(&vgid, uuid, ID_LEN + 7);
-	log_debug("Calculated uuid %s for %s", uuid, pd->pl_pool_name);
+	log_debug_metadata("Calculated uuid %s for %s", uuid, pd->pl_pool_name);
 
 	if (!(info = lvmcache_add(l, (char *) &pvid, dev, pd->pl_pool_name,
 				  (char *) &vgid, 0)))
@@ -369,8 +369,8 @@ int read_pool_pds(const struct format_type *fmt, const char *vg_name,
 
 		full_scan++;
 		if (full_scan > 1) {
-			log_debug("No devices for vg %s found in cache",
-				  vg_name);
+			log_debug_metadata("No devices for vg %s found in cache",
+					   vg_name);
 			return 0;
 		}
 		lvmcache_label_scan(fmt->cmd, full_scan);
lib/format_pool/import_export.c +4 -4
index 480fa1c..6ef0757 100644
@@ -77,8 +77,8 @@ int import_pool_lvs(struct volume_group *vg, struct dm_pool *mem, struct dm_list
 			return_0;
 
 		get_pool_lv_uuid(lv->lvid.id, &pl->pd);
-		log_debug("Calculated lv uuid for lv %s: %s", lv->name,
-			  lv->lvid.s);
+		log_debug_metadata("Calculated lv uuid for lv %s: %s", lv->name,
+				   lv->lvid.s);
 
 		lv->status |= VISIBLE_LV | LVM_READ | LVM_WRITE;
 		lv->major = POOL_MAJOR;
@@ -167,8 +167,8 @@ static const char *_cvt_sptype(uint32_t sptype)
 			break;
 		}
 	}
-	log_debug("Found sptype %X and converted it to %s",
-		  sptype, sptype_names[i].name);
+	log_debug_metadata("Found sptype %X and converted it to %s",
+			   sptype, sptype_names[i].name);
 	return sptype_names[i].name;
 }
 
lib/format_text/export.c +2 -2
index 70c1aa6..d68daf5 100644
@@ -119,8 +119,8 @@ static int _extend_buffer(struct formatter *f)
 {
 	char *newbuf;
 
-	log_debug("Doubling metadata output buffer to %" PRIu32,
-		  f->data.buf.size * 2);
+	log_debug_metadata("Doubling metadata output buffer to %" PRIu32,
+			   f->data.buf.size * 2);
 	if (!(newbuf = dm_realloc(f->data.buf.start,
 				   f->data.buf.size * 2))) {
 		log_error("Buffer reallocation failed.");
lib/format_text/format-text.c +34 -34

153 lines not on this page · raw message

lib/format_text/text_label.c +29 -29

70 lines not on this page · raw message

lib/label/label.c +4 -4
index b1124fc..a38ba68 100644
@@ -112,7 +112,7 @@ static struct labeller *_find_labeller(struct device *dev, char *buf,
 
 	if (!dev_read(dev, scan_sector << SECTOR_SHIFT,
 		      LABEL_SCAN_SIZE, readbuf)) {
-		log_debug("%s: Failed to read label area", dev_name(dev));
+		log_debug_devs("%s: Failed to read label area", dev_name(dev));
 		goto out;
 	}
 
@@ -208,7 +208,7 @@ int label_remove(struct device *dev)
 	dev_flush(dev);
 
 	if (!dev_read(dev, UINT64_C(0), LABEL_SCAN_SIZE, readbuf)) {
-		log_debug("%s: Failed to read label area", dev_name(dev));
+		log_debug_devs("%s: Failed to read label area", dev_name(dev));
 		goto out;
 	}
 
@@ -263,7 +263,7 @@ int label_read(struct device *dev, struct label **result,
 	int r = 0;
 
 	if ((info = lvmcache_info_from_pvid(dev->pvid, 1))) {
-		log_debug("Using cached label for %s", dev_name(dev));
+		log_debug_devs("Using cached label for %s", dev_name(dev));
 		*result = lvmcache_get_label(info);
 		return 1;
 	}
@@ -329,7 +329,7 @@ int label_write(struct device *dev, struct label *label)
 		 PRIu32 ".", dev_name(dev), label->sector,
 		 xlate32(lh->offset_xl));
 	if (!dev_write(dev, label->sector << SECTOR_SHIFT, LABEL_SIZE, buf)) {
-		log_debug("Failed to write label to %s", dev_name(dev));
+		log_debug_devs("Failed to write label to %s", dev_name(dev));
 		r = 0;
 	}
 
lib/locking/cluster_locking.c +2 -2
index f9d6328..01a47b0 100644
@@ -560,8 +560,8 @@ int query_resource(const char *resource, int *mode)
 		if (decode_lock_type(response[i].response) > *mode)
 			*mode = decode_lock_type(response[i].response);
 
-		log_debug("Lock held for %s, node %s : %s", resource,
-			  response[i].node, response[i].response);
+		log_debug_locking("Lock held for %s, node %s : %s", resource,
+				  response[i].node, response[i].response);
 	}
 
 	_cluster_free_request(response, num_responses);
lib/locking/file_locking.c +3 -3
index 7755ae4..2b7bfe2 100644
@@ -48,7 +48,7 @@ static void _undo_flock(const char *file, int fd)
 {
 	struct stat buf1, buf2;
 
-	log_debug("_undo_flock %s", file);
+	log_debug_locking("_undo_flock %s", file);
 	if (!flock(fd, LOCK_NB | LOCK_EX) &&
 	    !stat(file, &buf1) &&
 	    !fstat(fd, &buf2) &&
@@ -137,8 +137,8 @@ static int _do_flock(const char *file, int *fd, int operation, uint32_t nonblock
 	int old_errno;
 	struct stat buf1, buf2;
 
-	log_debug("_do_flock %s %c%c",
-		  file, operation == LOCK_EX ? 'W' : 'R', nonblock ? ' ' : 'B');
+	log_debug_locking("_do_flock %s %c%c", file,
+			  operation == LOCK_EX ? 'W' : 'R', nonblock ? ' ' : 'B');
 	do {
 		if ((*fd > -1) && close(*fd))
 			log_sys_error("close", file);
lib/locking/locking.c +1 -1
index 7aa519b..6f31ba8 100644
@@ -426,7 +426,7 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
 
 
 	if (flags == LCK_NONE) {
-		log_debug(INTERNAL_ERROR "%s: LCK_NONE lock requested", vol);
+		log_debug_locking(INTERNAL_ERROR "%s: LCK_NONE lock requested", vol);
 		return 1;
 	}
 
lib/metadata/lv_manip.c +40 -40

169 lines not on this page · raw message

lib/metadata/merge.c +7 -7
index f7c05a2..a4563f8 100644
@@ -474,9 +474,9 @@ static int _lv_split_segment(struct logical_volume *lv, struct lv_segment *seg,
 			if (!set_lv_segment_area_lv(split_seg, s, seg_lv(seg, s),
 						    seg_le(seg, s) + seg->area_len, 0))
 				return_0;
-			log_debug("Split %s:%u[%u] at %u: %s LE %u", lv->name,
-				  seg->le, s, le, seg_lv(seg, s)->name,
-				  seg_le(split_seg, s));
+			log_debug_alloc("Split %s:%u[%u] at %u: %s LE %u", lv->name,
+					seg->le, s, le, seg_lv(seg, s)->name,
+					seg_le(split_seg, s));
 			break;
 
 		case AREA_PV:
@@ -488,10 +488,10 @@ static int _lv_split_segment(struct logical_volume *lv, struct lv_segment *seg,
 						     seg->area_len,
 						 split_seg, s)))
 				return_0;
-			log_debug("Split %s:%u[%u] at %u: %s PE %u", lv->name,
-				  seg->le, s, le,
-				  dev_name(seg_dev(seg, s)),
-				  seg_pe(split_seg, s));
+			log_debug_alloc("Split %s:%u[%u] at %u: %s PE %u", lv->name,
+					seg->le, s, le,
+					dev_name(seg_dev(seg, s)),
+					seg_pe(split_seg, s));
 			break;
 
 		case AREA_UNASSIGNED:
lib/metadata/metadata.c +20 -20
index a472b18..0b774ac 100644
@@ -1078,7 +1078,7 @@ static dm_bitset_t _bitset_with_random_bits(struct dm_pool *mem, uint32_t num_bi
 		return NULL;
 	}
 
-	log_debug("Selected %" PRIu32 " random bits from %" PRIu32 ": %s", num_set_bits, num_bits, (char *) dm_pool_end_object(mem));
+	log_debug_metadata("Selected %" PRIu32 " random bits from %" PRIu32 ": %s", num_set_bits, num_bits, (char *) dm_pool_end_object(mem));
 
 	return bs;
 }
@@ -1090,9 +1090,9 @@ static int _vg_ignore_mdas(struct volume_group *vg, uint32_t num_to_ignore)
 	dm_bitset_t mda_to_ignore_bs;
 	int r = 1;
 
-	log_debug("Adjusting ignored mdas for %s: %" PRIu32 " of %" PRIu32 " mdas in use "
-		  "but %" PRIu32 " required.  Changing %" PRIu32 " mda.",
-		  vg->name, mda_used_count, vg_mda_count(vg), vg_mda_copies(vg), num_to_ignore);
+	log_debug_metadata("Adjusting ignored mdas for %s: %" PRIu32 " of %" PRIu32 " mdas in use "
+			   "but %" PRIu32 " required.  Changing %" PRIu32 " mda.",
+			   vg->name, mda_used_count, vg_mda_count(vg), vg_mda_copies(vg), num_to_ignore);
 
 	if (!num_to_ignore)
 		return 1;
@@ -1131,9 +1131,9 @@ static int _vg_unignore_mdas(struct volume_group *vg, uint32_t num_to_unignore)
 	if (!num_to_unignore)
 		return 1;
 
-	log_debug("Adjusting ignored mdas for %s: %" PRIu32 " of %" PRIu32 " mdas in use "
-		  "but %" PRIu32 " required.  Changing %" PRIu32 " mda.",
-		  vg->name, mda_used_count, mda_count, vg_mda_copies(vg), num_to_unignore);
+	log_debug_metadata("Adjusting ignored mdas for %s: %" PRIu32 " of %" PRIu32 " mdas in use "
+			   "but %" PRIu32 " required.  Changing %" PRIu32 " mda.",
+			   vg->name, mda_used_count, mda_count, vg_mda_copies(vg), num_to_unignore);
 
 	if (!(mda_to_unignore_bs = _bitset_with_random_bits(vg->vgmem, mda_free_count,
 							    num_to_unignore, &vg->cmd->rand_seed)))
@@ -2247,7 +2247,7 @@ void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahea
 		_lv_postorder((struct logical_volume *)lv, _lv_read_ahead_single, &_read_ahead);
 
 	if (read_ahead) {
-		log_debug("Calculated readahead of LV %s is %u", lv->name, _read_ahead);
+		log_debug_metadata("Calculated readahead of LV %s is %u", lv->name, _read_ahead);
 		*read_ahead = _read_ahead;
 	}
 }
@@ -3104,7 +3104,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
 						return_NULL;
 					}
 
-					log_debug("Empty mda found for VG %s.", vgname);
+					log_debug_metadata("Empty mda found for VG %s.", vgname);
 
 					if (inconsistent_mdas)
 						continue;
@@ -3120,8 +3120,8 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
 
 			/* If the check passed, let's update VG and recalculate pvids */
 			if (!inconsistent_pvs) {
-				log_debug("Updating cache for PVs without mdas "
-					  "in VG %s.", vgname);
+				log_debug_metadata("Updating cache for PVs without mdas "
+						   "in VG %s.", vgname);
 				/*
 				 * If there is no precommitted metadata, committed metadata
 				 * is read and stored in the cache even if use_precommitted is set
@@ -3138,8 +3138,8 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
 		fid->ref_count++;
 		if (dm_list_size(&correct_vg->pvs) !=
 		    dm_list_size(pvids) + vg_missing_pv_count(correct_vg)) {
-			log_debug("Cached VG %s had incorrect PV list",
-				  vgname);
+			log_debug_metadata("Cached VG %s had incorrect PV list",
+					   vgname);
 
 			if (critical_section())
 				inconsistent = 1;
@@ -3151,8 +3151,8 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
 			if (is_missing_pv(pvl->pv))
 				continue;
 			if (!str_list_match_item(pvids, pvl->pv->dev->pvid)) {
-				log_debug("Cached VG %s had incorrect PV list",
-					  vgname);
+				log_debug_metadata("Cached VG %s had incorrect PV list",
+						   vgname);
 				release_vg(correct_vg);
 				correct_vg = NULL;
 				break;
@@ -3287,7 +3287,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
 			 */
 			dm_list_iterate_items(mda, &fid->metadata_areas_in_use) {
 				if (mda->status & MDA_INCONSISTENT) {
-					log_debug("Checking inconsistent MDA: %s", dev_name(mda_get_device(mda)));
+					log_debug_metadata("Checking inconsistent MDA: %s", dev_name(mda_get_device(mda)));
 					dm_list_iterate_items(pvl, &correct_vg->pvs) {
 						if (mda_get_device(mda) == pvl->pv->dev &&
 						    (pvl->pv->status & MISSING_PV))
@@ -4471,10 +4471,10 @@ void mda_set_ignored(struct metadata_area *mda, unsigned mda_ignored)
 	else
 		return;	/* No change */
 
-	log_debug("%s ignored flag for mda %s at offset %" PRIu64 ".", 
-		  mda_ignored ? "Setting" : "Clearing",
-		  mda->ops->mda_metadata_locn_name ? mda->ops->mda_metadata_locn_name(locn) : "",
-		  mda->ops->mda_metadata_locn_offset ? mda->ops->mda_metadata_locn_offset(locn) : UINT64_C(0));
+	log_debug_metadata("%s ignored flag for mda %s at offset %" PRIu64 ".", 
+			   mda_ignored ? "Setting" : "Clearing",
+			   mda->ops->mda_metadata_locn_name ? mda->ops->mda_metadata_locn_name(locn) : "",
+			   mda->ops->mda_metadata_locn_offset ? mda->ops->mda_metadata_locn_offset(locn) : UINT64_C(0));
 }
 
 int mdas_empty_or_ignored(struct dm_list *mdas)
lib/metadata/pv_manip.c +6 -6
index d04ecab..83aa9af 100644
@@ -232,8 +232,8 @@ int discard_pv_segment(struct pv_segment *peg, uint32_t discard_area_reduction)
 		discard_area_reduction--;
 	}
 
-	log_debug("Discarding %" PRIu32 " extents offset %" PRIu64 " sectors on %s.",
-		  discard_area_reduction, discard_offset_sectors, dev_name(peg->pv->dev));
+	log_debug_alloc("Discarding %" PRIu32 " extents offset %" PRIu64 " sectors on %s.",
+			discard_area_reduction, discard_offset_sectors, dev_name(peg->pv->dev));
 	if (discard_area_reduction &&
 	    !dev_discard_blocks(peg->pv->dev, discard_offset_sectors << SECTOR_SHIFT,
 				discard_area_reduction * (uint64_t) peg->pv->vg->extent_size * SECTOR_SIZE))
@@ -344,10 +344,10 @@ int check_pv_segments(struct volume_group *vg)
 			s = peg->lv_area;
 
 			/* FIXME Remove this next line eventually */
-			log_debug("%s %u: %6u %6u: %s(%u:%u)",
-				  pv_dev_name(pv), segno++, peg->pe, peg->len,
-				  peg->lvseg ? peg->lvseg->lv->name : "NULL",
-				  peg->lvseg ? peg->lvseg->le : 0, s);
+			log_debug_alloc("%s %u: %6u %6u: %s(%u:%u)",
+					pv_dev_name(pv), segno++, peg->pe, peg->len,
+					peg->lvseg ? peg->lvseg->lv->name : "NULL",
+					peg->lvseg ? peg->lvseg->le : 0, s);
 			/* FIXME Add details here on failure instead */
 			if (start_pe != peg->pe) {
 				log_error("Gap in pvsegs: %u, %u",
lib/metadata/pv_map.c +2 -2
index 48a601e..4423a7d 100644
@@ -50,8 +50,8 @@ static int _create_single_area(struct dm_pool *mem, struct pv_map *pvm,
 	if (!(pva = dm_pool_zalloc(mem, sizeof(*pva))))
 		return_0;
 
-	log_debug("Allowing allocation on %s start PE %" PRIu32 " length %"
-		  PRIu32, pv_dev_name(pvm->pv), start, length);
+	log_debug_alloc("Allowing allocation on %s start PE %" PRIu32 " length %"
+			PRIu32, pv_dev_name(pvm->pv), start, length);
 	pva->map = pvm;
 	pva->start = start;
 	pva->count = length;
lib/metadata/raid_manip.c +20 -20
index b902d3d..3031506 100644
@@ -161,12 +161,12 @@ static int _lv_is_on_pvs(struct logical_volume *lv, struct dm_list *pvs)
 
 	dm_list_iterate_items(pvl, pvs)
 		if (_lv_is_on_pv(lv, pvl->pv)) {
-			log_debug("%s is on %s", lv->name,
-				  pv_dev_name(pvl->pv));
+			log_debug_metadata("%s is on %s", lv->name,
+					   pv_dev_name(pvl->pv));
 			return 1;
 		} else
-			log_debug("%s is not on %s", lv->name,
-				  pv_dev_name(pvl->pv));
+			log_debug_metadata("%s is not on %s", lv->name,
+					   pv_dev_name(pvl->pv));
 	return 0;
 }
 
@@ -182,8 +182,8 @@ static int _get_pv_list_for_lv(struct logical_volume *lv, struct dm_list *pvs)
 		return 0;
 	}
 
-	log_debug("Getting list of PVs that %s/%s is on:",
-		  lv->vg->name, lv->name);
+	log_debug_metadata("Getting list of PVs that %s/%s is on:",
+			   lv->vg->name, lv->name);
 
 	dm_list_iterate_items(seg, &lv->segments) {
 		for (s = 0; s < seg->area_count; s++) {
@@ -200,8 +200,8 @@ static int _get_pv_list_for_lv(struct logical_volume *lv, struct dm_list *pvs)
 			}
 
 			pvl->pv = seg_pv(seg, s);
-			log_debug("  %s/%s is on %s", lv->vg->name, lv->name,
-				  pv_dev_name(pvl->pv));
+			log_debug_metadata("  %s/%s is on %s", lv->vg->name, lv->name,
+					   pv_dev_name(pvl->pv));
 			dm_list_add(pvs, &pvl->list);
 		}
 	}
@@ -340,7 +340,7 @@ static int _clear_lvs(struct dm_list *lv_list)
 	struct volume_group *vg = NULL;
 
 	if (dm_list_empty(lv_list)) {
-		log_debug(INTERNAL_ERROR "Empty list of LVs given for clearing");
+		log_debug_metadata(INTERNAL_ERROR "Empty list of LVs given for clearing");
 		return 1;
 	}
 
@@ -774,8 +774,8 @@ to be left for these sub-lvs.
 
 	/* Set segment areas for metadata sub_lvs */
 	dm_list_iterate_items(lvl, &meta_lvs) {
-		log_debug("Adding %s to %s",
-			  lvl->lv->name, lv->name);
+		log_debug_metadata("Adding %s to %s",
+				   lvl->lv->name, lv->name);
 		lvl->lv->status &= status_mask;
 		first_seg(lvl->lv)->status &= status_mask;
 		if (!set_lv_segment_area_lv(seg, s, lvl->lv, 0,
@@ -791,8 +791,8 @@ to be left for these sub-lvs.
 
 	/* Set segment areas for data sub_lvs */
 	dm_list_iterate_items(lvl, &data_lvs) {
-		log_debug("Adding %s to %s",
-			  lvl->lv->name, lv->name);
+		log_debug_metadata("Adding %s to %s",
+				   lvl->lv->name, lv->name);
 		lvl->lv->status &= status_mask;
 		first_seg(lvl->lv)->status &= status_mask;
 		if (!set_lv_segment_area_lv(seg, s, lvl->lv, 0,
@@ -1468,8 +1468,8 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv,
 	}
 
 	for (s = 0; s < seg->area_count; s++) {
-		log_debug("Allocating new metadata LV for %s",
-			  seg_lv(seg, s)->name);
+		log_debug_metadata("Allocating new metadata LV for %s",
+				   seg_lv(seg, s)->name);
 		if (!_alloc_rmeta_for_lv(seg_lv(seg, s), &(lvl_array[s].lv))) {
 			log_error("Failed to allocate metadata LV for %s in %s",
 				  seg_lv(seg, s)->name, lv->name);
@@ -1478,14 +1478,14 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv,
 		dm_list_add(&meta_lvs, &(lvl_array[s].list));
 	}
 
-	log_debug("Clearing newly allocated metadata LVs");
+	log_debug_metadata("Clearing newly allocated metadata LVs");
 	if (!_clear_lvs(&meta_lvs)) {
 		log_error("Failed to initialize metadata LVs");
 		return 0;
 	}
 
 	if (seg->log_lv) {
-		log_debug("Removing mirror log, %s", seg->log_lv->name);
+		log_debug_metadata("Removing mirror log, %s", seg->log_lv->name);
 		if (!remove_mirror_log(lv->vg->cmd, lv, NULL, 0)) {
 			log_error("Failed to remove mirror log");
 			return 0;
@@ -1496,7 +1496,7 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv,
 	s = 0;
 
 	dm_list_iterate_items(lvl, &meta_lvs) {
-		log_debug("Adding %s to %s", lvl->lv->name, lv->name);
+		log_debug_metadata("Adding %s to %s", lvl->lv->name, lv->name);
 
 		/* Images are known to be in-sync */
 		lvl->lv->status &= ~LV_REBUILD;
@@ -1524,14 +1524,14 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv,
 		}
 
 		sprintf(new_name, "%s_rimage_%u", lv->name, s);
-		log_debug("Renaming %s to %s", seg_lv(seg, s)->name, new_name);
+		log_debug_metadata("Renaming %s to %s", seg_lv(seg, s)->name, new_name);
 		seg_lv(seg, s)->name = new_name;
 		seg_lv(seg, s)->status &= ~MIRROR_IMAGE;
 		seg_lv(seg, s)->status |= RAID_IMAGE;
 	}
 	init_mirror_in_sync(1);
 
-	log_debug("Setting new segtype for %s", lv->name);
+	log_debug_metadata("Setting new segtype for %s", lv->name);
 	seg->segtype = new_segtype;
 	lv->status &= ~MIRRORED;
 	lv->status |= RAID;
lib/metadata/replicator_manip.c +2 -2
index 2853e50..f264c7c 100644
@@ -568,7 +568,7 @@ int cmd_vg_read(struct cmd_context *cmd, struct dm_list *cmd_vgs)
 	dm_list_iterate_items(cvl, cmd_vgs) {
 		cvl->vg = vg_read(cmd, cvl->vg_name, cvl->vgid, cvl->flags);
 		if (vg_read_error(cvl->vg)) {
-			log_debug("Failed to vg_read %s", cvl->vg_name);
+			log_debug_metadata("Failed to vg_read %s", cvl->vg_name);
 			return 0;
 		}
 		cvl->vg->cmd_vgs = cmd_vgs;	/* Make it usable in VG */
@@ -621,7 +621,7 @@ int find_replicator_vgs(struct logical_volume *lv)
 			break;
 		}
 
-		log_debug("VG: %s added as missing.", rsite->vg_name);
+		log_debug_metadata("VG: %s added as missing.", rsite->vg_name);
 		lv->vg->cmd_missing_vgs++;
 	}
 
lib/metadata/thin_manip.c +7 -7
index e2762a0..016f776 100644
@@ -89,8 +89,8 @@ int detach_pool_lv(struct lv_segment *seg)
 		case DM_THIN_MESSAGE_CREATE_SNAP:
 		case DM_THIN_MESSAGE_CREATE_THIN:
 			if (tmsg->u.lv == seg->lv) {
-				log_debug("Discarding message for LV %s.",
-					  tmsg->u.lv->name);
+				log_debug_metadata("Discarding message for LV %s.",
+						   tmsg->u.lv->name);
 				dm_list_del(&tmsg->list);
 				no_update = 1; /* Replacing existing */
 			}
@@ -186,10 +186,10 @@ int attach_pool_message(struct lv_segment *pool_seg, dm_thin_message_t type,
 
 	dm_list_add(&pool_seg->thin_messages, &tmsg->list);
 
-	log_debug("Added %s message",
-		  (type == DM_THIN_MESSAGE_CREATE_SNAP ||
-		   type == DM_THIN_MESSAGE_CREATE_THIN) ? "create" :
-		  (type == DM_THIN_MESSAGE_DELETE) ? "delete" : "unknown");
+	log_debug_metadata("Added %s message",
+			   (type == DM_THIN_MESSAGE_CREATE_SNAP ||
+			   type == DM_THIN_MESSAGE_CREATE_THIN) ? "create" :
+			   (type == DM_THIN_MESSAGE_DELETE) ? "delete" : "unknown");
 
 	return 1;
 }
@@ -306,7 +306,7 @@ uint32_t get_free_pool_device_id(struct lv_segment *thin_pool_seg)
 		return 0;
 	}
 
-	log_debug("Found free pool device_id %u.", max_id);
+	log_debug_metadata("Found free pool device_id %u.", max_id);
 
 	return max_id;
 }
lib/metadata/vg.c +4 -4
index 2897d42..a868df7 100644
@@ -56,7 +56,7 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
 	dm_list_init(&vg->tags);
 	dm_list_init(&vg->removed_pvs);
 
-	log_debug("Allocated VG %s at %p.", vg->name, vg);
+	log_debug_mem("Allocated VG %s at %p.", vg->name, vg);
 
 	return vg;
 }
@@ -71,7 +71,7 @@ static void _free_vg(struct volume_group *vg)
 		return;
 	}
 
-	log_debug("Freeing VG %s at %p.", vg->name, vg);
+	log_debug_mem("Freeing VG %s at %p.", vg->name, vg);
 
 	dm_hash_destroy(vg->hostnames);
 	dm_pool_destroy(vg->vgmem);
@@ -260,8 +260,8 @@ int vg_set_mda_copies(struct volume_group *vg, uint32_t mda_copies)
 	vg->mda_copies = mda_copies;
 
 	/* FIXME Use log_verbose when this is due to specific cmdline request. */
-	log_debug("Setting mda_copies to %"PRIu32" for VG %s",
-		    mda_copies, vg->name);
+	log_debug_metadata("Setting mda_copies to %"PRIu32" for VG %s",
+			   mda_copies, vg->name);
 
 	return 1;
 }
lib/mirror/mirrored.c +4 -4
index 7ce8475..23a6371 100644
@@ -187,7 +187,7 @@ static int _mirrored_target_percent(void **target_state,
 		*target_state = _mirrored_init_target(mem, cmd);
 
 	/* Status line: <#mirrors> (maj:min)+ <synced>/<total_regions> */
-	log_debug("Mirror status: %s", params);
+	log_debug_activation("Mirror status: %s", params);
 
 	if (sscanf(pos, "%u %n", &mirror_count, &used) != 1) {
 		log_error("Failure parsing mirror status mirror count: %s",
@@ -288,7 +288,7 @@ static int _mirrored_transient_status(struct lv_segment *seg, char *params)
 				  log->name);
 			return 0;
 		}
-		log_debug("Found mirror log at %d:%d", info.major, info.minor);
+		log_debug_activation("Found mirror log at %d:%d", info.major, info.minor);
 		sprintf(buf, "%d:%d", info.major, info.minor);
 		if (strcmp(buf, log_args[1])) {
 			log_error("Mirror log mismatch. Metadata says %s, kernel says %s.",
@@ -312,11 +312,11 @@ static int _mirrored_transient_status(struct lv_segment *seg, char *params)
 				  seg_lv(seg, i)->name);
 			return 0;
 		}
-		log_debug("Found mirror image at %d:%d", info.major, info.minor);
+		log_debug_activation("Found mirror image at %d:%d", info.major, info.minor);
 		sprintf(buf, "%d:%d", info.major, info.minor);
 		for (j = 0; j < num_devs; ++j) {
 			if (!strcmp(buf, args[j])) {
-			    log_debug("Match: metadata image %d matches kernel image %d", i, j);
+			    log_debug_activation("Match: metadata image %d matches kernel image %d", i, j);
 			    images[j] = seg_lv(seg, i);
 			}
 		}
lib/misc/lvm-globals.c +4 -4
index 35d87ff..3c5d545 100644
@@ -136,9 +136,9 @@ void init_is_static(unsigned value)
 void init_udev_checking(int checking)
 {
 	if ((_udev_checking = checking))
-		log_debug("LVM udev checking enabled");
+		log_debug_activation("LVM udev checking enabled");
 	else
-		log_debug("LVM udev checking disabled");
+		log_debug_activation("LVM udev checking disabled");
 }
 
 void init_retry_deactivation(int retry)
@@ -149,9 +149,9 @@ void init_retry_deactivation(int retry)
 void init_activation_checks(int checks)
 {
 	if ((_activation_checks = checks))
-		log_debug("LVM activation checks enabled");
+		log_debug_activation("LVM activation checks enabled");
 	else
-		log_debug("LVM activation checks disabled");
+		log_debug_activation("LVM activation checks disabled");
 }
 
 void init_dev_disable_after_error_count(int value)
lib/misc/lvm-wrappers.c +3 -3
index 6cffae3..a96cd98 100644
@@ -46,12 +46,12 @@ int udev_is_running(void)
 	int r;
 
 	if (!_udev) {
-		log_debug(_no_context_msg);
+		log_debug_activation(_no_context_msg);
 		goto bad;
 	}
 
 	if (!(udev_queue = udev_queue_new(_udev))) {
-		log_debug("Could not get udev state.");
+		log_debug_activation("Could not get udev state.");
 		goto bad;
 	}
 
@@ -61,7 +61,7 @@ int udev_is_running(void)
 	return r;
 
 bad:
-	log_debug("Assuming udev is not running.");
+	log_debug_activation("Assuming udev is not running.");
 	return 0;
 }
 
lib/mm/memlock.c +22 -22

128 lines not on this page · raw message

lib/thin/thin.c +3 -3
index 14eb096..3f74588 100644
@@ -328,7 +328,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
 					return 0;
 				}
 			}
-			log_debug("Thin pool create_%s %s.", (!origin) ? "thin" : "snap", lmsg->u.lv->name);
+			log_debug_activation("Thin pool create_%s %s.", (!origin) ? "thin" : "snap", lmsg->u.lv->name);
 			if (!dm_tree_node_add_thin_pool_message(node,
 								(!origin) ? lmsg->type : DM_THIN_MESSAGE_CREATE_SNAP,
 								first_seg(lmsg->u.lv)->device_id,
@@ -336,7 +336,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
 				return_0;
 			break;
 		case DM_THIN_MESSAGE_DELETE:
-			log_debug("Thin pool delete %u.", lmsg->u.delete_id);
+			log_debug_activation("Thin pool delete %u.", lmsg->u.delete_id);
 			if (!dm_tree_node_add_thin_pool_message(node,
 								lmsg->type,
 								lmsg->u.delete_id, 0))
@@ -350,7 +350,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
 
 	if (!dm_list_empty(&seg->thin_messages)) {
 		/* Messages were passed, modify transaction_id as the last one */
-		log_debug("Thin pool set transaction id %" PRIu64 ".", seg->transaction_id);
+		log_debug_activation("Thin pool set transaction id %" PRIu64 ".", seg->transaction_id);
 		if (!dm_tree_node_add_thin_pool_message(node,
 							DM_THIN_MESSAGE_SET_TRANSACTION_ID,
 							seg->transaction_id - 1,
libdm/ioctl/libdm-iface.c +40 -40

116 lines not on this page · raw message

libdm/libdm-common.c +64 -64

309 lines not on this page · raw message

libdm/libdm-deptree.c +23 -23

105 lines not on this page · raw message

libdm/mm/dbg_malloc.c +1 -1
index d37083f..a2a6b76 100644
@@ -117,7 +117,7 @@ void *dm_malloc_aux_debug(size_t s, const char *file, int line)
 	if (_mem_stats.bytes > _mem_stats.mbytes)
 		_mem_stats.mbytes = _mem_stats.bytes;
 
-	/* log_debug("Allocated: %u %u %u", nb->id, _mem_stats.blocks_allocated,
+	/* log_debug_mem("Allocated: %u %u %u", nb->id, _mem_stats.blocks_allocated,
 		  _mem_stats.bytes); */
 #ifdef VALGRIND_POOL
 	VALGRIND_MAKE_MEM_UNDEFINED(nb + 1, s);
libdm/mm/pool-debug.c +5 -5
index 7f9a0e4..3bd6cab 100644
@@ -62,7 +62,7 @@ struct dm_pool *dm_pool_create(const char *name, size_t chunk_hint)
 	mem->orig_pool = mem;
 
 #ifdef DEBUG_POOL
-	log_debug("Created mempool %s", name);
+	log_debug_mem("Created mempool %s", name);
 #endif
 
 	dm_list_add(&_dm_pools, &mem->list);
@@ -91,10 +91,10 @@ static void _free_blocks(struct dm_pool *p, struct block *b)
 static void _pool_stats(struct dm_pool *p, const char *action)
 {
 #ifdef DEBUG_POOL
-	log_debug("%s mempool %s: %u/%u bytes, %u/%u blocks, "
-		  "%u allocations)", action, p->name, p->stats.bytes,
-		  p->stats.maxbytes, p->stats.blocks_allocated,
-		  p->stats.blocks_max, p->stats.block_serialno);
+	log_debug_mem("%s mempool %s: %u/%u bytes, %u/%u blocks, "
+		      "%u allocations)", action, p->name, p->stats.bytes,
+		      p->stats.maxbytes, p->stats.blocks_allocated,
+		      p->stats.blocks_max, p->stats.block_serialno);
 #else
 	;
 #endif
libdm/mm/pool.c +2 -2
index b81a9b6..fd08307 100644
@@ -141,7 +141,7 @@ int dm_pool_lock(struct dm_pool *p, int crc)
 
 	p->locked = 1;
 
-	log_debug("Pool %s is locked.", p->name);
+	log_debug_mem("Pool %s is locked.", p->name);
 
 	return 1;
 }
@@ -172,7 +172,7 @@ int dm_pool_unlock(struct dm_pool *p, int crc)
 	if (!_pool_protect(p, PROT_READ | PROT_WRITE))
 		return_0;
 
-	log_debug("Pool %s is unlocked.", p->name);
+	log_debug_mem("Pool %s is unlocked.", p->name);
 
 	if (crc && (p->crc != _pool_crc(p))) {
 		log_error(INTERNAL_ERROR "Pool %s crc mismatch.", p->name);
tools/lvmcmdline.c +1 -0
index 6d6537b..c37ae25 100644
@@ -971,6 +971,7 @@ int help(struct cmd_context *cmd __attribute__((unused)), int argc, char **argv)
 static void _apply_settings(struct cmd_context *cmd)
 {
 	init_debug(cmd->current_settings.debug);
+	init_debug_classes_logged(cmd->default_settings.debug_classes);
 	init_verbose(cmd->current_settings.verbose + VERBOSE_BASE_LEVEL);
 	init_silent(cmd->current_settings.silent);
 	init_test(cmd->current_settings.test);
tools/pvscan.c +1 -1
index 1e844c5..ff5ced2 100644
@@ -148,7 +148,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
 	/* TODO: Remove this once lvmetad + cluster supported! */
 	if (find_config_tree_int(cmd, "global/locking_type", 1) == 3 ||
 	    !find_config_tree_int(cmd, "global/use_lvmetad", 0)) {
-		log_debug("_pvscan_lvmetad: immediate return");
+		log_debug_lvmetad("_pvscan_lvmetad: immediate return");
 		return ret;
 	}