Skip to contentSkip to conversation

block/blk-core.c: print readable string instead of values.

PATCH In review Jianyu Zhan 3 participants 3 messages Apr 12, 2014 – Apr 14, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/blk-core.c: print readable string instead of values.

Print the r/w direction string instead of internal values.

---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-core.c +2 -2
index a0e3096..0a3bde3 100644
@@ -1625,9 +1625,9 @@ static void handle_bad_sector(struct bio *bio)
 	char b[BDEVNAME_SIZE];
 
 	printk(KERN_INFO "attempt to access beyond end of device\n");
-	printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
+	printk(KERN_INFO "%s: rw=%s, want=%Lu, limit=%Lu\n",
 			bdevname(bio->bi_bdev, b),
-			bio->bi_rw,
+			(bio->bi_rw & WRITE) ? "WRITE" : "READ",
 			(unsigned long long)bio_end_sector(bio),
 			(long long)(i_size_read(bio->bi_bdev->bd_inode) >> 9));
 
Signature · 1 line
1.9.0.GIT
#1 lore raw

FYI, bi_rw tracks more than WRITE or READ...

Quoted 31 lines · Jianyu Zhan

Print the r/w direction string instead of internal values.

---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-core.c +2 -3
index a0e3096..0a3bde3 100644
@@ -1625,9 +1625,9 @@ static void handle_bad_sector(struct bio *bio)
        char b[BDEVNAME_SIZE];
 
        printk(KERN_INFO "attempt to access beyond end of device\n");
-       printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
+       printk(KERN_INFO "%s: rw=%s, want=%Lu, limit=%Lu\n",
                        bdevname(bio->bi_bdev, b),
-                       bio->bi_rw,
+                       (bio->bi_rw & WRITE) ? "WRITE" : "READ",
                        (unsigned long long)bio_end_sector(bio),
                        (long long)(i_size_read(bio->bi_bdev->bd_inode) >> 9));
 
--

1.9.0.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 4 lines · Muthukumar R

FYI, bi_rw tracks more than WRITE or READ...

Quoted 1 line · Jianyu Zhan

Print the r/w direction string instead of internal values.

[]

Quoted 1 line

block/blk-core.c

Quoted 1 line
block/blk-core.c +0 -0

[]

Quoted 9 lines

block/blk-core.c static void handle_bad_sector(struct bio *bio) · line 1630

Quoted 9 lines
block/blk-core.c +2 -2
@@ -1625,9 +1625,9 @@ static void handle_bad_sector(struct bio *bio)
        char b[BDEVNAME_SIZE];
 
        printk(KERN_INFO "attempt to access beyond end of device\n");
-       printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
+       printk(KERN_INFO "%s: rw=%s, want=%Lu, limit=%Lu\n",
                        bdevname(bio->bi_bdev, b),
-                       bio->bi_rw,
+                       (bio->bi_rw & WRITE) ? "WRITE" : "READ",

Perhaps print the hex value as well and emit
both messages on a single line to make grepping
a bit easier.

Something like:

---
 block/blk-core.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
block/blk-core.c +5 -6
index a0e3096..2a710df 100644
@@ -1624,12 +1624,11 @@ static void handle_bad_sector(struct bio *bio)
 {
 	char b[BDEVNAME_SIZE];
 
-	printk(KERN_INFO "attempt to access beyond end of device\n");
-	printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
-			bdevname(bio->bi_bdev, b),
-			bio->bi_rw,
-			(unsigned long long)bio_end_sector(bio),
-			(long long)(i_size_read(bio->bi_bdev->bd_inode) >> 9));
+	printk(KERN_INFO "%s: attempt to access beyond end of device - rw=%s(%lx), want=%Lu, limit=%Lu\n",
+	       bdevname(bio->bi_bdev, b),
+	       bio->bi_rw & WRITE ? "WRITE" : "READ", bio->bi_rw,
+	       (unsigned long long)bio_end_sector(bio),
+	       (long long)(i_size_read(bio->bi_bdev->bd_inode) >> 9));
 
 	set_bit(BIO_EOF, &bio->bi_flags);
 }