Commit 93098bf0 authored by Hongjie Yang's avatar Hongjie Yang Committed by Martin Schwidefsky

[S390] convert dcssblk and extmem printks messages to pr_xxx macros.

Signed-off-by: default avatarHongjie Yang <hongjie@us.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 1519c0c6
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
* (C) IBM Corporation 2002-2004 * (C) IBM Corporation 2002-2004
*/ */
#define KMSG_COMPONENT "extmem"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -24,19 +27,6 @@ ...@@ -24,19 +27,6 @@
#include <asm/cpcmd.h> #include <asm/cpcmd.h>
#include <asm/setup.h> #include <asm/setup.h>
#define DCSS_DEBUG /* Debug messages on/off */
#define DCSS_NAME "extmem"
#ifdef DCSS_DEBUG
#define PRINT_DEBUG(x...) printk(KERN_DEBUG DCSS_NAME " debug:" x)
#else
#define PRINT_DEBUG(x...) do {} while (0)
#endif
#define PRINT_INFO(x...) printk(KERN_INFO DCSS_NAME " info:" x)
#define PRINT_WARN(x...) printk(KERN_WARNING DCSS_NAME " warning:" x)
#define PRINT_ERR(x...) printk(KERN_ERR DCSS_NAME " error:" x)
#define DCSS_LOADSHR 0x00 #define DCSS_LOADSHR 0x00
#define DCSS_LOADNSR 0x04 #define DCSS_LOADNSR 0x04
#define DCSS_PURGESEG 0x08 #define DCSS_PURGESEG 0x08
...@@ -286,7 +276,7 @@ query_segment_type (struct dcss_segment *seg) ...@@ -286,7 +276,7 @@ query_segment_type (struct dcss_segment *seg)
goto out_free; goto out_free;
} }
if (diag_cc > 1) { if (diag_cc > 1) {
PRINT_WARN ("segment_type: diag returned error %ld\n", vmrc); pr_warning("Querying a DCSS type failed with rc=%ld\n", vmrc);
rc = dcss_diag_translate_rc (vmrc); rc = dcss_diag_translate_rc (vmrc);
goto out_free; goto out_free;
} }
...@@ -368,7 +358,6 @@ query_segment_type (struct dcss_segment *seg) ...@@ -368,7 +358,6 @@ query_segment_type (struct dcss_segment *seg)
* -EIO : could not perform query diagnose * -EIO : could not perform query diagnose
* -ENOENT : no such segment * -ENOENT : no such segment
* -ENOTSUPP: multi-part segment cannot be used with linux * -ENOTSUPP: multi-part segment cannot be used with linux
* -ENOSPC : segment cannot be used (overlaps with storage)
* -ENOMEM : out of memory * -ENOMEM : out of memory
* 0 .. 6 : type of segment as defined in include/asm-s390/extmem.h * 0 .. 6 : type of segment as defined in include/asm-s390/extmem.h
*/ */
...@@ -480,9 +469,8 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long ...@@ -480,9 +469,8 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
goto out_resource; goto out_resource;
} }
if (diag_cc > 1) { if (diag_cc > 1) {
PRINT_WARN ("segment_load: could not load segment %s - " pr_warning("Loading DCSS %s failed with rc=%ld\n", name,
"diag returned error (%ld)\n", end_addr);
name, end_addr);
rc = dcss_diag_translate_rc(end_addr); rc = dcss_diag_translate_rc(end_addr);
dcss_diag(&purgeseg_scode, seg->dcss_name, dcss_diag(&purgeseg_scode, seg->dcss_name,
&dummy, &dummy); &dummy, &dummy);
...@@ -496,15 +484,13 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long ...@@ -496,15 +484,13 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
*addr = seg->start_addr; *addr = seg->start_addr;
*end = seg->end; *end = seg->end;
if (do_nonshared) if (do_nonshared)
PRINT_INFO ("segment_load: loaded segment %s range %p .. %p " pr_info("DCSS %s of range %p to %p and type %s loaded as "
"type %s in non-shared mode\n", name, "exclusive-writable\n", name, (void*) seg->start_addr,
(void*)seg->start_addr, (void*)seg->end, (void*) seg->end, segtype_string[seg->vm_segtype]);
segtype_string[seg->vm_segtype]);
else { else {
PRINT_INFO ("segment_load: loaded segment %s range %p .. %p " pr_info("DCSS %s of range %p to %p and type %s loaded in "
"type %s in shared mode\n", name, "shared access mode\n", name, (void*) seg->start_addr,
(void*)seg->start_addr, (void*)seg->end, (void*) seg->end, segtype_string[seg->vm_segtype]);
segtype_string[seg->vm_segtype]);
} }
goto out; goto out;
out_resource: out_resource:
...@@ -593,14 +579,14 @@ segment_modify_shared (char *name, int do_nonshared) ...@@ -593,14 +579,14 @@ segment_modify_shared (char *name, int do_nonshared)
goto out_unlock; goto out_unlock;
} }
if (do_nonshared == seg->do_nonshared) { if (do_nonshared == seg->do_nonshared) {
PRINT_INFO ("segment_modify_shared: not reloading segment %s" pr_info("DCSS %s is already in the requested access "
" - already in requested mode\n",name); "mode\n", name);
rc = 0; rc = 0;
goto out_unlock; goto out_unlock;
} }
if (atomic_read (&seg->ref_count) != 1) { if (atomic_read (&seg->ref_count) != 1) {
PRINT_WARN ("segment_modify_shared: not reloading segment %s - " pr_warning("DCSS %s is in use and cannot be reloaded\n",
"segment is in use by other driver(s)\n",name); name);
rc = -EAGAIN; rc = -EAGAIN;
goto out_unlock; goto out_unlock;
} }
...@@ -613,8 +599,8 @@ segment_modify_shared (char *name, int do_nonshared) ...@@ -613,8 +599,8 @@ segment_modify_shared (char *name, int do_nonshared)
seg->res->flags |= IORESOURCE_READONLY; seg->res->flags |= IORESOURCE_READONLY;
if (request_resource(&iomem_resource, seg->res)) { if (request_resource(&iomem_resource, seg->res)) {
PRINT_WARN("segment_modify_shared: could not reload segment %s" pr_warning("DCSS %s overlaps with used memory resources "
" - overlapping resources\n", name); "and cannot be reloaded\n", name);
rc = -EBUSY; rc = -EBUSY;
kfree(seg->res); kfree(seg->res);
goto out_del_mem; goto out_del_mem;
...@@ -632,9 +618,8 @@ segment_modify_shared (char *name, int do_nonshared) ...@@ -632,9 +618,8 @@ segment_modify_shared (char *name, int do_nonshared)
goto out_del_res; goto out_del_res;
} }
if (diag_cc > 1) { if (diag_cc > 1) {
PRINT_WARN ("segment_modify_shared: could not reload segment %s" pr_warning("Reloading DCSS %s failed with rc=%ld\n", name,
" - diag returned error (%ld)\n", end_addr);
name, end_addr);
rc = dcss_diag_translate_rc(end_addr); rc = dcss_diag_translate_rc(end_addr);
goto out_del_res; goto out_del_res;
} }
...@@ -673,8 +658,7 @@ segment_unload(char *name) ...@@ -673,8 +658,7 @@ segment_unload(char *name)
mutex_lock(&dcss_lock); mutex_lock(&dcss_lock);
seg = segment_by_name (name); seg = segment_by_name (name);
if (seg == NULL) { if (seg == NULL) {
PRINT_ERR ("could not find segment %s in segment_unload, " pr_err("Unloading unknown DCSS %s failed\n", name);
"please report to linux390@de.ibm.com\n",name);
goto out_unlock; goto out_unlock;
} }
if (atomic_dec_return(&seg->ref_count) != 0) if (atomic_dec_return(&seg->ref_count) != 0)
...@@ -709,8 +693,7 @@ segment_save(char *name) ...@@ -709,8 +693,7 @@ segment_save(char *name)
seg = segment_by_name (name); seg = segment_by_name (name);
if (seg == NULL) { if (seg == NULL) {
PRINT_ERR("could not find segment %s in segment_save, please " pr_err("Saving unknown DCSS %s failed\n", name);
"report to linux390@de.ibm.com\n", name);
goto out; goto out;
} }
...@@ -727,14 +710,14 @@ segment_save(char *name) ...@@ -727,14 +710,14 @@ segment_save(char *name)
response = 0; response = 0;
cpcmd(cmd1, NULL, 0, &response); cpcmd(cmd1, NULL, 0, &response);
if (response) { if (response) {
PRINT_ERR("segment_save: DEFSEG failed with response code %i\n", pr_err("Saving a DCSS failed with DEFSEG response code "
response); "%i\n", response);
goto out; goto out;
} }
cpcmd(cmd2, NULL, 0, &response); cpcmd(cmd2, NULL, 0, &response);
if (response) { if (response) {
PRINT_ERR("segment_save: SAVESEG failed with response code %i\n", pr_err("Saving a DCSS failed with SAVESEG response code "
response); "%i\n", response);
goto out; goto out;
} }
out: out:
...@@ -749,44 +732,41 @@ void segment_warning(int rc, char *seg_name) ...@@ -749,44 +732,41 @@ void segment_warning(int rc, char *seg_name)
{ {
switch (rc) { switch (rc) {
case -ENOENT: case -ENOENT:
PRINT_WARN("cannot load/query segment %s, " pr_err("DCSS %s cannot be loaded or queried\n", seg_name);
"does not exist\n", seg_name);
break; break;
case -ENOSYS: case -ENOSYS:
PRINT_WARN("cannot load/query segment %s, " pr_err("DCSS %s cannot be loaded or queried without "
"not running on VM\n", seg_name); "z/VM\n", seg_name);
break; break;
case -EIO: case -EIO:
PRINT_WARN("cannot load/query segment %s, " pr_err("Loading or querying DCSS %s resulted in a "
"hardware error\n", seg_name); "hardware error\n", seg_name);
break; break;
case -ENOTSUPP: case -ENOTSUPP:
PRINT_WARN("cannot load/query segment %s, " pr_err("DCSS %s has multiple page ranges and cannot be "
"is a multi-part segment\n", seg_name); "loaded or queried\n", seg_name);
break; break;
case -ENOSPC: case -ENOSPC:
PRINT_WARN("cannot load/query segment %s, " pr_err("DCSS %s overlaps with used storage and cannot "
"overlaps with storage\n", seg_name); "be loaded\n", seg_name);
break; break;
case -EBUSY: case -EBUSY:
PRINT_WARN("cannot load/query segment %s, " pr_err("%s needs used memory resources and cannot be "
"overlaps with already loaded dcss\n", seg_name); "loaded or queried\n", seg_name);
break; break;
case -EPERM: case -EPERM:
PRINT_WARN("cannot load/query segment %s, " pr_err("DCSS %s is already loaded in a different access "
"already loaded in incompatible mode\n", seg_name); "mode\n", seg_name);
break; break;
case -ENOMEM: case -ENOMEM:
PRINT_WARN("cannot load/query segment %s, " pr_err("There is not enough memory to load or query "
"out of memory\n", seg_name); "DCSS %s\n", seg_name);
break; break;
case -ERANGE: case -ERANGE:
PRINT_WARN("cannot load/query segment %s, " pr_err("DCSS %s exceeds the kernel mapping range (%lu) "
"exceeds kernel mapping range\n", seg_name); "and cannot be loaded\n", seg_name, VMEM_MAX_PHYS);
break; break;
default: default:
PRINT_WARN("cannot load/query segment %s, "
"return value %i\n", seg_name, rc);
break; break;
} }
} }
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
* Authors: Carsten Otte, Stefan Weinhuber, Gerald Schaefer * Authors: Carsten Otte, Stefan Weinhuber, Gerald Schaefer
*/ */
#define KMSG_COMPONENT "dcssblk"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/ctype.h> #include <linux/ctype.h>
...@@ -17,21 +20,11 @@ ...@@ -17,21 +20,11 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/s390_rdev.h> #include <asm/s390_rdev.h>
//#define DCSSBLK_DEBUG /* Debug messages on/off */
#define DCSSBLK_NAME "dcssblk" #define DCSSBLK_NAME "dcssblk"
#define DCSSBLK_MINORS_PER_DISK 1 #define DCSSBLK_MINORS_PER_DISK 1
#define DCSSBLK_PARM_LEN 400 #define DCSSBLK_PARM_LEN 400
#define DCSS_BUS_ID_SIZE 20 #define DCSS_BUS_ID_SIZE 20
#ifdef DCSSBLK_DEBUG
#define PRINT_DEBUG(x...) printk(KERN_DEBUG DCSSBLK_NAME " debug: " x)
#else
#define PRINT_DEBUG(x...) do {} while (0)
#endif
#define PRINT_INFO(x...) printk(KERN_INFO DCSSBLK_NAME " info: " x)
#define PRINT_WARN(x...) printk(KERN_WARNING DCSSBLK_NAME " warning: " x)
#define PRINT_ERR(x...) printk(KERN_ERR DCSSBLK_NAME " error: " x)
static int dcssblk_open(struct block_device *bdev, fmode_t mode); static int dcssblk_open(struct block_device *bdev, fmode_t mode);
static int dcssblk_release(struct gendisk *disk, fmode_t mode); static int dcssblk_release(struct gendisk *disk, fmode_t mode);
static int dcssblk_make_request(struct request_queue *q, struct bio *bio); static int dcssblk_make_request(struct request_queue *q, struct bio *bio);
...@@ -262,9 +255,8 @@ dcssblk_is_continuous(struct dcssblk_dev_info *dev_info) ...@@ -262,9 +255,8 @@ dcssblk_is_continuous(struct dcssblk_dev_info *dev_info)
/* check continuity */ /* check continuity */
for (i = 0; i < dev_info->num_of_segments - 1; i++) { for (i = 0; i < dev_info->num_of_segments - 1; i++) {
if ((sort_list[i].end + 1) != sort_list[i+1].start) { if ((sort_list[i].end + 1) != sort_list[i+1].start) {
PRINT_ERR("Segment %s is not contiguous with " pr_err("Adjacent DCSSs %s and %s are not "
"segment %s\n", "contiguous\n", sort_list[i].segment_name,
sort_list[i].segment_name,
sort_list[i+1].segment_name); sort_list[i+1].segment_name);
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
...@@ -276,8 +268,8 @@ dcssblk_is_continuous(struct dcssblk_dev_info *dev_info) ...@@ -276,8 +268,8 @@ dcssblk_is_continuous(struct dcssblk_dev_info *dev_info)
!(sort_list[i+1].segment_type & !(sort_list[i+1].segment_type &
SEGMENT_EXCLUSIVE) || SEGMENT_EXCLUSIVE) ||
(sort_list[i+1].segment_type == SEG_TYPE_ER)) { (sort_list[i+1].segment_type == SEG_TYPE_ER)) {
PRINT_ERR("Segment %s has different type from " pr_err("DCSS %s and DCSS %s have "
"segment %s\n", "incompatible types\n",
sort_list[i].segment_name, sort_list[i].segment_name,
sort_list[i+1].segment_name); sort_list[i+1].segment_name);
rc = -EINVAL; rc = -EINVAL;
...@@ -381,8 +373,9 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch ...@@ -381,8 +373,9 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch
} else if (inbuf[0] == '0') { } else if (inbuf[0] == '0') {
/* reload segments in exclusive mode */ /* reload segments in exclusive mode */
if (dev_info->segment_type == SEG_TYPE_SC) { if (dev_info->segment_type == SEG_TYPE_SC) {
PRINT_ERR("Segment type SC (%s) cannot be loaded in " pr_err("DCSS %s is of type SC and cannot be "
"non-shared mode\n", dev_info->segment_name); "loaded as exclusive-writable\n",
dev_info->segment_name);
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
...@@ -405,9 +398,8 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch ...@@ -405,9 +398,8 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch
goto out; goto out;
removeseg: removeseg:
PRINT_ERR("Could not reload segment(s) of the device %s, removing " pr_err("DCSS device %s is removed after a failed access mode "
"segment(s) now!\n", "change\n", dev_info->segment_name);
dev_info->segment_name);
temp = entry; temp = entry;
list_for_each_entry(entry, &dev_info->seg_list, lh) { list_for_each_entry(entry, &dev_info->seg_list, lh) {
if (entry != temp) if (entry != temp)
...@@ -455,16 +447,16 @@ dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char ...@@ -455,16 +447,16 @@ dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char
if (inbuf[0] == '1') { if (inbuf[0] == '1') {
if (atomic_read(&dev_info->use_count) == 0) { if (atomic_read(&dev_info->use_count) == 0) {
// device is idle => we save immediately // device is idle => we save immediately
PRINT_INFO("Saving segment(s) of the device %s\n", pr_info("All DCSSs that map to device %s are "
dev_info->segment_name); "saved\n", dev_info->segment_name);
list_for_each_entry(entry, &dev_info->seg_list, lh) { list_for_each_entry(entry, &dev_info->seg_list, lh) {
segment_save(entry->segment_name); segment_save(entry->segment_name);
} }
} else { } else {
// device is busy => we save it when it becomes // device is busy => we save it when it becomes
// idle in dcssblk_release // idle in dcssblk_release
PRINT_INFO("Device %s is currently busy, segment(s) " pr_info("Device %s is in use, its DCSSs will be "
"will be saved when it becomes idle...\n", "saved when it becomes idle\n",
dev_info->segment_name); dev_info->segment_name);
dev_info->save_pending = 1; dev_info->save_pending = 1;
} }
...@@ -473,8 +465,8 @@ dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char ...@@ -473,8 +465,8 @@ dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char
// device is busy & the user wants to undo his save // device is busy & the user wants to undo his save
// request // request
dev_info->save_pending = 0; dev_info->save_pending = 0;
PRINT_INFO("Pending save for segment(s) of the device " pr_info("A pending save request for device %s "
"%s deactivated\n", "has been canceled\n",
dev_info->segment_name); dev_info->segment_name);
} }
} else { } else {
...@@ -615,9 +607,8 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char ...@@ -615,9 +607,8 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
seg_byte_size = (dev_info->end - dev_info->start + 1); seg_byte_size = (dev_info->end - dev_info->start + 1);
set_capacity(dev_info->gd, seg_byte_size >> 9); // size in sectors set_capacity(dev_info->gd, seg_byte_size >> 9); // size in sectors
PRINT_INFO("Loaded segment(s) %s, size = %lu Byte, " pr_info("Loaded %s with total size %lu bytes and capacity %lu "
"capacity = %lu (512 Byte) sectors\n", local_buf, "sectors\n", local_buf, seg_byte_size, seg_byte_size >> 9);
seg_byte_size, seg_byte_size >> 9);
dev_info->save_pending = 0; dev_info->save_pending = 0;
dev_info->is_shared = 1; dev_info->is_shared = 1;
...@@ -745,13 +736,15 @@ dcssblk_remove_store(struct device *dev, struct device_attribute *attr, const ch ...@@ -745,13 +736,15 @@ dcssblk_remove_store(struct device *dev, struct device_attribute *attr, const ch
dev_info = dcssblk_get_device_by_name(local_buf); dev_info = dcssblk_get_device_by_name(local_buf);
if (dev_info == NULL) { if (dev_info == NULL) {
up_write(&dcssblk_devices_sem); up_write(&dcssblk_devices_sem);
PRINT_WARN("Device %s is not loaded!\n", local_buf); pr_warning("Device %s cannot be removed because it is not a "
"known device\n", local_buf);
rc = -ENODEV; rc = -ENODEV;
goto out_buf; goto out_buf;
} }
if (atomic_read(&dev_info->use_count) != 0) { if (atomic_read(&dev_info->use_count) != 0) {
up_write(&dcssblk_devices_sem); up_write(&dcssblk_devices_sem);
PRINT_WARN("Device %s is in use!\n", local_buf); pr_warning("Device %s cannot be removed while it is in "
"use\n", local_buf);
rc = -EBUSY; rc = -EBUSY;
goto out_buf; goto out_buf;
} }
...@@ -808,8 +801,8 @@ dcssblk_release(struct gendisk *disk, fmode_t mode) ...@@ -808,8 +801,8 @@ dcssblk_release(struct gendisk *disk, fmode_t mode)
down_write(&dcssblk_devices_sem); down_write(&dcssblk_devices_sem);
if (atomic_dec_and_test(&dev_info->use_count) if (atomic_dec_and_test(&dev_info->use_count)
&& (dev_info->save_pending)) { && (dev_info->save_pending)) {
PRINT_INFO("Device %s became idle and is being saved now\n", pr_info("Device %s has become idle and is being saved "
dev_info->segment_name); "now\n", dev_info->segment_name);
list_for_each_entry(entry, &dev_info->seg_list, lh) { list_for_each_entry(entry, &dev_info->seg_list, lh) {
segment_save(entry->segment_name); segment_save(entry->segment_name);
} }
...@@ -852,7 +845,8 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio) ...@@ -852,7 +845,8 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio)
case SEG_TYPE_SC: case SEG_TYPE_SC:
/* cannot write to these segments */ /* cannot write to these segments */
if (bio_data_dir(bio) == WRITE) { if (bio_data_dir(bio) == WRITE) {
PRINT_WARN("rejecting write to ro device %s\n", pr_warning("Writing to %s failed because it "
"is a read-only device\n",
dev_name(&dev_info->dev)); dev_name(&dev_info->dev));
goto fail; goto fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment