Răsfoiți Sursa

[S390] tape: Fix device online messages

Currently, when a tape device is set online and no cartridge is loaded, we
get the messages "The tape cartridge has been successfully unloaded" and
"Determining the size of the recorded area". These messages are not correct.
To fix this, we now print the "cartridge loaded/unloaded" messages only,
when the load/unload event really occurs. In addition to that, the message
"Determining the size of the recorded area" is only printed, if a cartridge
is loaded.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Michael Holzheu 16 ani în urmă
părinte
comite
53f8c573ea
2 a modificat fișierele cu 8 adăugiri și 6 ștergeri
  1. 2 2
      drivers/s390/char/tape_block.c
  2. 6 4
      drivers/s390/char/tape_core.c

+ 2 - 2
drivers/s390/char/tape_block.c

@@ -302,8 +302,6 @@ tapeblock_revalidate_disk(struct gendisk *disk)
 	if (!device->blk_data.medium_changed)
 	if (!device->blk_data.medium_changed)
 		return 0;
 		return 0;
 
 
-	dev_info(&device->cdev->dev, "Determining the size of the recorded "
-		"area...\n");
 	rc = tape_mtop(device, MTFSFM, 1);
 	rc = tape_mtop(device, MTFSFM, 1);
 	if (rc)
 	if (rc)
 		return rc;
 		return rc;
@@ -312,6 +310,8 @@ tapeblock_revalidate_disk(struct gendisk *disk)
 	if (rc < 0)
 	if (rc < 0)
 		return rc;
 		return rc;
 
 
+	dev_info(&device->cdev->dev, "Determining the size of the recorded "
+		"area...\n");
 	DBF_LH(3, "Image file ends at %d\n", rc);
 	DBF_LH(3, "Image file ends at %d\n", rc);
 	nr_of_blks = rc;
 	nr_of_blks = rc;
 
 

+ 6 - 4
drivers/s390/char/tape_core.c

@@ -214,13 +214,15 @@ tape_med_state_set(struct tape_device *device, enum tape_medium_state newstate)
 	switch(newstate){
 	switch(newstate){
 	case MS_UNLOADED:
 	case MS_UNLOADED:
 		device->tape_generic_status |= GMT_DR_OPEN(~0);
 		device->tape_generic_status |= GMT_DR_OPEN(~0);
-		dev_info(&device->cdev->dev, "The tape cartridge has been "
-			"successfully unloaded\n");
+		if (device->medium_state == MS_LOADED)
+			dev_info(&device->cdev->dev, "The tape cartridge has "
+				 "been successfully unloaded\n");
 		break;
 		break;
 	case MS_LOADED:
 	case MS_LOADED:
 		device->tape_generic_status &= ~GMT_DR_OPEN(~0);
 		device->tape_generic_status &= ~GMT_DR_OPEN(~0);
-		dev_info(&device->cdev->dev, "A tape cartridge has been "
-			"mounted\n");
+		if (device->medium_state == MS_UNLOADED)
+			dev_info(&device->cdev->dev, "A tape cartridge has "
+				 "been mounted\n");
 		break;
 		break;
 	default:
 	default:
 		// print nothing
 		// print nothing