[Devel] [PATCH vz7 1/2] ploop: convert printk to pr_nnnn

Alexander Atanasov alexander.atanasov at virtuozzo.com
Fri Jan 20 12:03:39 MSK 2023


Unify logging along ploop in preparation to add device names
to log messages where possible.

No functional changes.

https://jira.sw.ru/browse/PSBM-144575
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/block/ploop/dev.c           | 53 ++++++++++++++---------------
 drivers/block/ploop/fmt_ploop1.c    |  4 +--
 drivers/block/ploop/fmt_raw.c       |  6 ++--
 drivers/block/ploop/freeblks.c      | 14 ++++----
 drivers/block/ploop/io.c            |  2 +-
 drivers/block/ploop/io_direct.c     | 12 +++----
 drivers/block/ploop/io_direct_map.c | 11 +++---
 drivers/block/ploop/io_kaio.c       | 24 ++++++-------
 drivers/block/ploop/map.c           |  6 ++--
 drivers/block/ploop/push_backup.c   | 14 ++++----
 drivers/block/ploop/sysfs.c         | 10 +++---
 11 files changed, 77 insertions(+), 79 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 4e06123f4f14..dfad24818216 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -1968,7 +1968,7 @@ ploop_entry_zero_req(struct ploop_request *preq)
 
 	level = map_get_index(preq, preq->req_cluster, &iblk);
 	if (level != top_delta->level) {
-		printk("Can't zero index on wrong level=%d "
+		pr_warn("Can't zero index on wrong level=%d "
 		       "(top_level=%d req_cluster=%u iblk=%u/%u)\n",
 		       level, top_delta->level, preq->req_cluster,
 		       iblk, preq->iblock);
@@ -2104,14 +2104,14 @@ ploop_entry_reloc_s_req(struct ploop_request *preq, iblock_t *iblk)
 
 	level = map_get_index(preq, preq->req_cluster, iblk);
 	if (level != top_delta->level) {
-		printk("Can't relocate block on wrong level=%d "
+		pr_warn("Can't relocate block on wrong level=%d "
 		       "(top_level=%d req_cluster=%u iblk=%u/%u)\n",
 		       level, top_delta->level, preq->req_cluster,
 		       *iblk, preq->iblock);
 		return -EIO;
 	}
 	if (preq->src_iblock != *iblk) {
-		printk("Can't relocate block due to wrong mapping: "
+		pr_warn("Can't relocate block due to wrong mapping: "
 		       "req_cluster=%u should point to iblk=%u while "
 		       "map_get_index() calculated iblk=%u\n",
 		       preq->req_cluster, preq->src_iblock, *iblk);
@@ -2251,7 +2251,7 @@ static int ploop_entry_discard_req(struct ploop_request *preq)
 			preq->dst_iblock = 0;
 			if (err) {
 				if (err == -EINVAL) {
-					printk("ploop_entry_discard_req1: "
+					pr_warn("ploop_entry_discard_req1: "
 					       "(%lu %u; %u %u; %u %u)\n",
 					       preq->req_sector, preq->req_size,
 					       preq->req_cluster, preq->iblock,
@@ -2273,7 +2273,7 @@ static int ploop_entry_discard_req(struct ploop_request *preq)
 		err = ploop_fb_add_free_extent(plo->fbd, preq->dst_cluster,
 						preq->dst_iblock, len);
 		if (err == -EINVAL) {
-			printk("ploop_entry_discard_req2: "
+			pr_warn("ploop_entry_discard_req2: "
 			       "(%lu %u; %u %u; %u %u)\n",
 			       preq->req_sector, preq->req_size,
 			       preq->req_cluster, preq->iblock,
@@ -2826,7 +2826,7 @@ restart:
 	case PLOOP_E_COMPLETE:
 		if (unlikely(test_bit(PLOOP_REQ_RELOC_S, &preq->state) &&
 			     preq->error)) {
-			printk("RELOC_S completed with err %d"
+			pr_warn("RELOC_S completed with err %d"
 			       " (%u %u %u %u %u)\n",
 			       preq->error, preq->req_cluster, preq->iblock,
 			       preq->src_iblock, preq->dst_cluster,
@@ -3984,7 +3984,7 @@ static void rename_deltas(struct ploop_device * plo, int level)
 				  "%d", delta->level);
 #endif
 		if (err)
-			printk("rename_deltas: %d %d %d\n", err, level, delta->level);
+			pr_warn("rename_deltas: %d %d %d\n", err, level, delta->level);
 	}
 }
 
@@ -4014,7 +4014,7 @@ static int ploop_del_delta(struct ploop_device * plo, unsigned long arg)
 		return -EBUSY;
 
 	if (level == 0 && test_bit(PLOOP_S_RUNNING, &plo->state)) {
-		printk(KERN_INFO "Can't del base delta on running ploop%d\n",
+		pr_info("Can't del base delta on running ploop%d\n",
 		       plo->index);
 		return -EBUSY;
 	}
@@ -4196,7 +4196,7 @@ static int ploop_merge(struct ploop_device * plo)
 
 	err = ploop_prepare_merge(next, &sd);
 	if (err) {
-		printk(KERN_WARNING "prepare_merge for ploop%d failed (%d)\n",
+		pr_warn("prepare_merge for ploop%d failed (%d)\n",
 		       plo->index, err);
 		goto out;
 	}
@@ -4222,7 +4222,7 @@ static int ploop_merge(struct ploop_device * plo)
 		 * in prepare_merge. Failed start_merge means
 		 * abort of the device.
 		 */
-		printk(KERN_WARNING "start_merge for ploop%d failed (%d)\n",
+		pr_warn("start_merge for ploop%d failed (%d)\n",
 		       plo->index, err);
 		set_bit(PLOOP_S_ABORT, &plo->state);
 	}
@@ -4250,7 +4250,7 @@ already:
 	delta = map_top_delta(plo->trans_map);
 
 	if (test_bit(PLOOP_S_ABORT, &plo->state)) {
-		printk(KERN_WARNING "merge for ploop%d failed (state ABORT)\n",
+		pr_warn("merge for ploop%d failed (state ABORT)\n",
 		       plo->index);
 		err = -EIO;
 	}
@@ -4314,8 +4314,7 @@ static int ploop_bd_full(struct backing_dev_info *bdi, long long nr, int root)
 			static unsigned long full_warn_time;
 
 			if (printk_timed_ratelimit(&full_warn_time, 60*60*HZ))
-				printk(KERN_WARNING
-				       "ploop%d: host disk is almost full "
+				pr_warn("ploop%d: host disk is almost full "
 				       "(%llu < %llu); CT sees -ENOSPC !\n",
 				       plo->index, buf.f_bfree * buf.f_bsize,
 				       reserved + nr);
@@ -4418,7 +4417,7 @@ static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 
 	if (bdev != bdev->bd_contains) {
 		if (printk_ratelimit())
-			printk(KERN_INFO "stop ploop%d failed (wrong bdev)\n",
+			pr_info("stop ploop%d failed (wrong bdev)\n",
 			       plo->index);
 		return -ENODEV;
 	}
@@ -4440,7 +4439,7 @@ static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 		return -EINVAL;
 
 	if (list_empty(&plo->map.delta_list)) {
-		printk(KERN_INFO "stop ploop%d failed (no deltas)\n",
+		pr_info("stop ploop%d failed (no deltas)\n",
 		       plo->index);
 		return -ENOENT;
 	}
@@ -4448,7 +4447,7 @@ static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 	cnt = atomic_read(&plo->open_count);
 	if (cnt > 1) {
 		if (printk_ratelimit())
-			printk(KERN_INFO "stop ploop%d failed (cnt=%d)\n",
+			pr_info("stop ploop%d failed (cnt=%d)\n",
 			       plo->index, cnt);
 		return -EBUSY;
 	}
@@ -4456,7 +4455,7 @@ static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 	cnt = atomic_read(&plo->maintenance_cnt);
 	if (plo->maintenance_type != PLOOP_MNTN_OFF && cnt) {
 		if (printk_ratelimit())
-			printk(KERN_INFO "stop ploop%d failed "
+			pr_info("stop ploop%d failed "
 			       "(type=%d cnt=%d)\n",
 			       plo->index, plo->maintenance_type, cnt);
 		return -EBUSY;
@@ -4464,7 +4463,7 @@ static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 
 	if (plo->freeze_state != PLOOP_F_NORMAL) {
 		if (printk_ratelimit())
-			printk(KERN_INFO "stop ploop%d failed (freeze_state=%d)\n",
+			pr_info("stop ploop%d failed (freeze_state=%d)\n",
 			       plo->index, plo->freeze_state);
 		return -EBUSY;
 	}
@@ -4581,20 +4580,20 @@ static int ploop_clear(struct ploop_device * plo, struct block_device * bdev)
 
 	if (test_bit(PLOOP_S_RUNNING, &plo->state)) {
 		if (printk_ratelimit())
-			printk(KERN_INFO "clear ploop%d failed (RUNNING)\n",
+			pr_info("clear ploop%d failed (RUNNING)\n",
 			       plo->index);
 		return -EBUSY;
 	}
 	if (plo->maintenance_type == PLOOP_MNTN_TRACK) {
 		if (printk_ratelimit())
-			printk(KERN_INFO "clear ploop%d failed (TRACK)\n",
+			pr_info("clear ploop%d failed (TRACK)\n",
 			       plo->index);
 		return -EBUSY;
 	}
 	cnt = atomic_read(&plo->maintenance_cnt);
 	if (plo->maintenance_type != PLOOP_MNTN_OFF && cnt) {
 		if (printk_ratelimit())
-			printk(KERN_INFO "clear ploop%d failed "
+			pr_info("clear ploop%d failed "
 			       "(type=%d cnt=%d)\n",
 			       plo->index, plo->maintenance_type, cnt);
 		return -EBUSY;
@@ -4963,14 +4962,14 @@ static int ploop_freeblks_ioc(struct ploop_device *plo, unsigned long arg)
 					extent.iblk, extent.len);
 		if (rc) {
 			if (rc == -EINVAL) {
-				printk("ploop_freeblks_ioc: n=%d\n", ctl.n_extents);
+				pr_warn("ploop_freeblks_ioc: n=%d\n", ctl.n_extents);
 				for (i = 0; i < ctl.n_extents; i++) {
 					if (copy_from_user(&extent, &extents[i],
 							   sizeof(extent))) {
-						printk("copy failed: i=%d\n", i);
+						pr_warn("copy failed: i=%d\n", i);
 						break;
 					}
-					printk("ploop_freeblks_ioc: i=%d: %u %u %u\n",
+					pr_warn("ploop_freeblks_ioc: i=%d: %u %u %u\n",
 					       i, extent.clu, extent.iblk, extent.len);
 				}
 				WARN_ONCE(1, "add_free_extent failed\n");
@@ -5444,7 +5443,7 @@ static int ploop_push_backup_io(struct ploop_device *plo, unsigned long arg)
 		return -EINVAL;
 
 	if (ploop_pb_check_uuid(pbd, ctl.cbt_uuid)) {
-		printk("ploop(%d): PUSH_BACKUP_IO uuid mismatch\n",
+		pr_warn("ploop(%d): PUSH_BACKUP_IO uuid mismatch\n",
 		       plo->index);
 		return -EINVAL;
 	}
@@ -5474,7 +5473,7 @@ static int ploop_push_backup_stop(struct ploop_device *plo, unsigned long arg)
 		return -EFAULT;
 
 	if (pbd && ploop_pb_check_uuid(pbd, ctl.cbt_uuid)) {
-		printk("ploop(%d): PUSH_BACKUP_STOP uuid mismatch\n",
+		pr_warn("ploop(%d): PUSH_BACKUP_STOP uuid mismatch\n",
 		       plo->index);
 		return -EINVAL;
 	}
@@ -6073,7 +6072,7 @@ static int __init ploop_mod_init(void)
 			 proc_vz_dir, &proc_ploop_minor))
 		goto out_err2;
 
-	printk(KERN_INFO "ploop_dev: module loaded\n");
+	pr_info("ploop_dev: module loaded\n");
 	return 0;
 
 out_err2:
diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index 26e70014c3e6..40a7919e1ec8 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -594,7 +594,7 @@ ploop1_start_merge(struct ploop_delta * delta, struct ploop_snapdata * sd)
 		return err;
 
 	if (test_bit(PLOOP_S_ABORT, &delta->plo->state)) {
-		printk(KERN_WARNING "ploop1_start_merge for ploop%d failed "
+		pr_warn("ploop1_start_merge for ploop%d failed "
 		       "(state ABORT)\n", delta->plo->index);
 		return -EIO;
 	}
@@ -814,7 +814,7 @@ static int ploop1_complete_grow(struct ploop_delta * delta, u64 new_size)
 	vh_bsize = le32_to_cpu(vh->m_Sectors);
 
 	if (vh_bsize != (1 << delta->io.plo->cluster_log)) {
-		printk("grow: vh->m_Sectors=%u != 1<<plo->cluster_log=%u\n",
+		pr_warn("grow: vh->m_Sectors=%u != 1<<plo->cluster_log=%u\n",
 		       vh_bsize, 1 << delta->io.plo->cluster_log);
 		return -EINVAL;
 	}
diff --git a/drivers/block/ploop/fmt_raw.c b/drivers/block/ploop/fmt_raw.c
index 9e0c517a0100..6d4364581764 100644
--- a/drivers/block/ploop/fmt_raw.c
+++ b/drivers/block/ploop/fmt_raw.c
@@ -85,11 +85,11 @@ raw_refresh(struct ploop_delta * delta)
 
 	pos = delta->io.ops->i_size_read(&delta->io);
 	if (pos & (cluster_size_in_bytes(delta->plo) - 1)) {
-		printk("raw delta is not aligned (%llu bytes)\n", pos);
+		pr_warn("raw delta is not aligned (%llu bytes)\n", pos);
 		return -EINVAL;
 	}
 	if ((pos >> (cluster_log + 9)) < delta->io.alloc_head) {
-		printk("raw delta was corrupted "
+		pr_warn("raw delta was corrupted "
 		       "(old_size=%u new_size=%llu iblocks)\n",
 		       delta->io.alloc_head,
 		       pos >> (cluster_log + 9));
@@ -198,7 +198,7 @@ raw_start_merge(struct ploop_delta * delta, struct ploop_snapdata * sd)
 		return err;
 
 	if (test_bit(PLOOP_S_ABORT, &delta->plo->state)) {
-		printk(KERN_WARNING "raw_start_merge for ploop%d failed "
+		pr_warn(KERN_WARNING "raw_start_merge for ploop%d failed "
 		       "(state ABORT)\n", delta->plo->index);
 		return -EIO;
 	}
diff --git a/drivers/block/ploop/freeblks.c b/drivers/block/ploop/freeblks.c
index 7a06b09a8e7d..46699c6a7c63 100644
--- a/drivers/block/ploop/freeblks.c
+++ b/drivers/block/ploop/freeblks.c
@@ -391,7 +391,7 @@ static int split_fb_extent(struct ploop_freeblks_extent *extent, u32 *off_p,
 
 	new_extent = kzalloc(sizeof(*new_extent), GFP_KERNEL);
 	if (new_extent == NULL) {
-		printk("Can't allocate new freeblks extent for splittig!\n");
+		pr_warn("Can't allocate new freeblks extent for splittig!\n");
 		return -ENOMEM;
 	}
 
@@ -855,7 +855,7 @@ int ploop_fb_add_free_extent(struct ploop_freeblks_desc *fbd,
 	struct ploop_freeblks_extent *ex;
 
 	if (len == 0) {
-		printk("ploop_fb_add_free_extent(): empty extent! (%u/%u)\n",
+		pr_warn("ploop_fb_add_free_extent(): empty extent! (%u/%u)\n",
 		       clu, iblk);
 		return 0;
 	}
@@ -870,7 +870,7 @@ int ploop_fb_add_free_extent(struct ploop_freeblks_desc *fbd,
 
 		if (iblk + len > tmp->iblk) {
 			int c = &ex->list != &fbd->fbd_free_list;
-			printk("ploop_fb_add_free_extent(): next (%u %u %u) "
+			pr_warn("ploop_fb_add_free_extent(): next (%u %u %u) "
 			       "intersects with (%u %u %u); ex (%u %u %d)\n",
 			       tmp->clu, tmp->iblk, tmp->len, clu, iblk, len,
 			       c ? ex->clu : 0, c ? ex->iblk : 0, c ? ex->len : -1);
@@ -883,7 +883,7 @@ int ploop_fb_add_free_extent(struct ploop_freeblks_desc *fbd,
 			struct ploop_freeblks_extent *t = NULL;
 			if (ex->list.next != &fbd->fbd_free_list)
 				t = list_entry(ex->list.next, struct ploop_freeblks_extent, list);
-			printk("ploop_fb_add_free_extent(): ex (%u %u %u) "
+			pr_warn("ploop_fb_add_free_extent(): ex (%u %u %u) "
 			       "intersects with (%u %u %u); next (%u %u %d)\n",
 			       ex->clu, ex->iblk, ex->len, clu, iblk, len,
 			       t ? t->clu : 0, t ? t->iblk : 0, t ? t->len : -1);
@@ -915,7 +915,7 @@ int ploop_fb_add_reloc_extent(struct ploop_freeblks_desc *fbd,
 	struct ploop_relocblks_extent *rblk_extent;
 
 	if (len == 0) {
-		printk("ploop_fb_add_reloc_extent(): empty extent! (%u/%u)\n",
+		pr_warn("ploop_fb_add_reloc_extent(): empty extent! (%u/%u)\n",
 		       clu, iblk);
 		return 0;
 	}
@@ -924,7 +924,7 @@ int ploop_fb_add_reloc_extent(struct ploop_freeblks_desc *fbd,
 		rblk_extent = list_entry(fbd->fbd_reloc_list.prev,
 					 struct ploop_relocblks_extent, list);
 		if (rblk_extent->iblk + rblk_extent->len > iblk) {
-			printk("ploop_fb_add_reloc_extent(): extents should be sorted\n");
+			pr_warn("ploop_fb_add_reloc_extent(): extents should be sorted\n");
 			return -EINVAL;
 		}
 
@@ -932,7 +932,7 @@ int ploop_fb_add_reloc_extent(struct ploop_freeblks_desc *fbd,
 			rblk_extent = list_entry(rblk_extent->list.next,
 					 struct ploop_relocblks_extent, list);
 			if (iblk + len > rblk_extent->iblk) {
-				printk("ploop_fb_add_reloc_extent(): intersected extents\n");
+				pr_warn("ploop_fb_add_reloc_extent(): intersected extents\n");
 				return -EINVAL;
 			}
 		}
diff --git a/drivers/block/ploop/io.c b/drivers/block/ploop/io.c
index ad1d365d7c6c..8513c51cbb36 100644
--- a/drivers/block/ploop/io.c
+++ b/drivers/block/ploop/io.c
@@ -144,7 +144,7 @@ void ploop_io_report_fn(struct file * file, char * msg)
 			fn = "?";
 	}
 
-	printk("%s: %s\n", msg, fn);
+	pr_warn("%s: %s\n", msg, fn);
 
 	if (path)
 		free_page((unsigned long)path);
diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index f24a3db23a62..d2759447e23a 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -880,7 +880,7 @@ retry:
 		struct ploop_device *plo = io->plo;
 		struct block_device *dm_crypt_bdev;
 
-		printk("PLOOP: failed to invalidate page cache %d/%d\n", err, attempt2);
+		pr_warn("PLOOP: failed to invalidate page cache %d/%d\n", err, attempt2);
 		if (attempt2)
 			return err;
 		attempt2 = 1;
@@ -915,7 +915,7 @@ static int dio_release_prealloced(struct ploop_io * io)
 
 	ret = dio_truncate(io, io->files.file, io->alloc_head);
 	if (ret)
-		printk("Can't release %llu prealloced bytes: "
+		pr_warn("Can't release %llu prealloced bytes: "
 		       "truncate to %llu failed (%d)\n",
 		       io->prealloced_size - end_pos, end_pos, ret);
 	else
@@ -1764,7 +1764,7 @@ static int dio_autodetect(struct ploop_io *io, unsigned int id)
 		return -1;
 
 	if (inode->i_sb->s_bdev == NULL) {
-		printk("File on FS EXT(%s) without backing device\n", s_id);
+		pr_warn("File on FS EXT(%s) without backing device\n", s_id);
 		return -1;
 	}
 
@@ -1773,12 +1773,12 @@ static int dio_autodetect(struct ploop_io *io, unsigned int id)
 					"File on FS w/o fallocate");
 
 	if (!file->f_op->unlocked_ioctl) {
-		printk("Cannot run on EXT4(%s): no unlocked_ioctl\n", s_id);
+		pr_warn("Cannot run on EXT4(%s): no unlocked_ioctl\n", s_id);
 		return -1;
 	}
 
 	if (!file->f_op->fsync) {
-		printk("Cannot run on EXT4(%s): no fsync\n", s_id);
+		pr_warn("Cannot run on EXT4(%s): no fsync\n", s_id);
 		return -1;
 	}
 
@@ -1789,7 +1789,7 @@ static int dio_autodetect(struct ploop_io *io, unsigned int id)
 	set_fs(fs);
 
 	if (err != 0) {
-		printk("Cannot run on EXT4(%s): failed FS_IOC_GETFLAGS (%d)\n",
+		pr_warn("Cannot run on EXT4(%s): failed FS_IOC_GETFLAGS (%d)\n",
 		       s_id, err);
 		return -1;
 	}
diff --git a/drivers/block/ploop/io_direct_map.c b/drivers/block/ploop/io_direct_map.c
index 8f09ab083315..43b2dcdde293 100644
--- a/drivers/block/ploop/io_direct_map.c
+++ b/drivers/block/ploop/io_direct_map.c
@@ -379,14 +379,14 @@ static inline void purge_lru_warn(struct extent_map_tree *tree)
 
 	ratio /= images_size;
 
-	printk(KERN_WARNING "Purging lru entry from extent tree for inode %ld "
+	pr_warn("Purging lru entry from extent tree for inode %ld "
 	       "(map_size=%d ratio=%lld%%)\n",
 	       tree->mapping->host->i_ino, tree->map_size, ratio);
 
 	/* Claim FS as 'too fragmented' if average_extent_size < 8MB */
 	if ((u64)max_entries * (8 * 1024 * 1024) <
 	    atomic_long_read(&ploop_io_images_size))
-		printk(KERN_WARNING "max_extent_map_pages=%d is too low for "
+		pr_warn("max_extent_map_pages=%d is too low for "
 		       "ploop_io_images_size=%ld bytes\n",
 		       max_extent_map_pages,
 		       atomic_long_read(&ploop_io_images_size));
@@ -394,7 +394,7 @@ static inline void purge_lru_warn(struct extent_map_tree *tree)
 		loff_t avg_siz = i_size_read(tree->mapping->host);
 		do_div(avg_siz, tree->map_size);
 
-		printk(KERN_WARNING "host fs is too fragmented: average extent"
+		pr_warn("host fs is too fragmented: average extent"
 		       " size is lesser than %lld bytes\n", avg_siz);
 	}
 }
@@ -635,7 +635,7 @@ again:
 	    (fi_extent.fe_physical >> 9) == 0) {
 		/* see how ext4_fill_fiemap_extents() implemented */
 		if (!(fi_extent.fe_flags & FIEMAP_EXTENT_DELALLOC)) {
-			printk("bad fiemap(%ld,%ld) on inode=%p &fieinfo=%p"
+			pr_warn("bad fiemap(%ld,%ld) on inode=%p &fieinfo=%p"
 			" i_size=%lld\n", start, len, inode, &fieinfo,
 			i_size_read(inode));
 			BUG();
@@ -782,8 +782,7 @@ void dump_extent_map(struct extent_map_tree *tree)
 
 	while (r) {
 		struct extent_map *em0 = rb_entry(r, struct extent_map, rb_node);
-		printk("N=%ld %ld -> %ld\n", (long)em0->start, (long)(em0->end - em0->start), (long)em0->block_start);
+		pr_warn("N=%ld %ld -> %ld\n", (long)em0->start, (long)(em0->end - em0->start), (long)em0->block_start);
 		r = rb_next(r);
 	}
 }
-
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index a0c28379eb7d..f9413e701736 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -130,7 +130,7 @@ static void check_standby_mode(long res, struct ploop_device *plo) {
 	spin_unlock_irq(q->queue_lock);
 
 	if (!prev)
-		printk("ploop%d was switched into "
+		pr_warn("ploop%d was switched into "
 		       "the standby mode\n", plo->index);
 }
 
@@ -141,14 +141,14 @@ static void kaio_rw_aio_complete(u64 data, long res)
 	if (unlikely(res < 0)) {
 		struct bio *b = preq->aux_bio;
 
-		printk("kaio_rw_aio_complete: kaio failed with err=%ld "
+		pr_warn("kaio_rw_aio_complete: kaio failed with err=%ld "
 		       "(rw=%s; state=%ld/0x%lx; clu=%d; iblk=%d; aux=%ld)\n",
 		       res, (preq->req_rw & REQ_WRITE) ? "WRITE" : "READ",
 		       preq->eng_state, preq->state, preq->req_cluster,
 		       preq->iblock, b ? b->bi_sector : -1);
 
 		bio_list_for_each(b, &preq->bl)
-			printk(" bio=%p: bi_sector=%ld bi_size=%d\n",
+			pr_warn(" bio=%p: bi_sector=%ld bi_size=%d\n",
 			       b, b->bi_sector, b->bi_size);
 		if (static_key_false(&ploop_standby_check))
 			check_standby_mode(res, preq->plo);
@@ -216,7 +216,7 @@ static int kaio_kernel_submit(struct file *file, struct kaio_req *kreq,
 
 	err = aio_kernel_submit(iocb);
 	if (err)
-		printk("kaio_kernel_submit: aio_kernel_submit failed with "
+		pr_warn("kaio_kernel_submit: aio_kernel_submit failed with "
 		       "err=%d (rw=%s; state=%ld/0x%lx; pos=%lld; len=%ld)\n",
 		       err, (rw & REQ_WRITE) ? "WRITE" : "READ",
 		       kreq->preq->eng_state, kreq->preq->state, pos, count);
@@ -480,7 +480,7 @@ static int kaio_resubmit(struct ploop_request * preq)
 		preq->eng_state = PLOOP_E_DELTA_COPIED; /* skip bcopy() */
 		return 0;
 	default:
-		printk("Resubmit bad state %lu\n", preq->eng_state);
+		pr_warn("Resubmit bad state %lu\n", preq->eng_state);
 		BUG();
 	}
 
@@ -559,7 +559,7 @@ static int kaio_fsync_thread(void * data)
 			struct file *file = io->files.file;
 			err = vfs_fsync(file, 1);
 			if (err) {
-				printk("kaio_fsync_thread: vfs_fsync failed "
+				pr_warn("kaio_fsync_thread: vfs_fsync failed "
 				       "with err=%d (i_ino=%ld of level=%d "
 				       "on ploop%d)\n",
 				       err, io->files.inode->i_ino,
@@ -648,7 +648,7 @@ static int kaio_release_prealloced(struct ploop_io * io)
 
 	ret = kaio_truncate(io, io->files.file, io->alloc_head);
 	if (ret)
-		printk("Can't release %llu prealloced bytes: "
+		pr_warn("Can't release %llu prealloced bytes: "
 		       "truncate to %llu failed (%d)\n",
 		       io->prealloced_size - end_pos, end_pos, ret);
 	else
@@ -747,7 +747,7 @@ kaio_io_page(struct ploop_io * io, int op, struct ploop_request * preq,
 
 	err = aio_kernel_submit(iocb);
 	if (err) {
-		printk("kaio_io_page: aio_kernel_submit failed with "
+		pr_warn("kaio_io_page: aio_kernel_submit failed with "
 		       "err=%d (rw=%s; state=%ld/0x%lx; pos=%lld)\n",
 		       err, (op == IOCB_CMD_WRITE_ITER) ? "WRITE" : "READ",
 		       preq->eng_state, preq->state, pos);
@@ -862,7 +862,7 @@ kaio_sync_io(struct ploop_io * io, int op, struct page **pages,
 
 	err = aio_kernel_submit(iocb);
 	if (err) {
-		printk("kaio_sync_io: aio_kernel_submit failed with "
+		pr_warn("kaio_sync_io: aio_kernel_submit failed with "
 		       "err=%d (rw=%s; pos=%lld; len=%d off=%d)\n",
 		       err, (op == IOCB_CMD_WRITE_ITER) ? "WRITE" : "READ",
 		       pos, len, off);
@@ -877,7 +877,7 @@ kaio_sync_io(struct ploop_io * io, int op, struct page **pages,
 	wait_for_completion(&comp.comp);
 
 	if (!err && comp.error)
-		printk("kaio_sync_io: kaio failed with err=%d "
+		pr_warn("kaio_sync_io: kaio failed with err=%d "
 		       "(rw=%s; pos=%lld; len=%d off=%d)\n",
 		       comp.error,
 		       (op == IOCB_CMD_WRITE_ITER) ? "WRITE" : "READ",
@@ -1157,7 +1157,7 @@ static int __kaio_truncate(struct ploop_io * io, struct file * file, u64 pos)
 	mutex_unlock(&io->files.inode->i_mutex);
 
 	if (err) {
-		printk("__kaio_truncate(i_ino=%ld of level=%d on ploop%d, "
+		pr_warn("__kaio_truncate(i_ino=%ld of level=%d on ploop%d, "
 		       "pos=%lld): notify_change failed with err=%d "
 		       "(i_size=%lld)\n",
 		       io->files.inode->i_ino, io2level(io), io->plo->index,
@@ -1168,7 +1168,7 @@ static int __kaio_truncate(struct ploop_io * io, struct file * file, u64 pos)
 	err = vfs_fsync(file, 0);
 
 	if (err)
-		printk("__kaio_truncate(i_ino=%ld of level=%d on ploop%d, "
+		pr_warn("__kaio_truncate(i_ino=%ld of level=%d on ploop%d, "
 		       "pos=%lld): vfs_fsync failed with err=%d\n",
 		       io->files.inode->i_ino, io2level(io), io->plo->index,
 		       pos, err);
diff --git a/drivers/block/ploop/map.c b/drivers/block/ploop/map.c
index 460fa4f37a23..73ac24ac3304 100644
--- a/drivers/block/ploop/map.c
+++ b/drivers/block/ploop/map.c
@@ -320,7 +320,7 @@ map_create(struct ploop_map * map, cluster_t block)
 		else if (block > entry->mn_end)
 			p = &(*p)->rb_right;
 		else
-			printk("map_create: Oops! block=%u; mn_range=[%u..%u]\n",
+			pr_warn("map_create: Oops! block=%u; mn_range=[%u..%u]\n",
 			       block, entry->mn_start, entry->mn_end);
 	}
 
@@ -700,7 +700,7 @@ void ploop_update_map(struct ploop_map * map, int level,
 		if (lvl == level)
 			p[idx] = iblk << ploop_map_log(map->plo);
 		else if (lvl < level)
-			printk("Unexpected condition: uptodate map_node %p "
+			pr_warn("Unexpected condition: uptodate map_node %p "
 			       "covering range %u..%u maps %u to %u on level "
 			       "%d, while user-space merge detected mapping "
 			       "on level %d\n", m, m->mn_start, m->mn_end,
@@ -943,7 +943,7 @@ void ploop_index_update(struct ploop_request * preq)
 
 	BUG_ON (test_bit(PLOOP_REQ_ZERO, &preq->state) && preq->iblock);
 	if (test_bit(PLOOP_REQ_ZERO, &preq->state) && !blk) {
-		printk("Either map_node is corrupted or bug in "
+		pr_warn("Either map_node is corrupted or bug in "
 		       "ploop-balloon (%u)\n", preq->req_cluster);
 		PLOOP_REQ_SET_ERROR(preq, -EIO);
 		goto corrupted;
diff --git a/drivers/block/ploop/push_backup.c b/drivers/block/ploop/push_backup.c
index ac07919fb8d3..576eb36145e4 100644
--- a/drivers/block/ploop/push_backup.c
+++ b/drivers/block/ploop/push_backup.c
@@ -129,7 +129,7 @@ int ploop_pb_cbt_map_release(struct ploop_pushbackup_desc *pbd, bool do_merge)
 					pbd->cbt_block_max,
 					pbd->cbt_block_bits);
 		if (ret)
-			printk("ploop(%d): blk_cbt_map_merge() failed with "
+			pr_warn("ploop(%d): blk_cbt_map_merge() failed with "
 			       "%d\n", pbd->plo->index, ret);
 	}
 
@@ -268,7 +268,7 @@ static bool check_bit_in_map(struct page **map, u64 map_max, u64 blk)
 static void set_bits_in_map(struct page **map, u64 map_max, u64 blk, u64 cnt)
 {
 	if (blk + cnt > map_max) {
-		printk("set_bits_in_map: extent [%llu, %llu) is out of range"
+		pr_warn("set_bits_in_map: extent [%llu, %llu) is out of range"
 		       " [0, %llu)\n", blk, blk + cnt, map_max);
 		return;
 	}
@@ -326,7 +326,7 @@ static int convert_map_to_map(struct ploop_pushbackup_desc *pbd)
 	u64 from_blk, to_blk;
 
 	if ((u64)from_max << from_bits != (u64)to_max << to_bits) {
-		printk("mismatch in map convert: %lu %lu ---> %u %d\n",
+		pr_warn("mismatch in map convert: %lu %lu ---> %u %d\n",
 		       from_max, from_bits, to_max, to_bits);
 		return -EINVAL;
 	}
@@ -426,9 +426,9 @@ void ploop_pb_fini(struct ploop_pushbackup_desc *pbd)
 		return;
 
 	if (!RB_EMPTY_ROOT(&pbd->pending_set.tree))
-		printk("ploop_pb_fini: pending_tree is not empty!\n");
+		pr_warn("ploop_pb_fini: pending_tree is not empty!\n");
 	if (!RB_EMPTY_ROOT(&pbd->reported_set.tree))
-		printk("ploop_pb_fini: reported_tree is not empty!\n");
+		pr_warn("ploop_pb_fini: reported_tree is not empty!\n");
 
 	if (pbd->health_monitor_thread) {
 		kthread_stop(pbd->health_monitor_thread);
@@ -491,7 +491,7 @@ static void ploop_pb_add_req_to_tree(struct ploop_request *preq,
 		mod_timer(&pbs->timer, preq->tstamp + timeout + 1);
 
 	if (pbs->list.prev->next != &pbs->list) {
-		printk("list_add corruption. pbs->list.prev->next should be "
+		pr_warn("list_add corruption. pbs->list.prev->next should be "
 		       "&pbs->list (%p), but was %p. (pbs->list.prev=%p)."
 		       " preq=%p\n",
 		       &pbs->list, pbs->list.prev->next, pbs->list.prev, preq);
@@ -1046,7 +1046,7 @@ static bool ploop_pb_set_expired(struct pb_set *pbs)
 	spin_unlock_irqrestore(&pbd->ppb_lock, flags);
 
 	if (ret)
-		printk(KERN_WARNING "Abort push_backup for ploop%d: found "
+		pr_warn("Abort push_backup for ploop%d: found "
 		       "preq (clu=%d) in %s tree delayed for %u msecs\n",
 		       plo->index, clu, pbs->name,
 		       jiffies_to_msecs(jiffies - tstamp));
diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c
index 4cb5d9d99456..0eaabcb72654 100644
--- a/drivers/block/ploop/sysfs.c
+++ b/drivers/block/ploop/sysfs.c
@@ -358,7 +358,7 @@ static u32 show_aborted(struct ploop_device * plo)
 
 static int store_aborted(struct ploop_device * plo, u32 val)
 {
-	printk(KERN_INFO "ploop: Force %s aborted state for ploop%d\n",
+	pr_warn("ploop: Force %s aborted state for ploop%d\n",
 	       val ? "set" : "clear", plo->index);
 
 	if (val)
@@ -799,21 +799,21 @@ void ploop_sysfs_init(struct ploop_device * plo)
 	plo->pstat_dir = kobject_add_attr(plo->disk, "pstat", &pstat_ktype);
 	if (plo->pstat_dir) {
 		if (sysfs_create_group(plo->pstat_dir, &stats_group))
-			printk("ploop: were not able to create pstat dir\n");
+			pr_warn("ploop: were not able to create pstat dir\n");
 	}
 	plo->pstate_dir = kobject_add_attr(plo->disk, "pstate", &pattr_ktype);
 	if (plo->pstate_dir) {
 		if (sysfs_create_group(plo->pstate_dir, &state_group))
-			printk("ploop: were not able to create pstate dir\n");
+			pr_warn("ploop: were not able to create pstate dir\n");
 	}
 	plo->ptune_dir = kobject_add_attr(plo->disk, "ptune", &pattr_ktype);
 	if (plo->ptune_dir) {
 		if (sysfs_create_group(plo->ptune_dir, &tune_group))
-			printk("ploop: were not able to create ptune dir\n");
+			pr_warn("ploop: were not able to create ptune dir\n");
 	}
 
 	if (kobject_add(&plo->kobj, kobject_get(&disk_to_dev(plo->disk)->kobj), "%s", "pdelta"))
-		printk("ploop: were not able to create pdelta dir\n");
+		pr_warn("ploop: were not able to create pdelta dir\n");
 }
 
 void ploop_sysfs_uninit(struct ploop_device * plo)
-- 
2.31.1



More information about the Devel mailing list