3434 * IN THE SOFTWARE.
3535 */
3636
37+ #define pr_fmt (fmt ) "xen-blkback: " fmt
38+
3739#include <linux/spinlock.h>
3840#include <linux/kthread.h>
3941#include <linux/list.h>
@@ -211,7 +213,7 @@ static int add_persistent_gnt(struct xen_blkif *blkif,
211213 else if (persistent_gnt -> gnt > this -> gnt )
212214 new = & ((* new )-> rb_right );
213215 else {
214- pr_alert_ratelimited (DRV_PFX " trying to add a gref that's already in the tree\n" );
216+ pr_alert_ratelimited (" trying to add a gref that's already in the tree\n" );
215217 return - EINVAL ;
216218 }
217219 }
@@ -242,7 +244,7 @@ static struct persistent_gnt *get_persistent_gnt(struct xen_blkif *blkif,
242244 node = node -> rb_right ;
243245 else {
244246 if (test_bit (PERSISTENT_GNT_ACTIVE , data -> flags )) {
245- pr_alert_ratelimited (DRV_PFX " requesting a grant already in use\n" );
247+ pr_alert_ratelimited (" requesting a grant already in use\n" );
246248 return NULL ;
247249 }
248250 set_bit (PERSISTENT_GNT_ACTIVE , data -> flags );
@@ -257,7 +259,7 @@ static void put_persistent_gnt(struct xen_blkif *blkif,
257259 struct persistent_gnt * persistent_gnt )
258260{
259261 if (!test_bit (PERSISTENT_GNT_ACTIVE , persistent_gnt -> flags ))
260- pr_alert_ratelimited (DRV_PFX " freeing a grant already unused" );
262+ pr_alert_ratelimited (" freeing a grant already unused\n " );
261263 set_bit (PERSISTENT_GNT_WAS_ACTIVE , persistent_gnt -> flags );
262264 clear_bit (PERSISTENT_GNT_ACTIVE , persistent_gnt -> flags );
263265 atomic_dec (& blkif -> persistent_gnt_in_use );
@@ -374,7 +376,7 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)
374376 }
375377
376378 if (work_pending (& blkif -> persistent_purge_work )) {
377- pr_alert_ratelimited (DRV_PFX "Scheduled work from previous purge is still pending, cannot purge list\n" );
379+ pr_alert_ratelimited ("Scheduled work from previous purge is still pending, cannot purge list\n" );
378380 return ;
379381 }
380382
@@ -396,7 +398,7 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)
396398
397399 total = num_clean ;
398400
399- pr_debug (DRV_PFX "Going to purge %u persistent grants\n" , num_clean );
401+ pr_debug ("Going to purge %u persistent grants\n" , num_clean );
400402
401403 BUG_ON (!list_empty (& blkif -> persistent_purge_list ));
402404 root = & blkif -> persistent_gnts ;
@@ -428,13 +430,13 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)
428430 * with the requested num
429431 */
430432 if (!scan_used && !clean_used ) {
431- pr_debug (DRV_PFX "Still missing %u purged frames\n" , num_clean );
433+ pr_debug ("Still missing %u purged frames\n" , num_clean );
432434 scan_used = true;
433435 goto purge_list ;
434436 }
435437finished :
436438 if (!clean_used ) {
437- pr_debug (DRV_PFX "Finished scanning for grants to clean, removing used flag\n" );
439+ pr_debug ("Finished scanning for grants to clean, removing used flag\n" );
438440 clean_used = true;
439441 goto purge_list ;
440442 }
@@ -444,7 +446,7 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)
444446
445447 /* We can defer this work */
446448 schedule_work (& blkif -> persistent_purge_work );
447- pr_debug (DRV_PFX "Purged %u/%u\n" , (total - num_clean ), total );
449+ pr_debug ("Purged %u/%u\n" , (total - num_clean ), total );
448450 return ;
449451}
450452
@@ -520,20 +522,20 @@ static void xen_vbd_resize(struct xen_blkif *blkif)
520522 struct xenbus_device * dev = xen_blkbk_xenbus (blkif -> be );
521523 unsigned long long new_size = vbd_sz (vbd );
522524
523- pr_info (DRV_PFX "VBD Resize: Domid: %d, Device: (%d, %d)\n" ,
525+ pr_info ("VBD Resize: Domid: %d, Device: (%d, %d)\n" ,
524526 blkif -> domid , MAJOR (vbd -> pdevice ), MINOR (vbd -> pdevice ));
525- pr_info (DRV_PFX "VBD Resize: new size %llu\n" , new_size );
527+ pr_info ("VBD Resize: new size %llu\n" , new_size );
526528 vbd -> size = new_size ;
527529again :
528530 err = xenbus_transaction_start (& xbt );
529531 if (err ) {
530- pr_warn (DRV_PFX "Error starting transaction" );
532+ pr_warn ("Error starting transaction\n " );
531533 return ;
532534 }
533535 err = xenbus_printf (xbt , dev -> nodename , "sectors" , "%llu" ,
534536 (unsigned long long )vbd_sz (vbd ));
535537 if (err ) {
536- pr_warn (DRV_PFX "Error writing new size" );
538+ pr_warn ("Error writing new size\n " );
537539 goto abort ;
538540 }
539541 /*
@@ -543,15 +545,15 @@ static void xen_vbd_resize(struct xen_blkif *blkif)
543545 */
544546 err = xenbus_printf (xbt , dev -> nodename , "state" , "%d" , dev -> state );
545547 if (err ) {
546- pr_warn (DRV_PFX "Error writing the state" );
548+ pr_warn ("Error writing the state\n " );
547549 goto abort ;
548550 }
549551
550552 err = xenbus_transaction_end (xbt , 0 );
551553 if (err == - EAGAIN )
552554 goto again ;
553555 if (err )
554- pr_warn (DRV_PFX "Error ending transaction" );
556+ pr_warn ("Error ending transaction\n " );
555557 return ;
556558abort :
557559 xenbus_transaction_end (xbt , 1 );
@@ -578,7 +580,7 @@ irqreturn_t xen_blkif_be_int(int irq, void *dev_id)
578580
579581static void print_stats (struct xen_blkif * blkif )
580582{
581- pr_info ("xen-blkback (%s): oo %3llu | rd %4llu | wr %4llu | f %4llu"
583+ pr_info ("(%s): oo %3llu | rd %4llu | wr %4llu | f %4llu"
582584 " | ds %4llu | pg: %4u/%4d\n" ,
583585 current -> comm , blkif -> st_oo_req ,
584586 blkif -> st_rd_req , blkif -> st_wr_req ,
@@ -855,7 +857,7 @@ static int xen_blkbk_map(struct xen_blkif *blkif,
855857 /* This is a newly mapped grant */
856858 BUG_ON (new_map_idx >= segs_to_map );
857859 if (unlikely (map [new_map_idx ].status != 0 )) {
858- pr_debug (DRV_PFX "invalid buffer -- could not remap it\n" );
860+ pr_debug ("invalid buffer -- could not remap it\n" );
859861 put_free_pages (blkif , & pages [seg_idx ]-> page , 1 );
860862 pages [seg_idx ]-> handle = BLKBACK_INVALID_HANDLE ;
861863 ret |= 1 ;
@@ -891,14 +893,14 @@ static int xen_blkbk_map(struct xen_blkif *blkif,
891893 goto next ;
892894 }
893895 pages [seg_idx ]-> persistent_gnt = persistent_gnt ;
894- pr_debug (DRV_PFX " grant %u added to the tree of persistent grants, using %u/%u\n" ,
896+ pr_debug (" grant %u added to the tree of persistent grants, using %u/%u\n" ,
895897 persistent_gnt -> gnt , blkif -> persistent_gnt_c ,
896898 xen_blkif_max_pgrants );
897899 goto next ;
898900 }
899901 if (use_persistent_gnts && !blkif -> vbd .overflow_max_grants ) {
900902 blkif -> vbd .overflow_max_grants = 1 ;
901- pr_debug (DRV_PFX " domain %u, device %#x is using maximum number of persistent grants\n" ,
903+ pr_debug (" domain %u, device %#x is using maximum number of persistent grants\n" ,
902904 blkif -> domid , blkif -> vbd .handle );
903905 }
904906 /*
@@ -916,7 +918,7 @@ static int xen_blkbk_map(struct xen_blkif *blkif,
916918 return ret ;
917919
918920out_of_memory :
919- pr_alert (DRV_PFX "%s: out of memory\n" , __func__ );
921+ pr_alert ("%s: out of memory\n" , __func__ );
920922 put_free_pages (blkif , pages_to_gnt , segs_to_map );
921923 return - ENOMEM ;
922924}
@@ -996,7 +998,7 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
996998
997999 err = xen_vbd_translate (& preq , blkif , WRITE );
9981000 if (err ) {
999- pr_warn (DRV_PFX "access denied: DISCARD [%llu->%llu] on dev=%04x\n" ,
1001+ pr_warn ("access denied: DISCARD [%llu->%llu] on dev=%04x\n" ,
10001002 preq .sector_number ,
10011003 preq .sector_number + preq .nr_sects , blkif -> vbd .pdevice );
10021004 goto fail_response ;
@@ -1012,7 +1014,7 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
10121014 GFP_KERNEL , secure );
10131015fail_response :
10141016 if (err == - EOPNOTSUPP ) {
1015- pr_debug (DRV_PFX "discard op failed, not supported\n" );
1017+ pr_debug ("discard op failed, not supported\n" );
10161018 status = BLKIF_RSP_EOPNOTSUPP ;
10171019 } else if (err )
10181020 status = BLKIF_RSP_ERROR ;
@@ -1056,16 +1058,16 @@ static void __end_block_io_op(struct pending_req *pending_req, int error)
10561058 /* An error fails the entire request. */
10571059 if ((pending_req -> operation == BLKIF_OP_FLUSH_DISKCACHE ) &&
10581060 (error == - EOPNOTSUPP )) {
1059- pr_debug (DRV_PFX "flush diskcache op failed, not supported\n" );
1061+ pr_debug ("flush diskcache op failed, not supported\n" );
10601062 xen_blkbk_flush_diskcache (XBT_NIL , pending_req -> blkif -> be , 0 );
10611063 pending_req -> status = BLKIF_RSP_EOPNOTSUPP ;
10621064 } else if ((pending_req -> operation == BLKIF_OP_WRITE_BARRIER ) &&
10631065 (error == - EOPNOTSUPP )) {
1064- pr_debug (DRV_PFX "write barrier op failed, not supported\n" );
1066+ pr_debug ("write barrier op failed, not supported\n" );
10651067 xen_blkbk_barrier (XBT_NIL , pending_req -> blkif -> be , 0 );
10661068 pending_req -> status = BLKIF_RSP_EOPNOTSUPP ;
10671069 } else if (error ) {
1068- pr_debug (DRV_PFX "Buffer not up-to-date at end of operation,"
1070+ pr_debug ("Buffer not up-to-date at end of operation,"
10691071 " error=%d\n" , error );
10701072 pending_req -> status = BLKIF_RSP_ERROR ;
10711073 }
@@ -1110,7 +1112,7 @@ __do_block_io_op(struct xen_blkif *blkif)
11101112
11111113 if (RING_REQUEST_PROD_OVERFLOW (& blk_rings -> common , rp )) {
11121114 rc = blk_rings -> common .rsp_prod_pvt ;
1113- pr_warn (DRV_PFX "Frontend provided bogus ring requests (%d - %d = %d). Halting ring processing on dev=%04x\n" ,
1115+ pr_warn ("Frontend provided bogus ring requests (%d - %d = %d). Halting ring processing on dev=%04x\n" ,
11141116 rp , rc , rp - rc , blkif -> vbd .pdevice );
11151117 return - EACCES ;
11161118 }
@@ -1217,8 +1219,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
12171219 if ((req -> operation == BLKIF_OP_INDIRECT ) &&
12181220 (req_operation != BLKIF_OP_READ ) &&
12191221 (req_operation != BLKIF_OP_WRITE )) {
1220- pr_debug (DRV_PFX "Invalid indirect operation (%u)\n" ,
1221- req_operation );
1222+ pr_debug ("Invalid indirect operation (%u)\n" , req_operation );
12221223 goto fail_response ;
12231224 }
12241225
@@ -1252,8 +1253,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
12521253 (nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST )) ||
12531254 unlikely ((req -> operation == BLKIF_OP_INDIRECT ) &&
12541255 (nseg > MAX_INDIRECT_SEGMENTS ))) {
1255- pr_debug (DRV_PFX "Bad number of segments in request (%d)\n" ,
1256- nseg );
1256+ pr_debug ("Bad number of segments in request (%d)\n" , nseg );
12571257 /* Haven't submitted any bio's yet. */
12581258 goto fail_response ;
12591259 }
@@ -1288,7 +1288,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
12881288 }
12891289
12901290 if (xen_vbd_translate (& preq , blkif , operation ) != 0 ) {
1291- pr_debug (DRV_PFX "access denied: %s of [%llu,%llu] on dev=%04x\n" ,
1291+ pr_debug ("access denied: %s of [%llu,%llu] on dev=%04x\n" ,
12921292 operation == READ ? "read" : "write" ,
12931293 preq .sector_number ,
12941294 preq .sector_number + preq .nr_sects ,
@@ -1303,7 +1303,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
13031303 for (i = 0 ; i < nseg ; i ++ ) {
13041304 if (((int )preq .sector_number |(int )seg [i ].nsec ) &
13051305 ((bdev_logical_block_size (preq .bdev ) >> 9 ) - 1 )) {
1306- pr_debug (DRV_PFX "Misaligned I/O request from domain %d" ,
1306+ pr_debug ("Misaligned I/O request from domain %d\n " ,
13071307 blkif -> domid );
13081308 goto fail_response ;
13091309 }
0 commit comments