All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/blk-core.c: print readable string instead of values.
@ 2014-04-12  7:22 Jianyu Zhan
  2014-04-14 22:00 ` Muthukumar R
  0 siblings, 1 reply; 4+ messages in thread
From: Jianyu Zhan @ 2014-04-12  7:22 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel, nasa4836

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

Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index a0e3096..0a3bde3 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] block/blk-core.c: print readable string instead of values.
  2014-04-12  7:22 [PATCH] block/blk-core.c: print readable string instead of values Jianyu Zhan
@ 2014-04-14 22:00 ` Muthukumar R
  2014-04-14 22:27   ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Muthukumar R @ 2014-04-14 22:00 UTC (permalink / raw)
  To: Jianyu Zhan; +Cc: Jens Axboe, linux-kernel

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

On Sat, Apr 12, 2014 at 12:22 AM, Jianyu Zhan <nasa4836@gmail.com> wrote:
> Print the r/w direction string instead of internal values.
>
> Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
> ---
>  block/blk-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index a0e3096..0a3bde3 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block/blk-core.c: print readable string instead of values.
  2014-04-14 22:00 ` Muthukumar R
@ 2014-04-14 22:27   ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2014-04-14 22:27 UTC (permalink / raw)
  To: Muthukumar R; +Cc: Jianyu Zhan, Jens Axboe, linux-kernel

On Mon, 2014-04-14 at 15:00 -0700, Muthukumar R wrote:
> FYI, bi_rw tracks more than WRITE or READ...
> 
> On Sat, Apr 12, 2014 at 12:22 AM, Jianyu Zhan <nasa4836@gmail.com> wrote:
> > Print the r/w direction string instead of internal values.
[]
> > diff --git a/block/blk-core.c b/block/blk-core.c
[]
> > @@ -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(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index a0e3096..2a710df 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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);
 }



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] block/blk-core.c: print readable string instead of values.
@ 2014-04-15  6:10 Jianyu Zhan
  0 siblings, 0 replies; 4+ messages in thread
From: Jianyu Zhan @ 2014-04-15  6:10 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel, nasa4836

Hi, Joe Perches, I think your suggestion is more desirable. The message is 
too long, I broke it into two lines. Thanks.

---<8---
 
Also print the r/w direction string instead of only internal values.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
---
 block/blk-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index a0e3096..f8170c7 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1624,10 +1624,10 @@ 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: attempt to access beyond end of device - "
+			"rw=%s(%lx), want=%Lu, limit=%Lu\n",
 			bdevname(bio->bi_bdev, b),
-			bio->bi_rw,
+			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));
 
-- 
1.9.0.GIT


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-15  6:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-12  7:22 [PATCH] block/blk-core.c: print readable string instead of values Jianyu Zhan
2014-04-14 22:00 ` Muthukumar R
2014-04-14 22:27   ` Joe Perches
2014-04-15  6:10 Jianyu Zhan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.